diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-02-19 11:32:28 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2024-02-19 14:50:23 +0100 |
commit | 5dbc29dc6c02d8d1e2f0deef7be6a58609b78d5d (patch) | |
tree | 12af34b1640473cbe828a55f945837c652891da7 /hugolib | |
parent | 5ada27bf65935b030c84a7cc1257c66f8eedfd84 (diff) |
Handle rebuilds when resources passed to transform.Unmarshal etc. changes
Fixes #12065
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/rebuild_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go index d29215a01..cf98f55da 100644 --- a/hugolib/rebuild_test.go +++ b/hugolib/rebuild_test.go @@ -77,6 +77,27 @@ func TestRebuildEditTextFileInLeafBundle(t *testing.T) { b.AssertRenderCountContent(1) } +func TestRebuiEditUnmarshaledYamlFileInLeafBundle(t *testing.T) { + files := ` +-- hugo.toml -- +baseURL = "https://example.com" +disableLiveReload = true +disableKinds = ["taxonomy", "term", "sitemap", "robotsTXT", "404", "rss"] +-- content/mybundle/index.md -- +-- content/mybundle/mydata.yml -- +foo: bar +-- layouts/_default/single.html -- +MyData: {{ .Resources.Get "mydata.yml" | transform.Unmarshal }}| +` + b := TestRunning(t, files) + + b.AssertFileContent("public/mybundle/index.html", "MyData: map[foo:bar]") + + b.EditFileReplaceAll("content/mybundle/mydata.yml", "bar", "bar edited").Build() + + b.AssertFileContent("public/mybundle/index.html", "MyData: map[foo:bar edited]") +} + func TestRebuildEditTextFileInHomeBundle(t *testing.T) { b := TestRunning(t, rebuildFilesSimple) b.AssertFileContent("public/index.html", "Home Content.") |