Skip to content

Commit cf40e19

Browse files
committed
modify test
1 parent 90f60eb commit cf40e19

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

tests/testthat/_snaps/geom-ribbon.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,7 @@
2323

2424
`outline.type` must be one of "both", "upper", "lower", or "full", not "test".
2525

26+
# NAs are dropped from the data
27+
28+
Removed 1 row containing missing values or values outside the scale range (`geom_ribbon()`).
29+

tests/testthat/test-geom-ribbon.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,19 @@ test_that("geom_ribbon() checks the aesthetics", {
1313
expect_snapshot_error(geom_ribbon(aes(year, ymin = level - 5, ymax = level + 5), outline.type = "test"))
1414
})
1515

16-
test_that("NAs are not dropped from the data", {
16+
test_that("NAs are dropped from the data", {
1717
df <- data_frame(x = 1:5, y = c(1, 1, NA, 1, 1))
1818

1919
p <- ggplot(df, aes(x))+
2020
geom_ribbon(aes(ymin = y - 1, ymax = y + 1))
21+
p <- ggplot_build(p)
2122

2223
expect_equal(get_layer_data(p)$ymin, c(0, 0, NA, 0, 0))
24+
expect_snapshot_warning(
25+
grob <- get_layer_grob(p)[[1]]
26+
)
27+
# We expect the ribbon to be broken up into 2 parts
28+
expect_length(grob$children, 2)
2329
})
2430

2531
test_that("geom_ribbon works in both directions", {

0 commit comments

Comments
 (0)