mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-29 03:00:45 -04:00
* Improve makeMask comment * Added skeleton function and example * Refinements to app template * Template update * Rename tests/shinytests/ to tests/shinytest/ * App template updates * mask creation: clean up, document, and align with rlang::new_data_mask() * Revert minor in mock session * Document/fix mock session $setEnv() and $setReturned() behavior * document * simplify buildMask() * minor * simplify buildMask() * simplify buildMask() * add 12_counter test app to exercise runTests + testServer * Add appobj test * WIP loadSuppor for apps passed to testServer * Revert "WIP loadSuppor for apps passed to testServer" This reverts commit2d519aca15. * Found and fixed app obj lifecycle methods that testServer was not exercising when applicable * Rename 12_counter to 12_template * Rename utils.R to sort.R * Updates from code review * Move 12_template to app_template dir * Add informative comments * Simplify mask building, default app to "." in testServer() * testServer(): Error when arguments provided to a server function * Fix tests; don't default autoload to FALSE if not found * Use withr::with_options in one particularly confusing shiny.autoload.r-related test * testServer(): if app is a path, and not an app, walk up dirs until an app is found * Fix tests on Windows - rprojroot uses winslash='/' * testServer(): raise findEnclosingApp() call * Add library(shiny) to top of test app * document * Use require(shiny) in testServer() it works without library(shiny) * Revert "testServer(): raise findEnclosingApp() call" This reverts commit5801dee2a4. * document * loadSupport(): appDir now defaults to . and findEnclosingApp() occurs * loadSupport() and testServer(): default app/appDir to NULL * Remove sketchy test involving detach() * Move findEnclosingApp() to utils.R * Dropped rprojroot dep and moved findEnclosingApp() to utils * Better error message * findEnclosingApp(): Fix case when root is an app Co-authored-by: trestletech <jeff.allen@trestletechnology.net> Co-authored-by: Winston Chang <winston@stdout.org>
33 lines
801 B
R
33 lines
801 B
R
library(shiny)
|
|
|
|
ui <- fluidPage(
|
|
# ======== Modules ========
|
|
# mymoduleUI is defined in R/my-module.R
|
|
mymoduleUI("mymodule1", "Click counter #1"),
|
|
mymoduleUI("mymodule2", "Click counter #2"),
|
|
# =========================
|
|
wellPanel(
|
|
sliderInput("size", "Data size", min = 5, max = 20, value = 10),
|
|
div("Lexically sorted sequence:"),
|
|
verbatimTextOutput("sequence")
|
|
)
|
|
)
|
|
|
|
server <- function(input, output, session) {
|
|
# ======== Modules ========
|
|
# mymoduleServer is defined in R/my-module.R
|
|
mymoduleServer("mymodule1")
|
|
mymoduleServer("mymodule2")
|
|
# =========================
|
|
|
|
data <- reactive({
|
|
# lexical_sort from R/utils.R
|
|
lexical_sort(seq_len(input$size))
|
|
})
|
|
output$sequence <- renderText({
|
|
paste(data(), collapse = " ")
|
|
})
|
|
}
|
|
|
|
shinyApp(ui, server)
|