summaryrefslogtreecommitdiffstats
path: root/hugolib/page_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-02-22 14:42:33 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2022-02-23 10:02:16 +0100
commite97d3c640fc5e845135c5f8f49ff11e23cffddeb (patch)
tree3aba294bd72363dcafd9ef6bad8ce99ad97289ec /hugolib/page_test.go
parent7732da9f93503c1a723d6ac5bb77da206cb0fa0e (diff)
Add page.Store
Fixes #9546
Diffstat (limited to 'hugolib/page_test.go')
-rw-r--r--hugolib/page_test.go46
1 files changed, 45 insertions, 1 deletions
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index 6b35e4814..1edef622b 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -1769,7 +1769,7 @@ Summary: In Chinese, 好 means good.
b.AssertFileContent("public/p6/index.html", "WordCount: 7\nFuzzyWordCount: 100\nReadingTime: 1\nLen Plain: 638\nLen PlainWords: 7\nTruncated: false\nLen Summary: 637\nLen Content: 652")
}
-func TestScratchSite(t *testing.T) {
+func TestScratch(t *testing.T) {
t.Parallel()
b := newTestSitesBuilder(t)
@@ -1796,6 +1796,50 @@ title: Scratch Me!
b.AssertFileContent("public/scratchme/index.html", "C: cv")
}
+func TestScratchRebuild(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- config.toml --
+-- content/p1.md --
+---
+title: "p1"
+---
+{{< scratchme >}}
+-- layouts/shortcodes/foo.html --
+notused
+-- layouts/shortcodes/scratchme.html --
+{{ .Page.Scratch.Set "scratch" "foo" }}
+{{ .Page.Store.Set "scratch" "bar" }}
+-- layouts/_default/single.html --
+{{ .Content }}
+Scratch: {{ .Scratch.Get "scratch" }}|
+Store: {{ .Store.Get "scratch" }}|
+`
+
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ Running: true,
+ },
+ ).Build()
+
+ b.AssertFileContent("public/p1/index.html", `
+Scratch: foo|
+Store: bar|
+ `)
+
+ b.EditFiles("layouts/shortcodes/foo.html", "edit")
+
+ b.Build()
+
+ b.AssertFileContent("public/p1/index.html", `
+Scratch: |
+Store: bar|
+ `)
+}
+
func TestPageParam(t *testing.T) {
t.Parallel()