blob: 98ec1d07b68ad40ba8eab2e8ca304720b2da75a4 [file] [log] [blame]
Christophe Dervieux2f01dc92021-09-22 09:37:18 +02001test_that("reveal options are passed as pandoc variables", {
2 expect_equal(process_reveal_option("a", "b"), pandoc_variable_arg("a", "b"))
3})
4
5test_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
10test_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
15test_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
22test_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 Dervieuxe1893ae2021-10-07 17:09:02 +020024 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 Dervieux2f01dc92021-09-22 09:37:18 +020028 expect_equal(process_reveal_option("chalkboard-draw", c("a", "b")), pandoc_variable_arg("chalkboard-draw", "['a', 'b']"))
Christophe Dervieux2f01dc92021-09-22 09:37:18 +020029 expect_equal(process_reveal_option("chalkboard-other", "dummy"), pandoc_variable_arg("chalkboard-other", "dummy"))
30})
31
Christophe Dervieuxe1893ae2021-10-07 17:09:02 +020032test_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
37test_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
42test_that("Version of revealjs can be retrieved", {
43 expect_s3_class(revealjs_version(), "numeric_version")
44})