Skip to content

Commit 705feda

Browse files
committed
add test
1 parent e07bd8e commit 705feda

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tests/testthat/test-scales-breaks-labels.R

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,17 @@ test_that("equal length breaks and labels can be passed to ViewScales with limit
273273
expect_identical(test_view_scale_rev$get_labels(), c(c("0", "20", "40")))
274274
})
275275

276+
test_that("break names are returned as labels", {
277+
278+
sc <- scale_x_continuous(breaks = c(A = 10, B = 20, C = 30))
279+
sc$train(c(10, 30))
280+
expect_equal(sc$get_labels(), c("A", "B", "C"))
281+
282+
sc <- scale_x_discrete(breaks = c(foo = "A", bar = "B", qux = "C"))
283+
sc$train(c(LETTERS[1:3]))
284+
expect_equal(sc$get_labels(), c("foo", "bar", "qux"))
285+
})
286+
276287
# Visual tests ------------------------------------------------------------
277288

278289
test_that("minor breaks draw correctly", {

0 commit comments

Comments
 (0)