blob: 63a3f2ed2f3e57cdbb2fa68aa9efe9c250422223 [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)
JJ Allaire091cb122016-02-09 13:04:23 -050029 rmarkdown::render(testdoc,
30 output_format = output_format,
31 output_file = output_file)
JJ Allaire6da1bb62016-01-30 14:28:39 -050032 expect_true(file.exists(output_file))
33 })
34 })
35}
36
37# test all themes
38sapply(revealjs:::revealjs_themes(), test_theme)