File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 4040
4141 The `blablabla` theme element must be a <element_text> object.
4242
43+ ---
44+
45+ `element_tree` must have names.
46+
47+ ---
48+
49+ `element_tree` must have elements constructed with `el_def()`.
50+ i Invalid structure: "foo"
51+
52+ ---
53+
54+ Invalid parent in `element_tree`: "foo".
55+
4356# Theme elements are checked during build
4457
4558 `plot.title.position` must be one of "panel" or "plot", not "test".
Original file line number Diff line number Diff line change @@ -312,6 +312,17 @@ test_that("element tree can be modified", {
312312 p1 <- ggplot() + theme(blablabla = element_line())
313313 expect_snapshot_error(ggplotGrob(p1 ))
314314
315+ # Expect errors for invalid element trees
316+ expect_snapshot_error(
317+ register_theme_elements(element_tree = list (el_def(" rect" ), el_def(" line" )))
318+ )
319+ expect_snapshot_error(
320+ register_theme_elements(element_tree = list (foo = " bar" ))
321+ )
322+ expect_snapshot_error(
323+ register_theme_elements(element_tree = list (foo = el_def(inherit = " foo" )))
324+ )
325+
315326 # inheritance and final calculation of novel element works
316327 final_theme <- ggplot2 ::: plot_theme(p , theme_gray())
317328 e1 <- calc_element(" blablabla" , final_theme )
You can’t perform that action at this time.
0 commit comments