blob: a3c3898632d4e4e02a77f2d3f9d4862810968169 [file] [log] [blame]
JJ Allaire6da1bb62016-01-30 14:28:39 -05001
2context("Themes")
3
4test_theme <- function(theme) {
5
6 test_that(paste(theme, "theme"), {
7
8 # don't run on cran because pandoc is required
9 skip_on_cran()
10
11 # work in a temp directory
12 dir <- tempfile()
13 dir.create(dir)
14 oldwd <- setwd(dir)
15 on.exit(setwd(oldwd), add = TRUE)
16
17 # create a draft of a presentation
18 testdoc <- "testdoc.Rmd"
19 rmarkdown::draft(testdoc,
20 system.file("rmarkdown", "templates", "revealjs_presentation",
21 package = "revealjs"),
22 create_dir = FALSE,
23 edit = FALSE)
24
25 # render it with the specified theme
26 capture.output({
27 output_file <- tempfile(fileext = ".html")
28 output_format <- revealjs_presentation(theme = theme)
29 rmarkdown::render(testdoc, output_file = output_file)
30 expect_true(file.exists(output_file))
31 })
32 })
33}
34
35# test all themes
36sapply(revealjs:::revealjs_themes(), test_theme)