mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-21 20:46:30 -05:00
add integration test to test toc generation
This commit is contained in:
parent
addc311e56
commit
fbbcca40c8
1 changed files with 23 additions and 0 deletions
|
@ -60,3 +60,26 @@ func TestConversionWithHeader(t *testing.T) {
|
||||||
|
|
||||||
b.AssertFileContent("public/p1/index.html", `<h1 id="testcontent">testContent</h1>`)
|
b.AssertFileContent("public/p1/index.html", `<h1 id="testcontent">testContent</h1>`)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConversionWithExtractedToc(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
|
files := `
|
||||||
|
-- config.toml --
|
||||||
|
-- content/p1.md --
|
||||||
|
# title 1
|
||||||
|
## title 2
|
||||||
|
-- layouts/_default/single.html --
|
||||||
|
{{ .TableOfContents }}
|
||||||
|
{{ .Content }}
|
||||||
|
`
|
||||||
|
b := hugolib.NewIntegrationTestBuilder(
|
||||||
|
hugolib.IntegrationTestConfig{
|
||||||
|
T: t,
|
||||||
|
TxtarString: files,
|
||||||
|
NeedsOsFS: true,
|
||||||
|
},
|
||||||
|
).Build()
|
||||||
|
|
||||||
|
b.AssertFileContent("public/p1/index.html", "<nav id=\"TableOfContents\">\n <ul>\n <li><a href=\"#title-2\">title 2</a></li>\n </ul>\n</nav>\n<h1 id=\"title-1\">title 1</h1>\n<h2 id=\"title-2\">title 2</h2>")
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue