Skip to content

Commit 4ef0a82

Browse files
committed
test that .onLoad keeps ggplot theme and resets bayesplot theme
1 parent 4509682 commit 4ef0a82

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/testthat/test-aesthetics.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,18 @@ test_that("ggplot2::theme_set overrides bayesplot theme", {
210210
expect_identical(bayesplot_theme_get(), minimal)
211211
})
212212

213+
test_that(".onLoad keeps ggplot theme and resets bayesplot theme", {
214+
old <- ggplot2::theme_set(ggplot2::theme_minimal())
215+
before <- ggplot2::theme_get()
216+
bayesplot:::.onLoad()
217+
218+
expect_identical(bayesplot_theme_get(), default)
219+
expect_equal(.bayesplot_theme_env$current, default)
220+
expect_equal(ggplot2::theme_get(), before)
221+
expect_equal(.bayesplot_theme_env$gg_current, before)
222+
ggplot2::theme_set(old)
223+
})
224+
213225
bayesplot_theme_set(bayesplot::theme_default())
214226
color_scheme_set()
215227

0 commit comments

Comments
 (0)