Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes data reactivity in tm_missing_data #773

Merged
merged 4 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Depends:
ggplot2 (>= 3.4.0),
R (>= 3.6),
shiny (>= 1.6.0),
teal (>= 0.15.1),
teal (>= 0.15.2.9052),
teal.transform (>= 0.5.0)
Imports:
checkmate (>= 2.1.0),
Expand Down
5 changes: 4 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
### Enhancements
* Added `teal.logger` functionality for logging changes in shiny inputs in all modules.

### Bug fixes
* Fixed a bug in `tm_missing_data` in "Group by Subject" that was not using reactive data call.

# teal.modules.general 0.3.0

### Enhancements
* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object
* Updated the package docs and vignettes with the new way of specifying data for `teal::init()`. The `data` argument will accept a `teal_data` object.

### Bug fixes
* Outlier labels no longer appear out of bounds in `tm_a_regression`.
Expand Down
4 changes: 2 additions & 2 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -464,8 +464,8 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par


data_parent_keys <- reactive({
if (length(parent_dataname) > 0 && parent_dataname %in% names(data)) {
keys <- teal.data::join_keys(data)[[dataname]]
if (length(parent_dataname) > 0 && parent_dataname %in% datanames(data())) {
averissimo marked this conversation as resolved.
Show resolved Hide resolved
keys <- teal.data::join_keys(data())[[dataname]]
if (parent_dataname %in% names(keys)) {
keys[[parent_dataname]]
} else {
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-shinytest2-tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ testthat::test_that("e2e - tm_a_regression: Data parameter and module label is p
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Regression"
)

encoding_dataset <- app_driver$get_text("#teal-main_ui-root-regression .help-block")
encoding_dataset <- app_driver$get_text("#teal-teal_modules-regression .help-block")
testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE)

app_driver$stop()
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-shinytest2-tm_data_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test_that("e2e - tm_data_table: Initializes without errors", {
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Data Table"
)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-shinytest2-tm_file_viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree
)

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"File Viewer Module"
)

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-shinytest2-tm_front_page.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ test_that("e2e - tm_front_page: Initializes without errors and check html elemen
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Front page"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-shinytest2-tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ testthat::test_that("e2e - tm_g_association: Data parameter and module label is
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Association"
)

encoding_dataset <- app_driver$get_text("#teal-main_ui-root-association .help-block")
encoding_dataset <- app_driver$get_text("#teal-teal_modules-association .help-block")
testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE)

app_driver$stop()
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ test_that("e2e - tm_g_scatterplotmatrix: Initializes without errors", {
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Scatterplot matrix"
)

encoding_dataset <- app_driver$get_text("#teal-main_ui-root-scatterplot_matrix .help-block")
encoding_dataset <- app_driver$get_text("#teal-teal_modules-scatterplot_matrix .help-block")
testthat::expect_match(encoding_dataset, "Datasets.*ADSL.*ADRS", all = FALSE)

app_driver$stop()
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-shinytest2-tm_misssing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ test_that("e2e - tm_missing_data: Initializes without errors", {
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Missing data"
)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-shinytest2-tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ testthat::test_that("e2e - tm_outliers: Data parameter and module label is passe
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Outliers Module"
)

encoding_dataset <- app_driver$get_text("#teal-main_ui-root-outliers_module .help-block")
encoding_dataset <- app_driver$get_text("#teal-teal_modules-outliers_module .help-block")
testthat::expect_match(encoding_dataset, "Dataset:[\n ]*CO2", all = FALSE)
testthat::expect_match(encoding_dataset, "Outlier data points", all = FALSE)

Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-shinytest2-tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ test_that("e2e - tm_t_crosstable: Initializes without errors", {
app_driver$expect_no_shiny_error()

testthat::expect_equal(
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
"Cross Table"
)

encoding_dataset <- app_driver$get_text("#teal-main_ui-root-cross_table .help-block")
encoding_dataset <- app_driver$get_text("#teal-teal_modules-cross_table .help-block")
testthat::expect_match(encoding_dataset, "Dataset:\\n *ADSL\\n", all = FALSE)

app_driver$stop()
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-shinytest2-tm_variable_browser.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ testthat::test_that("e2e - tm_variable_browser: content is displayed correctly."

# Test tab name
testthat::expect_equal(
trimws(app_driver$get_text("#teal-main_ui-root-active_tab > li.active")),
trimws(app_driver$get_text("#teal-teal_modules-active_tab > li.active")),
"Variable browser (e2e)"
)

Expand Down
Loading