Skip to content

Commit

Permalink
add minimal tests for cols_nanoplot + remove tidyselect deprecation w…
Browse files Browse the repository at this point in the history
…arnings
  • Loading branch information
olivroy committed Sep 26, 2024
1 parent 21a3791 commit 4d1a09f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 6 additions & 6 deletions R/nanoplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -894,8 +894,8 @@ cols_nanoplot <- function(
cols_add(
.data = data,
nanoplots,
.before = before,
.after = after
.before = dplyr::all_of(before),
.after = dplyr::all_of(after)
)

if (!is.null(new_col_name)) {
Expand Down Expand Up @@ -923,7 +923,7 @@ cols_nanoplot <- function(
data <-
fmt_passthrough(
data = data,
columns = validated_new_col_name,
columns = dplyr::all_of(validated_new_col_name),
escape = FALSE
)

Expand Down Expand Up @@ -974,23 +974,23 @@ cols_nanoplot <- function(
"vertical-align: middle; ",
"overflow-x: visible;"
),
locations = cells_body(columns = validated_new_col_name)
locations = cells_body(columns = dplyr::all_of(validated_new_col_name))
)

if (isTRUE(autohide)) {

data <-
cols_hide(
data = data,
columns = resolved_columns
columns = dplyr::all_of(resolved_columns)
)

if (length(resolved_columns_x) > 0) {

data <-
cols_hide(
data = data,
columns = resolved_columns_x
columns = dplyr::all_of(resolved_columns_x)
)
}
}
Expand Down
12 changes: 12 additions & 0 deletions tests/testthat/test-cols_nanoplot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
test_that("multiplication works", {
skip_on_cran()
# options("lifecycle_verbosity" = "error")
dat <- dplyr::slice_head(sp500, n = 100)
tbl_gt <- gt(dat)
expect_no_error(
cols_nanoplot(tbl_gt, columns = open:close)
)
expect_no_error(
cols_nanoplot(tbl_gt, columns = open:close, autohide = TRUE)
)
})

0 comments on commit 4d1a09f

Please sign in to comment.