Skip to content

Commit baa4945

Browse files
committed
change tests to reflect change in axis titles
1 parent c28aed1 commit baa4945

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

tests/testthat/test-cookbook-axes.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ no.x.title <- bp +
107107

108108
test_that("coord_fixed(ratio)", {
109109
info <- expect_traces(no.x.title, 1, "no-x-title")
110-
expect_true(length(info$layout$annotations) == 1)
110+
expect_identical(info$xaxis$title, "")
111111
})
112112

113113
# Also possible to set the axis label with the scale

tests/testthat/test-ggplot-labels.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ test_that("ylab is translated correctly", {
1313
geom_point(aes(Petal.Width, Sepal.Width)) +
1414
ylab("sepal width")
1515
info <- save_outputs(ggiris, "labels-ylab")
16-
labs <- unlist(lapply(info$layout$annotations, "[[", "text"))
17-
expect_identical(sort(labs), c("Petal.Width", "sepal width"))
16+
labs <- c(info$layout$xaxis$title, info$layout$yaxis$title)
17+
expect_identical(labs, c("Petal.Width", "sepal width"))
1818
})
1919

2020
# TODO: why is this failing on R-devel???

tests/testthat/test-ggplot-legend.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ test_that("Discrete colour and shape get merged into one legend", {
3030
nms, paste0("(", d$vs, ",", d$cyl, ")")
3131
)
3232
a <- info$layout$annotations
33-
expect_match(a[[3]]$text, "^factor\\(vs\\)")
34-
expect_match(a[[3]]$text, "factor\\(cyl\\)$")
35-
expect_true(a[[3]]$y > info$layout$legend$y)
33+
expect_match(a[[1]]$text, "^factor\\(vs\\)")
34+
expect_match(a[[1]]$text, "factor\\(cyl\\)$")
35+
expect_true(a[[1]]$y > info$layout$legend$y)
3636
})
3737

3838

0 commit comments

Comments
 (0)