Skip to content

Commit f9dfb2d

Browse files
committed
add test
1 parent 706752a commit f9dfb2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/testthat/test-guides.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,20 @@ test_that("bins can be parsed by guides for all scale types", {
552552
)
553553
})
554554

555+
test_that("binned breaks can have hardcoded labels when oob", {
556+
557+
sc <- scale_colour_binned(breaks = 1:3, labels = as.character(1:3))
558+
sc$train(c(1, 2))
559+
560+
g <- guide_bins()
561+
key <- g$train(scale = sc, aesthetic = "colour")$key
562+
expect_equal(key$.label, c("1", "2"))
563+
564+
g <- guide_coloursteps()
565+
key <- g$train(scale = sc, aesthetic = "colour")$key
566+
expect_equal(key$.label, c("1", "2"))
567+
})
568+
555569
test_that("legends can be forced to display unrelated geoms", {
556570

557571
df <- data.frame(x = 1:2)

0 commit comments

Comments
 (0)