Skip to content

Commit

Permalink
use predictable dataKey
Browse files Browse the repository at this point in the history
  • Loading branch information
wangben718 committed Jan 14, 2025
1 parent 572f9e7 commit 75f40bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
library(reactable)
library(htmltools)

expect_and_replace_dataKey <- function(tbl, newDataKey = "__predictable_data_key__") {
dataKey <- tbl$x$tag$attribs$dataKey
expect_true(is.character(dataKey) && nchar(dataKey) > 0)
tbl$x$tag$attribs$dataKey <- newDataKey
tbl
}

test_that("Testing react_subgroup_table function via calling react_base_char function", {
# the "react_subgroup_table()" function is called inside the "react_base_char()" function
table_output <- react_base_char(
Expand All @@ -14,7 +21,7 @@ test_that("Testing react_subgroup_table function via calling react_base_char fun
ae_specific = "rel",
width = 1200
)

table_output <- expect_and_replace_dataKey(table_output)
rendered <- htmltools::renderTags(table_output)
expect_snapshot(cat(rendered$html))
})

0 comments on commit 75f40bf

Please sign in to comment.