Christophe Dervieux | aa008e4 | 2021-09-23 16:52:37 +0200 | [diff] [blame^] | 1 | test_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 | }) |