Skip to content

Commit a73f527

Browse files
committed
add tests for marker.size length
1 parent 7db57c8 commit a73f527

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

tests/testthat/test-plotly-sf.R

+3
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,15 @@ test_that("sizing constants", {
240240
p <- plot_mapbox(mn_pts, size = I(30)) %>% plotly_build()
241241
d <- p$x$data
242242
expect_length(d, 1)
243+
expect_length(d[[1]]$marker$size, nrow(mn_pts))
243244
expect_true(all(d[[1]]$marker$size == 30))
244245
expect_true(d[[1]]$marker$sizemode == "area")
245246

246247
# span controls marker.line.width
247248
p <- plot_ly(mn_pts, size = I(30), span = I(10), stroke = I("black")) %>% plotly_build()
248249
d <- p$x$data
249250
expect_length(d, 1)
251+
expect_length(d[[1]]$marker$size, nrow(mn_pts))
250252
expect_true(all(d[[1]]$marker$size == 30))
251253
expect_true(d[[1]]$marker$sizemode == "area")
252254
expect_true(d[[1]]$marker$line$width == 10)
@@ -256,6 +258,7 @@ test_that("sizing constants", {
256258
p <- plot_ly(mn_pts, size = I(20), error_x = list(value = 5)) %>% plotly_build()
257259
d <- p$x$data
258260
expect_length(d, 1)
261+
expect_length(d[[1]]$marker$size, nrow(mn_pts))
259262
expect_true(all(d[[1]]$marker$size == 20))
260263
expect_true(d[[1]]$marker$sizemode == "area")
261264
expect_true(d[[1]]$error_x$value == 5)

tests/testthat/test-plotly-size.R

+1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ test_that("sizemode is always respected", {
2222
test_that("size maps correctly to marker.size", {
2323
p <- plot_ly(x = 1:10, y = 1:10, size = I(30))
2424
d <- expect_doppelganger_built(p, "marker.size")$data
25+
expect_length(d[[1]]$marker$size, 10)
2526
expect_true(all(d[[1]]$marker$size == 30))
2627
})

0 commit comments

Comments
 (0)