File: test-pandoc.R

package info (click to toggle)
r-cran-htmlwidgets 1.6.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 500 kB
  • sloc: javascript: 597; makefile: 2
file content (31 lines) | stat: -rw-r--r-- 677 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
test_that("Fix for issue #358 works", {
  skip_if_not(
    rmarkdown::pandoc_available(),
    "Test requires pandoc to be installed"
  )

  file <- tempfile(fileext = ".html")
  html <- div(
    div(
      div(
        div(
          div(
            "Hello"
          )
        )
      )
    )
  )

  get_pandoc_html <- function(html, file, title = "test", ...) {
    write_md_for_pandoc(html, file, title = title, ...)
    pandoc_self_contained_html(file, file)
    readLines(file)
  }

  lines <- get_pandoc_html(html, file)
  expect_false(any(grepl("<pre", lines)))

  lines <- get_pandoc_html(html, file, use_raw_attr = FALSE)
  expect_false(any(grepl("<pre", lines)))
})