diff --git a/R/bundle_resources.R b/R/bundle_resources.R index 8756d708..fbf01223 100644 --- a/R/bundle_resources.R +++ b/R/bundle_resources.R @@ -14,6 +14,7 @@ #' Turn to NULL if you don't want this meta tag to be included. #' @inheritParams htmltools::htmlDependency #' @param with_sparkles C'est quand que tu vas mettre des paillettes dans ma vie Kevin? +#' @param activate_js Boolean to enable or disable the injection of JavaScript via activate_js(). #' #' @importFrom htmltools htmlDependency #' @export @@ -30,7 +31,8 @@ bundle_resources <- function( package = NULL, all_files = TRUE, app_builder = "golem", - with_sparkles = FALSE + with_sparkles = FALSE, + activate_js = TRUE ) { res <- list() if ( @@ -54,9 +56,13 @@ bundle_resources <- function( as.character( tags$title(app_title) ), - as.character( - golem::activate_js() - ), + { + if (activate_js){ + as.character( + golem::activate_js() + ) + } + }, head ), attachment = attachment, diff --git a/man/bundle_resources.Rd b/man/bundle_resources.Rd index 881213d9..049ce98d 100644 --- a/man/bundle_resources.Rd +++ b/man/bundle_resources.Rd @@ -15,7 +15,8 @@ bundle_resources( package = NULL, all_files = TRUE, app_builder = "golem", - with_sparkles = FALSE + with_sparkles = FALSE, + activate_js = TRUE ) } \arguments{ @@ -47,6 +48,8 @@ dependency files.} Turn to NULL if you don't want this meta tag to be included.} \item{with_sparkles}{C'est quand que tu vas mettre des paillettes dans ma vie Kevin?} + +\item{activate_js}{Boolean to enable or disable the injection of JavaScript via activate_js().} } \value{ an htmlDependency diff --git a/tests/testthat/test-install_dev_deps.R b/tests/testthat/test-install_dev_deps.R index 81d30b0e..796da646 100644 --- a/tests/testthat/test-install_dev_deps.R +++ b/tests/testthat/test-install_dev_deps.R @@ -1,35 +1,22 @@ +expect_installed <- function(pkg) { + expect( + rlang::is_installed(pkg), + failure_message = paste0( + "Package '", pkg, "' is not installed. Installed from ", + getOption("repos") + ) + ) +} + test_that("install_dev_deps works", { withr::with_temp_libpaths({ install_dev_deps( - force_install = TRUE, - repos = "https://cran.rstudio.com" - ) - - paks <- unique( - c( - "usethis", - "pkgload", - "dockerfiler", - "devtools", - "roxygen2", - "attachment", - "rstudioapi", - "here", - "fs", - "desc", - "pkgbuild", - "processx", - "rsconnect", - "testthat", - "rstudioapi" - ) + force_install = TRUE ) for ( - pak in paks + pak in dev_deps ) { - expect_true( - rlang::is_installed(pak) - ) + expect_installed(pak) } }) })