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 40
40
41
41
The `blablabla` theme element must be a <element_text> object.
42
42
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
+
43
56
# Theme elements are checked during build
44
57
45
58
`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", {
312
312
p1 <- ggplot() + theme(blablabla = element_line())
313
313
expect_snapshot_error(ggplotGrob(p1 ))
314
314
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
+
315
326
# inheritance and final calculation of novel element works
316
327
final_theme <- ggplot2 ::: plot_theme(p , theme_gray())
317
328
e1 <- calc_element(" blablabla" , final_theme )
You can’t perform that action at this time.
0 commit comments