summaryrefslogtreecommitdiffstats
path: root/hugolib/cascade_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-26 14:20:31 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2019-11-26 17:04:39 +0100
commit01766439246add22a6e6d0c12f932610be55cd8a (patch)
treeaa748a3c1cd6c5ab52caee1b29bd12866ce9f05a /hugolib/cascade_test.go
parentda53523599b43261520a22d77019b390aaa072e7 (diff)
hugolib: Fix cascade in server mode
Fixes #6538
Diffstat (limited to 'hugolib/cascade_test.go')
-rw-r--r--hugolib/cascade_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/hugolib/cascade_test.go b/hugolib/cascade_test.go
index d6701cf28..6b176ad64 100644
--- a/hugolib/cascade_test.go
+++ b/hugolib/cascade_test.go
@@ -100,6 +100,50 @@ func TestCascade(t *testing.T) {
}
+func TestCascadeEdit(t *testing.T) {
+ p1Content := `---
+title: P1
+---
+`
+ b := newTestSitesBuilder(t).Running()
+ b.WithTemplatesAdded("_default/single.html", `Banner: {{ .Params.banner }}|Layout: {{ .Layout }}|Type: {{ .Type }}|Content: {{ .Content }}`)
+ b.WithContent("post/_index.md", `
+---
+title: Post
+cascade:
+ banner: post.jpg
+ layout: postlayout
+ type: posttype
+---
+`)
+
+ b.WithContent("post/dir/_index.md", `
+---
+title: Dir
+---
+`, "post/dir/p1.md", p1Content)
+ b.Build(BuildCfg{})
+
+ assert := func() {
+ b.Helper()
+ b.AssertFileContent("public/post/dir/p1/index.html",
+ `Banner: post.jpg|`,
+ `Layout: postlayout`,
+ `Type: posttype`,
+ )
+ }
+
+ assert()
+
+ b.EditFiles("content/post/dir/p1.md", p1Content+"\ncontent edit")
+ b.Build(BuildCfg{})
+
+ assert()
+ b.AssertFileContent("public/post/dir/p1/index.html",
+ `content edit`,
+ )
+}
+
func newCascadeTestBuilder(t testing.TB, langs []string) *sitesBuilder {
p := func(m map[string]interface{}) string {
var yamlStr string