Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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 @@ -84,7 +84,7 @@ VignetteBuilder:
knitr,
rmarkdown
Remotes:
insightsengineering/teal,
insightsengineering/teal@TealAppDriver_changes,
insightsengineering/teal.reporter
Config/Needs/verdepcheck: haleyjeppson/ggmosaic, tidyverse/ggplot2,
rstudio/shiny, insightsengineering/teal,
Expand Down
8 changes: 2 additions & 6 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,8 @@ srv_g_bivariate <- function(id,
teal.reporter::teal_card("## Module's output(s)")
)
obj %>%
teal.code::eval_code(
c(
'library("ggplot2");library("dplyr")', # nolint: quotes
as.expression(anl_merged_input()$expr)
)
)
teal.code::eval_code('library("ggplot2");library("dplyr")') %>%
teal.code::eval_code(as.expression(anl_merged_input()$expr)) # don't mix char with expr in single eval_code
})

merged <- list(
Expand Down
16 changes: 9 additions & 7 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@
#' })
#' join_keys(data) <- default_cdisc_join_keys[names(data)]
#'
#' vars1 <- choices_selected(
#' variable_choices(data[["ADSL"]], c("ARM", "COUNTRY", "SEX")),
#' selected = NULL
#' )
#'
#' app <- init(
#' data = data,
Expand All @@ -108,7 +104,7 @@
#' dist_var = data_extract_spec(
#' dataname = "ADSL",
#' select = select_spec(
#' choices = variable_choices(data[["ADSL"]], c("AGE", "BMRKR1")),
#' choices = variable_choices("ADSL", c("AGE", "BMRKR1")),
#' selected = "BMRKR1",
#' multiple = FALSE,
#' fixed = FALSE
Expand All @@ -117,14 +113,20 @@
#' strata_var = data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(
#' vars = vars1,
#' vars = choices_selected(
#' variable_choices("ADSL", c("ARM", "COUNTRY", "SEX")),
#' selected = NULL
#' ),
#' multiple = TRUE
#' )
#' ),
#' group_var = data_extract_spec(
#' dataname = "ADSL",
#' filter = filter_spec(
#' vars = vars1,
#' vars = choices_selected(
#' variable_choices("ADSL", c("ARM", "COUNTRY", "SEX")),
#' selected = "ARM"
#' ),
#' multiple = TRUE
#' )
#' )
Expand Down
20 changes: 11 additions & 9 deletions man/tm_g_distribution.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/testthat/test-examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ for (i in rd_files()) {
paste0("example-", basename(i)),
{
testthat::skip_on_cran()
testthat::skip("chromium")
if (grepl("tm_g_distribution", basename(i))) {
testthat::skip("distribution initializes with short validation error")
}
skip_if_too_deep(5)
testthat::skip_if_not_installed("pkgload")
# Allow for specific validation errors for individual examples
Expand Down
80 changes: 36 additions & 44 deletions tests/testthat/test-shinytest2-tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,33 @@ app_driver_tm_a_pca <- function() {
})

init_teal_app_driver(
data = data,
modules = tm_a_pca(
dat = teal.transform::data_extract_spec(
dataname = "USArrests",
select = teal.transform::select_spec(
choices = teal.transform::variable_choices(
data = data[["USArrests"]],
c("Murder", "Assault", "UrbanPop", "Rape")
),
selected = c("Murder", "Assault"),
multiple = TRUE
)
),
size = c(3, 1, 5),
alpha = c(.5, 0, 1),
font_size = c(10, 8, 15),
ggtheme = "light",
rotate_xaxis_labels = TRUE,
pre_output = shiny::tags$div(id = "unique_id_pre", "A pre output"),
post_output = shiny::tags$div(id = "unique_id_post", "A post output")
teal::init(
data = data,
modules = tm_a_pca(
dat = teal.transform::data_extract_spec(
dataname = "USArrests",
select = teal.transform::select_spec(
choices = teal.transform::variable_choices(
data = data[["USArrests"]],
c("Murder", "Assault", "UrbanPop", "Rape")
),
selected = c("Murder", "Assault"),
multiple = TRUE
)
),
size = c(3, 1, 5),
alpha = c(.5, 0, 1),
font_size = c(10, 8, 15),
ggtheme = "light",
rotate_xaxis_labels = TRUE,
pre_output = shiny::tags$div(id = "unique_id_pre", "A pre output"),
post_output = shiny::tags$div(id = "unique_id_post", "A post output")
)
)
)
}

testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified defaults in function call.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -44,9 +45,14 @@ testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified de
c("Murder", "Assault")
)

module_parent_id <- gsub("-module$", "", app_driver$active_module_ns())
testthat::expect_equal(app_driver$get_text(sprintf("#%s %s", module_parent_id, "#unique_id_pre")), "A pre output")
testthat::expect_equal(app_driver$get_text(sprintf("#%s %s", module_parent_id, "#unique_id_post")), "A post output")
testthat::expect_equal(
app_driver$get_text("#unique_id_pre"),
"A pre output"
)
testthat::expect_equal(
app_driver$get_text("#unique_id_post"),
"A post output"
)

# Plot options that can be changed in call
testthat::expect_true(app_driver$get_active_module_input("rotate_xaxis_labels"))
Expand All @@ -57,7 +63,6 @@ testthat::test_that("e2e - tm_a_pca: Module is initialised with the specified de
})

testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/Assault on header.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -75,7 +80,6 @@ testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract
})

testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract selection Murder/UrbanPop on header.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -93,7 +97,6 @@ testthat::test_that("e2e - tm_a_pca: Eigenvector table should have data extract
})

testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be from non-selected variable set.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -111,7 +114,6 @@ testthat::test_that("e2e - tm_a_pca: Color by columns (data_extract) must be fro
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display does not generate errors.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -133,7 +135,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of tables_display
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' does not generate errors.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -157,7 +158,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings for 'plot type' d
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardization' does not generate errors.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -176,7 +176,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'standardizati
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' does not generate errors.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -191,31 +190,26 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'NA action' do
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hides and shows options.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
app_driver$expect_no_validation_error()

# Selected plot's specific settings is not visible
no_plot_settings_selector <- sprintf("#%s-%s %s", app_driver$active_module_ns(), "plot_settings", "span.help-block")
x_axis_selector <- sprintf("#%s-%s", app_driver$active_module_ns(), "x_axis")
color_by_selector <- sprintf(
"#%s-%s",
app_driver$active_module_ns(),
"response-dataset_USArrests_singleextract-select_input"
)
no_plot_settings_selector <- app_driver$namespaces(TRUE)$module("plot_settings span.help-block")
x_axis_selector <- app_driver$namespaces(TRUE)$module("x_axis")
color_by_selector <- app_driver$namespaces(TRUE)$module("response-dataset_USArrests_singleextract-select_input")

app_driver$set_active_module_input("plot_type", "Elbow plot", wait = FALSE)
app_driver$set_active_module_input("plot_type", "Elbow plot", wait_ = FALSE)
testthat::expect_true(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_false(app_driver$is_visible(x_axis_selector))
testthat::expect_false(app_driver$is_visible(color_by_selector))

app_driver$set_active_module_input("plot_type", "Circle plot", wait = FALSE)
app_driver$set_active_module_input("plot_type", "Circle plot", wait_ = FALSE)
testthat::expect_false(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_true(app_driver$is_visible(x_axis_selector))

app_driver$set_active_module_input("plot_type", "Biplot", wait = FALSE)
app_driver$set_active_module_input("plot_type", "Biplot", wait_ = FALSE)
testthat::expect_false(app_driver$is_visible(no_plot_settings_selector))
testthat::expect_true(app_driver$is_visible(x_axis_selector))
testthat::expect_true(app_driver$is_visible(color_by_selector))
Expand All @@ -224,7 +218,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'plot_type' hi
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does not generate errors.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand All @@ -243,7 +236,6 @@ testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'theme' does n
})

testthat::test_that("e2e - tm_a_pca: Changing output encodings of 'font size' does not generate errors.", {
testthat::skip("chromium")
skip_if_too_deep(5)

app_driver <- app_driver_tm_a_pca()
Expand Down
Loading
Loading