😎 Give your xaringan slides some style
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

70 lines
1.4KB

  1. context("test-list2css.R")
  2. test_that("list2css converts lists to css", {
  3. css <- list(
  4. ".remark-slide" = list(
  5. "color" = "#FFF",
  6. "font-size" = "30px"
  7. )
  8. )
  9. expected <- ".remark-slide {
  10. color: #FFF;
  11. font-size: 30px;
  12. }"
  13. expect_equal(list2css(css), expected)
  14. css[[".new-class"]] <- list("background-color" = "#000")
  15. expected <- c(expected, ".new-class {\n background-color: #000;\n}")
  16. expect_equal(list2css(css), expected)
  17. })
  18. test_that("list2css errors if css list is not named", {
  19. css <- list(list(
  20. "color" = "#FFF",
  21. "font-size" = "30px"
  22. ))
  23. expect_error(list2css(css))
  24. })
  25. test_that("list2css errors if css list has unnamed elements", {
  26. css <- list(
  27. list(
  28. "color" = "#FFF",
  29. "font-size" = "30px"
  30. ),
  31. ".test" = list(color = "red")
  32. )
  33. expect_error(list2css(css))
  34. })
  35. test_that("list2css errors if css list has unnamed properties", {
  36. css <- list(
  37. ".class" = list(
  38. color = "#FFF",
  39. "font-size" = "30px"
  40. ),
  41. ".test" = list("red")
  42. )
  43. expect_error(list2css(css))
  44. css <- list(
  45. ".class" = list(
  46. "#FFF",
  47. "font-size" = "30px"
  48. ),
  49. ".test" = list("red")
  50. )
  51. expect_error(list2css(css))
  52. })
  53. test_that("list2css errors if not list within list", {
  54. css <- list(
  55. ".class" = list(
  56. list(color = "red"),
  57. "font-size" = "30px"
  58. ),
  59. ".test" = list("red")
  60. )
  61. expect_error(list2css(css))
  62. })