aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib/content_render_hooks_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2020-11-26 08:32:49 +0100
committerBjørn Erik Pedersen <[email protected]>2020-11-26 20:41:54 +0100
commite442cf30a215e33b49ce588a9098147282bd883f (patch)
tree2571d16dd2bb8baa28fb9ededbc527b4d6fa18ce /hugolib/content_render_hooks_test.go
parent7e223b3baaef68d6e6f99e28f162362c81deffba (diff)
downloadhugo-e442cf30a215e33b49ce588a9098147282bd883f.tar.gz
hugo-e442cf30a215e33b49ce588a9098147282bd883f.zip
Fix server rebuild issue with partials referenced from render hooks
Fixes #7990
Diffstat (limited to 'hugolib/content_render_hooks_test.go')
-rw-r--r--hugolib/content_render_hooks_test.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/hugolib/content_render_hooks_test.go b/hugolib/content_render_hooks_test.go
index 17d273a33..13bfe216a 100644
--- a/hugolib/content_render_hooks_test.go
+++ b/hugolib/content_render_hooks_test.go
@@ -20,6 +20,43 @@ import (
qt "github.com/frankban/quicktest"
)
+func TestRenderHookEditNestedPartial(t *testing.T) {
+ config := `
+baseURL="https://example.org"
+workingDir="/mywork"
+`
+ b := newTestSitesBuilder(t).WithWorkingDir("/mywork").WithConfigFile("toml", config).Running()
+
+ b.WithTemplates("_default/single.html", "{{ .Content }}")
+ b.WithTemplates("partials/mypartial1.html", `PARTIAL1 {{ partial "mypartial2.html" }}`)
+ b.WithTemplates("partials/mypartial2.html", `PARTIAL2`)
+ b.WithTemplates("_default/_markup/render-link.html", `Link {{ .Text | safeHTML }}|{{ partial "mypartial1.html" . }}END`)
+
+ b.WithContent("p1.md", `---
+title: P1
+---
+
+[First Link](https://www.google.com "Google's Homepage")
+
+`)
+ b.Build(BuildCfg{})
+
+ b.AssertFileContent("public/p1/index.html", `Link First Link|PARTIAL1 PARTIAL2END`)
+
+ b.EditFiles("layouts/partials/mypartial1.html", `PARTIAL1_EDITED {{ partial "mypartial2.html" }}`)
+
+ b.Build(BuildCfg{})
+
+ b.AssertFileContent("public/p1/index.html", `Link First Link|PARTIAL1_EDITED PARTIAL2END`)
+
+ b.EditFiles("layouts/partials/mypartial2.html", `PARTIAL2_EDITED`)
+
+ b.Build(BuildCfg{})
+
+ b.AssertFileContent("public/p1/index.html", `Link First Link|PARTIAL1_EDITED PARTIAL2_EDITEDEND`)
+
+}
+
func TestRenderHooks(t *testing.T) {
config := `
baseURL="https://example.org"