tests/testthat/test-theme-htmlTable.R

test_that("theme_htmlTable works", {
  data(iris)
  x <- condformat(head(iris)) %>% theme_htmlTable(caption = "Table 1: MySimpleTestCaption")
  out <- condformat2html(x)
  expect_match(out, "MySimpleTestCaption")
})

test_that("theme_caption works", {
  x <- data.frame(a = 1) %>% theme_caption("potato") %>% condformat2html()
  out <- strsplit(x, "\n", fixed = TRUE)[[1]]
  expect_true(any(grepl("potato", out, fixed = TRUE)))
  x <- data.frame(a = 1) %>% theme_htmlTable(caption = "potato") %>% condformat2html()
  out <- strsplit(x, "\n", fixed = TRUE)[[1]]
  expect_true(any(grepl("potato", out, fixed = TRUE)))
})

Try the condformat package in your browser

Any scripts or data that you put into this service are public.

condformat documentation built on Oct. 8, 2023, 9:07 a.m.