Skip to content

Commit afdd5e4

Browse files
committed
adapt tests
1 parent a969bd9 commit afdd5e4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tests/testthat/_snaps/facet-strips.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# facet_grid() warns about bad switch input
22

3-
`switch` must be one of "both", "x", or "y", not "z".
3+
`strip.position` can only contain "top", "right", "bottom", or "left".
44

tests/testthat/test-facet-strips.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ test_that("facet_grid() builds correct output", {
8282
})
8383

8484
test_that("facet_grid() switches to 'x'", {
85-
grid_x <- p + facet_grid(am ~ cyl, switch = "x")
85+
grid_x <- p + facet_grid(am ~ cyl, strip.position = "bottom")
8686

8787
grid_x_expected <- list(
8888
t = c(6, 6, 6, 3, 5),
@@ -95,7 +95,7 @@ test_that("facet_grid() switches to 'x'", {
9595
})
9696

9797
test_that("facet_grid() switches to 'y'", {
98-
grid_y <- p + facet_grid(am ~ cyl, switch = "y")
98+
grid_y <- p + facet_grid(am ~ cyl, strip.position = "left")
9999

100100
grid_y_expected <- list(
101101
t = c(3, 3, 3, 4, 6),
@@ -108,7 +108,7 @@ test_that("facet_grid() switches to 'y'", {
108108
})
109109

110110
test_that("facet_grid() switches to both 'x' and 'y'", {
111-
grid_xy <- p + facet_grid(am ~ cyl, switch = "both")
111+
grid_xy <- p + facet_grid(am ~ cyl, strip.position = c("bottom", "left"))
112112

113113
grid_xy_expected <- list(
114114
t = c(6, 6, 6, 3, 5),
@@ -121,7 +121,7 @@ test_that("facet_grid() switches to both 'x' and 'y'", {
121121
})
122122

123123
test_that("facet_grid() warns about bad switch input", {
124-
expect_snapshot_error(facet_grid(am ~ cyl, switch = "z"))
124+
expect_snapshot_error(facet_grid(am ~ cyl, strip.position = "z"))
125125
})
126126

127127
test_that("strips can be removed", {
@@ -165,7 +165,7 @@ test_that("padding is only added if axis is present", {
165165

166166
# Inverse should be true when strips are switched
167167
p <- ggplot(data = mpg, aes(x = displ, y = hwy)) +
168-
facet_grid(year ~ drv, switch = "both") +
168+
facet_grid(year ~ drv, strip.position = c("bottom", "left")) +
169169
theme(
170170
strip.placement = "outside",
171171
strip.switch.pad.grid = unit(10, "mm")
@@ -186,7 +186,7 @@ test_that("padding is only added if axis is present", {
186186
})
187187

188188
test_that("y strip labels are rotated when strips are switched", {
189-
switched <- p + facet_grid(am ~ cyl, switch = "both")
189+
switched <- p + facet_grid(am ~ cyl, strip.position = c("bottom", "left"))
190190

191191
expect_doppelganger("switched facet strips", switched)
192192
})

0 commit comments

Comments
 (0)