diff --git a/tests/testthat/_snaps/independent-testing-react_subgroup_table.md b/tests/testthat/_snaps/independent-testing-react_subgroup_table.md index a631970..d13b4a6 100644 --- a/tests/testthat/_snaps/independent-testing-react_subgroup_table.md +++ b/tests/testthat/_snaps/independent-testing-react_subgroup_table.md @@ -4,5 +4,5 @@ cat(rendered$html) Output
- + diff --git a/tests/testthat/test-independent-testing-react_subgroup_table.R b/tests/testthat/test-independent-testing-react_subgroup_table.R index 8db137e..453bac6 100644 --- a/tests/testthat/test-independent-testing-react_subgroup_table.R +++ b/tests/testthat/test-independent-testing-react_subgroup_table.R @@ -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( @@ -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)) })