Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed May 22, 2024
1 parent dc1b802 commit b63cfd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/theme.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# validations yaml specification

Code
build_bslib_(template = list(theme = 1, bootstrap = 5))
build_bslib_(theme = 1)
Condition
Error in `bs_theme_rules()`:
! template.theme must be a string, not the number 1.
i Edit _pkgdown.yml to fix the problem.
Code
build_bslib_(template = list(theme = "fruit", bootstrap = 5))
build_bslib_(theme = "fruit")
Condition
Error in `build_bslib_()`:
! template.theme uses theme "fruit"
i Edit _pkgdown.yml to fix the problem.
Code
build_bslib_(template = list(`theme-dark` = "fruit", bootstrap = 5))
build_bslib_(`theme-dark` = "fruit")
Condition
Error in `build_bslib_()`:
! template.theme-dark uses theme "fruit"
Expand Down
10 changes: 6 additions & 4 deletions tests/testthat/test-theme.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
test_that("validations yaml specification", {
build_bslib_ <- function(...) {
pkg <- local_pkgdown_site(meta = list(...))
pkg <- local_pkgdown_site(
meta = list(template = list(..., bootstrap = 5, `light-switch` = TRUE))
)
build_bslib(pkg)
}

expect_snapshot(error = TRUE, {
build_bslib_(template = list(theme = 1, bootstrap = 5))
build_bslib_(template = list(theme = "fruit", bootstrap = 5))
build_bslib_(template = list(`theme-dark` = "fruit", bootstrap = 5))
build_bslib_(theme = 1)
build_bslib_(theme = "fruit")
build_bslib_(`theme-dark` = "fruit")
})
})

0 comments on commit b63cfd8

Please sign in to comment.