Skip to content

Commit d2bc04f

Browse files
committed
Test for incomplete theme() docs
1 parent c02c05a commit d2bc04f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/testthat/test-theme.R

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,4 +692,14 @@ test_that("legends are placed correctly when using stretchy spacing", {
692692
"horizontal legends placed apart",
693693
p + theme(legend.position = "top", legend.spacing.x = unit(1, "null"))
694694
)
695+
696+
test_that("all theme elements are documented", {
697+
all_elems <- names(.element_tree)
698+
doc_fmls <- rlang::fn_fmls_names(theme)
699+
missing_elems <- setdiff(all_elems, doc_fmls)
700+
701+
expect(length(missing_elems) == 0, c(
702+
"Expected all elements in `.element_tree` to have corresponding parameters in `theme()`.",
703+
sprintf("Element is missing from theme(): %s", paste(missing_elems))
704+
))
695705
})

0 commit comments

Comments
 (0)