blob: ade1c9aed2ef942cbe32ff69b4ba92f221b21168 [file] [log] [blame]
Christophe Dervieuxaa008e42021-09-23 16:52:37 +02001test_that("toc argument works", {
2 skip_if_not_pandoc()
3 skip_if_not_installed("xml2")
4 rmd <- local_temp_draft()
5 html <- .render_and_read(
6 rmd,
7 output_options = list(
8 toc = TRUE,
9 pandoc_args = c(pandoc_variable_arg("toc-title", "TOC"))
10 )
11 )
12 toc <- xml2::xml_find_all(html, "//section[@id='TOC']")
13 expect_length(toc, 1)
14 expect_equal(
15 xml2::xml_text(
16 xml2::xml_find_all(toc, "./nav/*[contains(@id, 'toc-title')]")
17 ),
18 "TOC"
19 )
20})