1context("scale_gradient")
2
3# Limits ------------------------------------------------------------------
4
5test_that("points outside the limits are plotted as NA", {
6  df <- data_frame(x = c(0, 1, 2))
7  p <- ggplot(df, aes(x, 1, fill = x)) +
8    geom_col() +
9    scale_fill_gradient2(limits = c(-1, 1), midpoint = 2, na.value = "orange")
10
11  correct_fill <- c("#B26D65", "#DCB4AF", "orange")
12  expect_equivalent(layer_data(p)$fill, correct_fill)
13})
14