Skip to content

Commit 4b7cdf3

Browse files
committed
add additional test for tidyverse#3313
1 parent 5135e62 commit 4b7cdf3

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/testthat/test-facet-map.r

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,22 @@ test_that("wrap and grid can facet by a date variable", {
7575
expect_equal(loc_grid_row$PANEL, factor(1:3))
7676
})
7777

78+
test_that("wrap and grid can facet by a POSIXct variable", {
79+
date_df <- data_frame(date_var = as.POSIXct(c("1971-12-11", "1987-01-13", "2000-01-01")))
80+
81+
wrap <- facet_wrap(~date_var)
82+
loc_wrap <- panel_map_one(wrap, date_df)
83+
expect_equal(loc_wrap$PANEL, factor(1:3))
84+
85+
grid_col <- facet_grid(~date_var)
86+
loc_grid_col <- panel_map_one(grid_col, date_df)
87+
expect_equal(loc_grid_col$PANEL, factor(1:3))
88+
89+
grid_row <- facet_grid(date_var ~ .)
90+
loc_grid_row <- panel_map_one(grid_row, date_df)
91+
expect_equal(loc_grid_row$PANEL, factor(1:3))
92+
})
93+
7894
# Missing behaviour ----------------------------------------------------------
7995

8096
a3 <- data_frame(

0 commit comments

Comments
 (0)