Skip to content

Commit

Permalink
update failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Jan 17, 2024
1 parent 8a8c3af commit 8cc3f1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/testthat/test_get_legend.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ test_that("get legend", {
expect_equal(l$name, "guide-box")

# return null legend if no legend
expect_null(get_legend(p + theme(legend.position = "none")))
expect_s3_class(get_legend(p + theme(legend.position = "none")), "zeroGrob")
})

7 changes: 7 additions & 0 deletions tests/testthat/test_plot_components.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ test_that("plot components", {
"axis-b", "spacer", "axis-r", "spacer", "xlab-t", "xlab-b", "ylab-l",
"ylab-r", "guide-box", "subtitle", "title", "caption", "tag"
)
if (inherits(guide_legend(), "Guide")) { # proxy testing for ggplot2 3.5.0+
component_names <- setdiff(component_names, c("guide-box", "tag"))
component_names <- union(
component_names,
paste0("guide-box-", c("left", "right", "top", "bottom", "inside"))
)
}

expect_type(plot_component_names(p), "character")
expect_true(all(component_names %in% plot_component_names(p)))
Expand Down

0 comments on commit 8cc3f1b

Please sign in to comment.