Skip to content

Commit

Permalink
Update test-as_gt.R
Browse files Browse the repository at this point in the history
  • Loading branch information
ddsjoberg committed Dec 19, 2024
1 parent b8dcdf6 commit 1ef07a9
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/testthat/test-as_gt.R
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,29 @@ test_that("as_gt passes table text interpreters correctly", {

# spanning header
expect_true(attr(gt_tbl$`_spanners`$spanner_label[[2]], "html"))

# checking the placement of a second spanning header
expect_silent(
tbl2 <-
my_spanning_tbl |>
modify_spanning_header(all_stat_cols() ~ "**Tumor Grade**", level = 2) |>
as_gt()
)

expect_equal(
tbl2$`_spanners` |>
dplyr::select(vars, spanner_label, spanner_level) |>
dplyr::mutate(
vars = map_chr(vars, ~paste(.x, collapse = ", ")),
spanner_label = map_chr(spanner_label, as.character)
),
data.frame(
stringsAsFactors = FALSE,
vars = c("stat_1, stat_3", "stat_1, stat_2, stat_3"),
spanner_label = c("**Testing**", "**Tumor Grade**"),
spanner_level = c(1L, 2L)
)
)
})

test_that("as_gt passes table footnotes & abbreviations correctly", {
Expand Down

0 comments on commit 1ef07a9

Please sign in to comment.