Skip to content

Commit

Permalink
Merge branch 'main' into tm_front_page@712_setup-shinytest2@main
Browse files Browse the repository at this point in the history
  • Loading branch information
averissimo authored Apr 17, 2024
2 parents 1658403 + a1af9a5 commit e850aec
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:
python: python3
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.1
rev: v0.4.2
hooks:
- id: style-files
name: Style code with `styler`
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.modules.general
Title: General Modules for 'teal' Applications
Version: 0.3.0.9007
Date: 2024-04-10
Version: 0.3.0.9008
Date: 2024-04-17
Authors@R: c(
person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")),
person("Pawel", "Rucki", , "pawel.rucki@roche.com", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.modules.general 0.3.0.9007
# teal.modules.general 0.3.0.9008

# teal.modules.general 0.3.0

Expand Down
27 changes: 25 additions & 2 deletions tests/testthat/helper-TealAppDriver.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Import non-exported TealAppDriver from `teal` package
TealAppDriver <- getFromNamespace("TealAppDriver", "teal") # nolint: object_name.
# Initialization function to create a new TealAppDriver object
#
# By manipulating the server function as below, we can hint {shinytest2} to load
# this package and its "Depends".
# Related to https://github.com/rstudio/shinytest2/issues/381
init_teal_app_driver <- function(...) {
testthat::with_mocked_bindings(
{
TealAppDriver <- getFromNamespace("TealAppDriver", "teal") # nolint: object_name.
TealAppDriver$new(...)
},
shinyApp = function(ui, server, ...) {
functionBody(server) <- bquote({
# Hint to shinytest2 that this package should be available (via {globals})
.hint_to_load_package <- add_facet_labels
.(functionBody(server))
})

shiny::shinyApp(ui, server, ...)
},
# The relevant shinyApp call in `TealAppDriver` is being called without prefix,
# hence why the package bindings that is changed is in {teal} and not {shiny}
.package = "teal"
)
}

# Helper function
simple_teal_data <- function() {
Expand Down

0 comments on commit e850aec

Please sign in to comment.