Christophe Dervieux | 2f01dc9 | 2021-09-22 09:37:18 +0200 | [diff] [blame] | 1 | test_that("reveal options are passed as pandoc variables", { |
| 2 | expect_equal(process_reveal_option("a", "b"), pandoc_variable_arg("a", "b")) |
| 3 | }) |
| 4 | |
| 5 | test_that("reveal options with boolean are transformed to JS bool", { |
| 6 | expect_equal(process_reveal_option("a", TRUE), pandoc_variable_arg("a", "true")) |
| 7 | expect_equal(process_reveal_option("a", FALSE), pandoc_variable_arg("a", "false")) |
| 8 | }) |
| 9 | |
| 10 | test_that("reveal options slideNumbers is treated specifically", { |
| 11 | expect_equal(process_reveal_option("slideNumber", "c/t"), pandoc_variable_arg("slideNumber", "'c/t'")) |
| 12 | expect_equal(process_reveal_option("slideNumber", TRUE), pandoc_variable_arg("slideNumber", "true")) |
| 13 | }) |
| 14 | |
| 15 | test_that("reveal options width / heigh in % are quoted", { |
| 16 | expect_equal(process_reveal_option("width", "50%"), pandoc_variable_arg("width", "'50%'")) |
| 17 | expect_equal(process_reveal_option("height", "50%"), pandoc_variable_arg("height", "'50%'")) |
| 18 | expect_equal(process_reveal_option("width", 5), pandoc_variable_arg("width", "5")) |
| 19 | expect_equal(process_reveal_option("height", 5), pandoc_variable_arg("height", "5")) |
| 20 | }) |
| 21 | |
| 22 | test_that("reveal options for chalkboard plugins special handling", { |
| 23 | expect_equal(process_reveal_option("chalkboard-background", "rgba(255,255,255,0.5)"), pandoc_variable_arg("chalkboard-background", "['rgba(255,255,255,0.5)']")) |
Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 24 | expect_equal( |
| 25 | process_reveal_option("chalkboard-background", "['rgba(127,127,127,.1)', path + 'img/blackboard.png' ]"), |
| 26 | pandoc_variable_arg("chalkboard-background", "['rgba(127,127,127,.1)', path + 'img/blackboard.png' ]") |
| 27 | ) |
Christophe Dervieux | 2f01dc9 | 2021-09-22 09:37:18 +0200 | [diff] [blame] | 28 | expect_equal(process_reveal_option("chalkboard-draw", c("a", "b")), pandoc_variable_arg("chalkboard-draw", "['a', 'b']")) |
Christophe Dervieux | 2f01dc9 | 2021-09-22 09:37:18 +0200 | [diff] [blame] | 29 | expect_equal(process_reveal_option("chalkboard-other", "dummy"), pandoc_variable_arg("chalkboard-other", "dummy")) |
| 30 | }) |
| 31 | |
Christophe Dervieux | e1893ae | 2021-10-07 17:09:02 +0200 | [diff] [blame] | 32 | test_that("reveal options for autoAnimateStyles handling", { |
| 33 | expect_equal(process_reveal_option("autoAnimateStyles", "padding"), pandoc_variable_arg("autoAnimateStyles", "['padding']")) |
| 34 | expect_equal(process_reveal_option("autoAnimateStyles", c("color", "padding")), pandoc_variable_arg("autoAnimateStyles", "['color', 'padding']")) |
| 35 | }) |
| 36 | |
| 37 | test_that("revealjs lib path is found in package", { |
| 38 | expect_match(revealjs_lib_path(), "revealjs/(inst/)?reveal\\.js-") |
| 39 | expect_true(dir.exists(revealjs_lib_path())) |
| 40 | }) |
| 41 | |
| 42 | test_that("Version of revealjs can be retrieved", { |
| 43 | expect_s3_class(revealjs_version(), "numeric_version") |
| 44 | }) |