Skip to content

Commit a503250

Browse files
averissimovedhav
andauthored
Fixes data reactivity in tm_missing_data (#773)
# Pull Request <!--- Replace `#nnn` with your issue link for reference. --> Fixes #772 #### Changes description - Convert `data` -> `data()` - Use `datanames()` instead of `names()` --------- Co-authored-by: vedhav <[email protected]>
1 parent 74b71af commit a503250

13 files changed

+22
-19
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Depends:
2727
ggplot2 (>= 3.4.0),
2828
R (>= 3.6),
2929
shiny (>= 1.6.0),
30-
teal (>= 0.15.1),
30+
teal (>= 0.15.2.9052),
3131
teal.transform (>= 0.5.0)
3232
Imports:
3333
checkmate (>= 2.1.0),

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@
55
### Enhancements
66
* Added `teal.logger` functionality for logging changes in shiny inputs in all modules.
77

8+
### Bug fixes
9+
* Fixed a bug in `tm_missing_data` in "Group by Subject" that was not using reactive data call.
10+
811
# teal.modules.general 0.3.0
912

1013
### Enhancements
11-
* 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
14+
* 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.
1215

1316
### Bug fixes
1417
* Outlier labels no longer appear out of bounds in `tm_a_regression`.

R/tm_missing_data.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par
464464

465465

466466
data_parent_keys <- reactive({
467-
if (length(parent_dataname) > 0 && parent_dataname %in% names(data)) {
468-
keys <- teal.data::join_keys(data)[[dataname]]
467+
if (length(parent_dataname) > 0 && parent_dataname %in% teal.data::datanames(data())) {
468+
keys <- teal.data::join_keys(data())[[dataname]]
469469
if (parent_dataname %in% names(keys)) {
470470
keys[[parent_dataname]]
471471
} else {

tests/testthat/test-shinytest2-tm_a_regression.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ testthat::test_that("e2e - tm_a_regression: Data parameter and module label is p
5353
app_driver$expect_no_shiny_error()
5454

5555
testthat::expect_equal(
56-
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
56+
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
5757
"Regression"
5858
)
5959

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

6363
app_driver$stop()

tests/testthat/test-shinytest2-tm_data_table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ test_that("e2e - tm_data_table: Initializes without errors", {
2727
app_driver$expect_no_shiny_error()
2828

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

tests/testthat/test-shinytest2-tm_file_viewer.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_that("e2e - tm_file_viewer: Initializes without errors and shows files tree
3434
)
3535

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

tests/testthat/test-shinytest2-tm_front_page.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ test_that("e2e - tm_front_page: Initializes without errors and check html elemen
2828
app_driver$expect_no_shiny_error()
2929

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

tests/testthat/test-shinytest2-tm_g_association.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ testthat::test_that("e2e - tm_g_association: Data parameter and module label is
5252
app_driver$expect_no_shiny_error()
5353

5454
testthat::expect_equal(
55-
app_driver$get_text("#teal-main_ui-root-active_tab > li.active > a"),
55+
app_driver$get_text("#teal-teal_modules-active_tab > li.active > a"),
5656
"Association"
5757
)
5858

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

6262
app_driver$stop()

tests/testthat/test-shinytest2-tm_g_scatterplotmatrix.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ test_that("e2e - tm_g_scatterplotmatrix: Initializes without errors", {
5151
app_driver$expect_no_shiny_error()
5252

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

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

6161
app_driver$stop()

tests/testthat/test-shinytest2-tm_misssing_data.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test_that("e2e - tm_missing_data: Initializes without errors", {
4242
app_driver$expect_no_shiny_error()
4343

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

0 commit comments

Comments
 (0)