Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 4, 2023
1 parent 12f7703 commit eed28e9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions tests/testthat/test-guides.R
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,22 @@ test_that("Axis titles won't be blown away by coord_*()", {
# expect_doppelganger("guide titles with coord_sf()", plot + coord_sf())
})

test_that("absent titles don't take up space", {

p <- ggplot(mtcars, aes(disp, mpg, colour = factor(cyl))) +
geom_point() +
theme(
legend.title = element_blank(),
legend.margin = margin(),
legend.position = "top",
legend.justification = "left",
legend.key = element_rect(colour = "black"),
axis.line = element_line(colour = "black")
)

expect_doppelganger("left-aligned legend key", plot + coord_trans())
})

test_that("axis guides can be capped", {
p <- ggplot(mtcars, aes(hp, disp)) +
geom_point() +
Expand Down

0 comments on commit eed28e9

Please sign in to comment.