Skip to content

Commit 922094b

Browse files
committed
add a minimal test of the problem
1 parent fc4e434 commit 922094b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/testthat/test-plotly-group.R

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,22 @@ test_that("Groups are ignored if grouping is irrelevant for the geom", {
6565
expect_length(l$data[[1]][["x"]], 32)
6666
expect_length(l$data[[1]][["y"]], 32)
6767
})
68+
69+
70+
test_that("Ordering of marker.color should not change in a simple scatterplot", {
71+
72+
# https://github.com/ropensci/plotly/issues/1351
73+
l <- mtcars %>%
74+
mutate(id = seq_len(nrow(.))) %>%
75+
group_by(cyl) %>%
76+
plot_ly(
77+
x = ~mpg, y = ~wt, text = ~id,
78+
marker = list(color = ~ifelse(id == 1, "black", "red")),
79+
mode = "marker+text", textposition = "right"
80+
) %>%
81+
expect_doppelganger_built("simple-scatter-marker-color-group")
82+
83+
expect_true(
84+
all(l$data[[1]]$marker$color == c("black", rep("red", 31)))
85+
)
86+
})

0 commit comments

Comments
 (0)