Skip to content

Add inherit.blank argument to element constructors #1754

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Sep 21, 2016
Prev Previous commit
Test all exported themes have inherit.blank = TRUE elements
  • Loading branch information
thomasp85 committed Sep 20, 2016
commit ea9b57ecfbdec8893ebe0e3b156aa339c17829d5
20 changes: 20 additions & 0 deletions tests/testthat/test-theme.r
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,23 @@ test_that("theme(validate=FALSE) means do not validate_element", {
red.before <- p + red.text + theme(animint.width = 500, validate = FALSE)
expect_equal(red.before$theme$animint.width, 500)
})

test_that("All elements in complete themes have inherit.blank=TRUE", {
inherit_blanks <- function(theme) {
all(vapply(theme, function(el) {
if (inherits(el, "element") && !inherits(el, "element_blank")) {
el$inherit.blank
} else {
TRUE
}
}, logical(1)))
}
expect_true(inherit_blanks(theme_grey()))
expect_true(inherit_blanks(theme_bw()))
expect_true(inherit_blanks(theme_classic()))
expect_true(inherit_blanks(theme_dark()))
expect_true(inherit_blanks(theme_light()))
expect_true(inherit_blanks(theme_linedraw()))
expect_true(inherit_blanks(theme_minimal()))
expect_true(inherit_blanks(theme_void()))
})