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 10:23:01 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2016-11-22 09:57:03 +0100
commit734b6508a12b29444ec78fc07d3f3805cf06ea3c (patch)
treeb91365eab9f68ac7c9864e5d98c8cde34b7b14d5 /hugolib/node_as_page_test.go
parente371ac0b6f56bdffe92b9e74dae571a003123912 (diff)
node to page: Handle home
With refactored paginator handling. Updates #2297
Diffstat (limited to 'hugolib/node_as_page_test.go')
-rw-r--r--hugolib/node_as_page_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/hugolib/node_as_page_test.go b/hugolib/node_as_page_test.go
index 0bbc99fd8..722e5990c 100644
--- a/hugolib/node_as_page_test.go
+++ b/hugolib/node_as_page_test.go
@@ -18,6 +18,7 @@ import (
"path/filepath"
"testing"
+ "github.com/spf13/viper"
"github.com/stretchr/testify/require"
)
@@ -54,6 +55,9 @@ Home **Content!**
Index Title: {{ .Title }}
Index Content: {{ .Content }}
# Pages: {{ len .Data.Pages }}
+{{ range .Paginator.Pages }}
+ Pag: {{ .Title }}
+{{ end }}
`)
writeSource(t, filepath.Join("layouts", "_default", "single.html"), `
@@ -70,6 +74,8 @@ Content Page %d
`, i, i))
}
+ viper.Set("paginate", 3)
+
s := newSiteDefaultLang()
if err := buildAndRenderSite(s); err != nil {
@@ -80,6 +86,7 @@ Content Page %d
"Index Title: Home Sweet Home!",
"Home <strong>Content!</strong>",
"# Pages: 10")
+
assertFileContent(t, filepath.Join("public", "regular1", "index.html"), false, "Single Title: Page 1", "Content Page 1")
h := s.owner
@@ -100,4 +107,11 @@ Content Page %d
require.False(t, first.IsNode())
require.True(t, first.IsPage())
+ first.Paginator()
+
+ // Check paginator
+ assertFileContent(t, filepath.Join("public", "page", "3", "index.html"), false,
+ "Pag: Page 6",
+ "Pag: Page 7")
+
}