Skip to content

Commit 0f378e7

Browse files
committed
add a few tests for new axis defaults
1 parent 3b365c4 commit 0f378e7

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

tests/testthat/test-ggplot-labels.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ test_that("angled ticks are translated correctly", {
3434
info <- save_outputs(ggiris, "labels-angles")
3535
expect_identical(info$layout$xaxis$tickangle, -45)
3636
})
37+
38+
test_that("xaxis/yaxis automargin defaults to TRUE", {
39+
p <- ggplot(iris, aes(Species)) + geom_bar() + coord_flip()
40+
l <- plotly_build(p)$x
41+
expect_true(l$layout$xaxis$automargin)
42+
expect_true(l$layout$yaxis$automargin)
43+
})

tests/testthat/test-plotly-splom.R

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
context("splom")
2+
3+
4+
test_that("No cartesian axes are supplied to a splom chart", {
5+
6+
p <- plot_ly(
7+
type = 'splom',
8+
dimensions = list(
9+
list(values=c(1,2,3), label="A"),
10+
list(values=c(2,5,6), label="B")
11+
)
12+
)
13+
14+
})

tests/testthat/test-plotly.R

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ test_that("plot_ly() handles a simple scatterplot", {
6262
expect_equivalent(l$data[[1]]$y, iris$Petal.Length)
6363
expect_true(l$layout$xaxis$title == "Sepal.Length")
6464
expect_true(l$layout$yaxis$title == "Petal.Length")
65+
expect_true(l$layout$xaxis$automargin)
66+
expect_true(l$layout$yaxis$automargin)
6567
})
6668

6769
test_that("type inference + add_data + layering works as expected", {

0 commit comments

Comments
 (0)