Skip to content
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

suggestion to address get_legend issue #205 #206

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Update test_get_legend.R
updated test so now null is always expected
  • Loading branch information
jkylearmstrong committed Jun 28, 2024
commit 01a7969a5222dd07e3d5b394fd80fdd195e1fa3d
11 changes: 2 additions & 9 deletions tests/testthat/test_get_legend.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,7 @@ test_that("get legend", {
expect_equal(l$name, "guide-box")

# return null legend if no legend
# Note by Teun: It is yet unclear to me what the desired behaviour of
# `get_legend()` is in the face of multiple legends.
# For now, this test is conditional on ggplot2 version, but this is
# more of a duct tape solution than a reflection of the intended behaviour
if (utils::packageVersion("ggplot2") >= "3.5.0") {
expect_s3_class(get_legend(p + theme(legend.position = "none")), "zeroGrob")
} else {
expect_null(get_legend(p + theme(legend.position = "none")))
}
expect_null(get_legend(p + theme(legend.position = "none")))

})