diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-11-10 12:26:23 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2016-11-22 09:57:03 +0100 |
commit | 640b8bed21eabfd6e256814eab4b3ab3ad2e3354 (patch) | |
tree | 8d93c8e4bc36ceab954ef66300b592421fa7aff1 /hugolib/node_as_page_test.go | |
parent | 2d91b17c04c58e6186219bdbc81b711803c91e32 (diff) |
node to page: Handle sections with only _index.md
Updates #2297
Diffstat (limited to 'hugolib/node_as_page_test.go')
-rw-r--r-- | hugolib/node_as_page_test.go | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go index b871c3016..d6645bc54 100644 --- a/hugolib/node_as_page_test.go +++ b/hugolib/node_as_page_test.go @@ -116,6 +116,7 @@ Content Page %02d "Pag: Page 02") sections := h.findAllPagesByNodeType(NodeSection) + require.Len(t, sections, 2) // Check taxonomy lists @@ -352,8 +353,6 @@ menu: } func TestNodesWithAlias(t *testing.T) { - //jww.SetStdoutThreshold(jww.LevelDebug) - //defer jww.SetStdoutThreshold(jww.LevelFatal) testCommonResetState() writeLayoutsForNodeAsPageTests(t) @@ -380,6 +379,30 @@ aliases: } +func TestNodesWithSectionWithIndexPageOnly(t *testing.T) { + testCommonResetState() + + writeLayoutsForNodeAsPageTests(t) + + writeSource(t, filepath.Join("content", "sect", "_index.md"), `--- +title: MySection +--- +My Section Content +`) + + viper.Set("paginate", 1) + viper.Set("title", "Hugo Rocks!") + + s := newSiteDefaultLang() + + if err := buildAndRenderSite(s); err != nil { + t.Fatalf("Failed to build site: %s", err) + } + + assertFileContent(t, filepath.Join("public", "sect", "index.html"), true, "My Section") + +} + func writeRegularPagesForNodeAsPageTests(t *testing.T) { writeRegularPagesForNodeAsPageTestsWithLang(t, "") } |