summaryrefslogtreecommitdiffstats
path: root/hugolib/node_as_page_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-10-31 19:53:33 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-11-22 09:57:03 +0100
commit3737c9bcb39527298744ca287d1bd5b1dd530f52 (patch)
tree51d959ddc8b546c76d00b00766daade6d8527608 /hugolib/node_as_page_test.go
parentc2f3cb2d7aef86597e9fb61aaa872308a591f8c2 (diff)
node to page: Handle taxonomy lists
Updates #2297
Diffstat (limited to 'hugolib/node_as_page_test.go')
-rw-r--r--hugolib/node_as_page_test.go34
1 files changed, 29 insertions, 5 deletions
diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go
index 6d5c2fdb2..8527030bc 100644
--- a/hugolib/node_as_page_test.go
+++ b/hugolib/node_as_page_test.go
@@ -31,8 +31,8 @@ import (
*/
func TestNodesAsPage(t *testing.T) {
- //jww.SetStdoutThreshold(jww.LevelDebug)
- jww.SetStdoutThreshold(jww.LevelFatal)
+ jww.SetStdoutThreshold(jww.LevelDebug)
+ //jww.SetStdoutThreshold(jww.LevelFatal)
nodePageFeatureFlag = true
defer toggleNodePageFeatureFlag()
@@ -67,6 +67,12 @@ title: Section2
Section2 **Content!**
`)
+ writeSource(t, filepath.Join("content", "categories", "hugo", "_node.md"), `---
+title: Taxonomy Hugo
+---
+Taxonomy Hugo **Content!**
+`)
+
writeSource(t, filepath.Join("layouts", "index.html"), `
Index Title: {{ .Title }}
Index Content: {{ .Content }}
@@ -90,6 +96,15 @@ Section Content: {{ .Content }}
{{ end }}
`)
+ writeSource(t, filepath.Join("layouts", "_default", "taxonomy.html"), `
+Taxonomy Title: {{ .Title }}
+Taxonomy Content: {{ .Content }}
+# Pages: {{ len .Data.Pages }}
+{{ range .Paginator.Pages }}
+ Pag: {{ .Title }}
+{{ end }}
+`)
+
// Add some regular pages
for i := 1; i <= 4; i++ {
sect := "sect1"
@@ -120,7 +135,7 @@ Content Page %02d
assertFileContent(t, filepath.Join("public", "sect1", "regular1", "index.html"), false, "Single Title: Page 01", "Content Page 01")
h := s.owner
- nodes := h.findPagesByNodeType(NodeHome)
+ nodes := h.findAllPagesByNodeType(NodeHome)
require.Len(t, nodes, 1)
home := nodes[0]
@@ -129,7 +144,7 @@ Content Page %02d
require.True(t, home.IsNode())
require.False(t, home.IsPage())
- pages := h.findPagesByNodeType(NodePage)
+ pages := h.findAllPagesByNodeType(NodePage)
require.Len(t, pages, 4)
first := pages[0]
@@ -151,7 +166,16 @@ Content Page %02d
assertFileContent(t, filepath.Join("public", "sect1", "page", "2", "index.html"), false,
"Pag: Page 02")
- sections := h.findPagesByNodeType(NodeSection)
+ sections := h.findAllPagesByNodeType(NodeSection)
require.Len(t, sections, 2)
+ // Check taxonomy list
+ assertFileContent(t, filepath.Join("public", "categories", "hugo", "index.html"), false,
+ "Taxonomy Title: Taxonomy Hugo", "Taxonomy Hugo <strong>Content!</strong>")
+
+ // Check taxonomy list paginator
+ assertFileContent(t, filepath.Join("public", "categories", "hugo", "page", "2", "index.html"), false,
+ "Taxonomy Title: Taxonomy Hugo",
+ "Pag: Page 02")
+
}