Skip to content

Commit 3fd3797

Browse files
authored
Allow for bootswatch='default' in bs_theme() (#308)
* Allow for bootswatch='default' in bs_theme() as a way to opt out of a different default Bootswatch theme (Will be useful for flexdashboard::flex_dashboard, which wants to use Bootswatch cosmo by default * Also allow for 'bootstrap' * Update tests/testthat/test-theme-bootswatch.R
1 parent e09af88 commit 3fd3797

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

R/bs-theme.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,9 @@ bs3_accessibility_bundle <- function() {
374374
# -----------------------------------------------------------------
375375

376376
bootswatch_bundle <- function(bootswatch, version) {
377-
if (!length(bootswatch)) return(NULL)
377+
if (!length(bootswatch) || isTRUE(bootswatch %in% c("default", "bootstrap"))) {
378+
return(NULL)
379+
}
378380

379381
bootswatch <- switch_version(
380382
version,

tests/testthat/test-theme-bootswatch.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,15 @@ test_that("Can retrieve version from theme object", {
1515
expect_identical(
1616
theme_bootswatch(theme), "darkly"
1717
)
18+
19+
# Can use default to effectively remove bootswatch
20+
expect_identical(
21+
sass::sass(bs_theme_update(theme, bootswatch = "default")),
22+
sass::sass(bs_theme(version = "4"))
23+
)
24+
25+
# Can use default as a way to "explicitly don't use" a Bootswatch theme
26+
default <- bs_theme(version = "4", bootswatch = "default")
27+
expect_equal(default, bs_theme(version = "4"), ignore_attr = TRUE)
28+
expect_equal(theme_bootswatch(default), "default")
1829
})

0 commit comments

Comments
 (0)