From 7fc52819010d7316f650a08679ddd3425613b6b9 Mon Sep 17 00:00:00 2001 From: aniaskrzydlo Date: Tue, 19 Oct 2021 18:26:41 +0200 Subject: [PATCH 01/11] Updated modal example --- R/modal.R | 43 ++++++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/R/modal.R b/R/modal.R index c9a18f13..e73a96ef 100644 --- a/R/modal.R +++ b/R/modal.R @@ -96,6 +96,7 @@ #' }) #' shinyApp(ui, server) #' } +#' #' ## Changing attributes of header and content. #' if (interactive()) { #' library(shiny) @@ -123,24 +124,36 @@ #' } #' shinyApp(ui, server) #' } +#' +#' ## Modal that closes automatically after specific time #' if (interactive()) { #' library(shiny) #' library(shiny.semantic) -#' shinyApp( -#' ui = semanticPage( -#' actionButton("show", "Show modal dialog") -#' ), -#' server = function(input, output) { -#' observeEvent(input$show, { -#' showModal(modalDialog( +#' ui <- function() { +#' shinyUI( +#' semanticPage( +#' actionButton("show", "Show modal dialog") +#' ) +#' ) +#' } +#' +#' server <- shinyServer(function(input, output, session) { +#' observeEvent(input$show, { +#' create_modal( +#' modal( +#' id = "simple-modal", #' title = "Important message", -#' "This modal will close after 3 sec.", easyClose = FALSE -#' )) -#' Sys.sleep(3) -#' removeModal() -#' }) -#' } -#' ) +#' header = "Example modal", +#' content = "This modal will close after 3 sec.", +#' footer = NULL, +#' ) +#' ) +#' Sys.sleep(3) +#' hide_modal(id = "simple-modal") +#' }) +#' }) +#' +#' shinyApp(ui = ui(), server = server) #' } #' #' @rdname modal @@ -263,7 +276,7 @@ attach_rule <- function(id, behavior, target, value) { #' @param id ID of the modal that will be displayed. #' @param session The \code{session} object passed to function given to #' \code{shinyServer}. -#' @param asis A boolean indicating if the id must be handled as is (TRUE) or +#' @param asis A boolean indicating if the id must be handled as is (TRUE) or #' will be it must be namespaced (FALSE) #' @seealso modal #' From 6466e2a98914f100e2012ba1d34b93faed7eaa17 Mon Sep 17 00:00:00 2001 From: aniaskrzydlo Date: Tue, 19 Oct 2021 18:28:49 +0200 Subject: [PATCH 02/11] Updated documentation --- man/modal.Rd | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/man/modal.Rd b/man/modal.Rd index fcebbf6d..ab0fdef1 100644 --- a/man/modal.Rd +++ b/man/modal.Rd @@ -125,6 +125,7 @@ server <- shinyServer(function(input, output) { }) shinyApp(ui, server) } + ## Changing attributes of header and content. if (interactive()) { library(shiny) @@ -152,24 +153,36 @@ server = function(input, output) { } shinyApp(ui, server) } + +## Modal that closes automatically after specific time if (interactive()) { library(shiny) library(shiny.semantic) -shinyApp( - ui = semanticPage( - actionButton("show", "Show modal dialog") - ), - server = function(input, output) { - observeEvent(input$show, { - showModal(modalDialog( +ui <- function() { + shinyUI( + semanticPage( + actionButton("show", "Show modal dialog") + ) + ) +} + +server <- shinyServer(function(input, output, session) { + observeEvent(input$show, { + create_modal( + modal( + id = "simple-modal", title = "Important message", - "This modal will close after 3 sec.", easyClose = FALSE - )) - Sys.sleep(3) - removeModal() - }) - } -) + header = "Example modal", + content = "This modal will close after 3 sec.", + footer = NULL, + ) + ) + Sys.sleep(3) + hide_modal(id = "simple-modal") + }) +}) + +shinyApp(ui = ui(), server = server) } } From 6c86116802cf2bfe8e3ebfdb857b53a92a2a6c02 Mon Sep 17 00:00:00 2001 From: aniaskrzydlo Date: Tue, 19 Oct 2021 18:30:35 +0200 Subject: [PATCH 03/11] Added standalone example --- examples/modal/app_6.R | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 examples/modal/app_6.R diff --git a/examples/modal/app_6.R b/examples/modal/app_6.R new file mode 100644 index 00000000..bde04d4d --- /dev/null +++ b/examples/modal/app_6.R @@ -0,0 +1,28 @@ +library(shiny) +library(shiny.semantic) + +ui <- function() { + shinyUI( + semanticPage( + actionButton("show", "Show modal dialog") + ) + ) +} + +server <- shinyServer(function(input, output, session) { + observeEvent(input$show, { + create_modal( + modal( + id = "simple-modal", + title = "Important message", + header = "Example modal", + content = "This modal will close after 3 sec.", + footer = NULL, + ) + ) + Sys.sleep(3) + hide_modal(id = "simple-modal") + }) +}) + +shinyApp(ui = ui(), server = server) From 8f3e6d2349429a1400d6a01bd3a12797fc99195e Mon Sep 17 00:00:00 2001 From: Pawel Przytula Date: Sun, 31 Oct 2021 17:29:00 +0100 Subject: [PATCH 04/11] Changed dev@appsilon.com to support+opensource@appsilon.com --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fb4f349e..89eaabf0 100644 --- a/README.md +++ b/README.md @@ -245,11 +245,11 @@ install.packages("shiny", version='0.14.2.9001') - adding more semantic components - new version release on CRAN -## Appsilon Data Science +## Appsilon Appsilon is the **Full Service Certified RStudio Partner**. Learn more at [appsilon.com](https://appsilon.com). -Get in touch [dev@appsilon.com](dev@appsilon.com) +Get in touch [support+opensource@appsilon.com](support+opensource@appsilon.com) From fbec76bb2892c3e70f53359acb81f1d8c7cbf100 Mon Sep 17 00:00:00 2001 From: Pawel Przytula Date: Sun, 31 Oct 2021 17:30:54 +0100 Subject: [PATCH 05/11] Description updated --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 64f4c42a..a32cfb46 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ Authors@R: c(person("Filip", "Stachura", email = "filip@appsilon.com", role = "a person("Paweł", "Przytuła", email = "pawel@appsilon.com", role = "ctb"), person("Kamil", "Żyła", email = "kamil@appsilon.com", role = "ctb"), person("Rabii", "Bouhestine", email = "rabii@appsilon.com", role = "ctb"), - person("Developers", "Appsilon", email = "dev+shinysemantic@appsilon.com", role = "cre"), + person("Developers", "Appsilon", email = "support+opensource@appsilon.com", role = "cre"), person(family = "Appsilon Sp. z o.o.", role = c("cph"))) Description: Creating a great user interface for your Shiny apps can be a hassle, especially if you want to work purely in R From 6c6e62bd86276fa3b0a5cefa703093426911add3 Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Fri, 5 Nov 2021 10:04:38 +0100 Subject: [PATCH 06/11] Updated documentation for CRAN submission --- DESCRIPTION | 2 +- R/checkbox.R | 2 +- R/step.R | 11 ++++- man/show_modal.Rd | 9 ++-- man/single_step.Rd | 34 +++++++++++++++ man/steps.Rd | 66 +++++++++++++++++++++++++++- man/textAreaInput.Rd | 2 +- man/toggle_step_state.Rd | 24 +++++++++++ man/update_multiple_checkbox.Rd | 76 +++++++++++++++++++++++++++++++++ man/update_numeric_input.Rd | 2 +- 10 files changed, 218 insertions(+), 10 deletions(-) create mode 100644 man/single_step.Rd create mode 100644 man/toggle_step_state.Rd create mode 100644 man/update_multiple_checkbox.Rd diff --git a/DESCRIPTION b/DESCRIPTION index a32cfb46..40d4fa4b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -52,4 +52,4 @@ Suggests: plotly, rmarkdown, markdown -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 diff --git a/R/checkbox.R b/R/checkbox.R index 1e5f6280..fce96aaf 100644 --- a/R/checkbox.R +++ b/R/checkbox.R @@ -156,7 +156,7 @@ multiple_checkbox <- function(input_id, label, choices, choices_value = choices, #' @param input_id The id of the input object #' @param choices All available options one can select from. If no need to update then leave as \code{NULL} #' @param choices_value What reactive value should be used for corresponding choice. -#' @param value The initially selected value. +#' @param selected The initially selected value. #' @param label The label linked to the input #' #' @examples diff --git a/R/step.R b/R/step.R index 82b855c6..ea5b9ae4 100644 --- a/R/step.R +++ b/R/step.R @@ -116,7 +116,16 @@ single_step <- function(id, title, description = NULL, icon_class = NULL, ) } - +#' Toggle step state +#' +#' @param id ID of step to be toggled +#' @param state State of the step, \code{TRUE} stands for enabled +#' @param automatic_steps Whether to toggle focus of next step automatically +#' @param asis When used inside of Shiny module, \code{TRUE} will disable adding +#' the namespace to \code{id} +#' +#' @seealso steps +#' #' @rdname toggle_step_state #' @export toggle_step_state <- function(id, state = TRUE, automatic_steps = TRUE, diff --git a/man/show_modal.Rd b/man/show_modal.Rd index e0961013..8bfa2cfa 100644 --- a/man/show_modal.Rd +++ b/man/show_modal.Rd @@ -8,21 +8,24 @@ \alias{hide_modal} \title{Show, Hide or Remove Semantic UI modal} \usage{ -show_modal(id, session = shiny::getDefaultReactiveDomain()) +show_modal(id, session = shiny::getDefaultReactiveDomain(), asis = TRUE) -remove_modal(id, session = shiny::getDefaultReactiveDomain()) +remove_modal(id, session = shiny::getDefaultReactiveDomain(), asis = TRUE) remove_all_modals(session = shiny::getDefaultReactiveDomain()) removeModal(session = shiny::getDefaultReactiveDomain()) -hide_modal(id, session = shiny::getDefaultReactiveDomain()) +hide_modal(id, session = shiny::getDefaultReactiveDomain(), asis = TRUE) } \arguments{ \item{id}{ID of the modal that will be displayed.} \item{session}{The \code{session} object passed to function given to \code{shinyServer}.} + +\item{asis}{A boolean indicating if the id must be handled as is (TRUE) or +will be it must be namespaced (FALSE)} } \description{ This displays a hidden Semantic UI modal. diff --git a/man/single_step.Rd b/man/single_step.Rd new file mode 100644 index 00000000..17741df3 --- /dev/null +++ b/man/single_step.Rd @@ -0,0 +1,34 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/step.R +\name{single_step} +\alias{single_step} +\title{Creates a single step to be used inside of a list of steps by the steps +function} +\usage{ +single_step( + id, + title, + description = NULL, + icon_class = NULL, + step_class = NULL +) +} +\arguments{ +\item{id}{The \code{input} slot that will be used to access the value.} + +\item{title}{A character that will be the title of the ste} + +\item{description}{A character that will fill the description of the step} + +\item{icon_class}{A character which will be correpond to a fomantic icon +class to be used in the step} + +\item{step_class}{A character representing a class to be passed to the step} +} +\description{ +Creates a single step to be used inside of a list of steps by the steps +function +} +\seealso{ +steps +} diff --git a/man/steps.Rd b/man/steps.Rd index f223ffcc..6dbe348c 100644 --- a/man/steps.Rd +++ b/man/steps.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/step.R \name{steps} \alias{steps} -\title{Show, Hide or Remove Semantic UI modal} +\title{Show steps} \usage{ steps(id, steps_list, class = NULL) } @@ -15,7 +15,69 @@ steps(id, steps_list, class = NULL) added to the steps element.} } \description{ -This displays a hidden Semantic UI modal. +Show steps +} +\examples{ +if (interactive()) { + library(shiny) + library(shiny.semantic) + ui <- semanticPage( + title = "Steps Example", + shiny::tagList( + h2("Steps example"), + shiny.semantic::steps( + id = "steps", + steps_list = list( + single_step( + id = "step_1", + title = "Step 1", + description = "It's night?", + icon_class = "moon" + ), + single_step( + id = "step_2", + title = "Step 2", + description = "Order some food", + icon_class = "bug" + ), + single_step(id = "step_3", + title = "Step 3", + description = "Feed the Kiwi", + icon_class = "kiwi bird" + ) + ) + ), + h3("Actions"), + shiny.semantic::action_button("step_1_complete", "Make it night"), + shiny.semantic::action_button("step_2_complete", "Call the insects"), + shiny.semantic::action_button("step_3_complete", "Feed the Kiwi"), + shiny.semantic::action_button("hungry_kiwi", "Kiwi is hungry again"), + ) +) + + server <- function(input, output, session) { + observeEvent(input$step_1_complete, { + toggle_step_state("step_1") + }) + + observeEvent(input$step_2_complete, { + toggle_step_state("step_2") + }) + + observeEvent(input$step_3_complete, { + toggle_step_state("step_3") + }) + + observeEvent(input$hungry_kiwi, { + toggle_step_state("step_1", FALSE) + toggle_step_state("step_2", FALSE) + toggle_step_state("step_3", FALSE) + }) + + } + + shiny::shinyApp(ui, server) +} } \seealso{ single_steps diff --git a/man/textAreaInput.Rd b/man/textAreaInput.Rd index 11c6691e..b835f469 100644 --- a/man/textAreaInput.Rd +++ b/man/textAreaInput.Rd @@ -24,7 +24,7 @@ Create a text area input control for entry of unstructured text values. ## Only run examples in interactive R sessions if (interactive()) { ui <- semanticPage( - textAreaInput("a", "Area:", width = "200px"), + textAreaInput("a", "Area:", value = "200", width = "200px"), verbatimTextOutput("value") ) server <- function(input, output, session) { diff --git a/man/toggle_step_state.Rd b/man/toggle_step_state.Rd new file mode 100644 index 00000000..3aab200c --- /dev/null +++ b/man/toggle_step_state.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/step.R +\name{toggle_step_state} +\alias{toggle_step_state} +\title{Toggle step state} +\usage{ +toggle_step_state(id, state = TRUE, automatic_steps = TRUE, asis = TRUE) +} +\arguments{ +\item{id}{ID of step to be toggled} + +\item{state}{State of the step, \code{TRUE} stands for enabled} + +\item{automatic_steps}{Whether to toggle focus of next step automatically} + +\item{asis}{When used inside of Shiny module, \code{TRUE} will disable adding +the namespace to \code{id}} +} +\description{ +Toggle step state +} +\seealso{ +steps +} diff --git a/man/update_multiple_checkbox.Rd b/man/update_multiple_checkbox.Rd new file mode 100644 index 00000000..f35f67a7 --- /dev/null +++ b/man/update_multiple_checkbox.Rd @@ -0,0 +1,76 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/checkbox.R +\name{update_multiple_checkbox} +\alias{update_multiple_checkbox} +\alias{update_multiple_radio} +\title{Update checkbox Semantic UI component} +\usage{ +update_multiple_checkbox( + session = getDefaultReactiveDomain(), + input_id, + choices = NULL, + choices_value = choices, + selected = NULL, + label = NULL +) + +update_multiple_radio( + session = getDefaultReactiveDomain(), + input_id, + choices = NULL, + choices_value = choices, + selected = NULL, + label = NULL +) +} +\arguments{ +\item{session}{The \code{session} object passed to function given to \code{shinyServer}.} + +\item{input_id}{The id of the input object} + +\item{choices}{All available options one can select from. If no need to update then leave as \code{NULL}} + +\item{choices_value}{What reactive value should be used for corresponding choice.} + +\item{selected}{The initially selected value.} + +\item{label}{The label linked to the input} +} +\description{ +Change the value of a \code{\link{multiple_checkbox}} input on the client. +} +\examples{ +if (interactive()) { + +library(shiny) +library(shiny.semantic) + +ui <- function() { + shinyUI( + semanticPage( + title = "Checkbox example", + form( + multiple_checkbox( + "simple_checkbox", "Letters:", LETTERS[1:5], selected = c("A", "C"), type = "slider" + ) + ), + p("Selected letter:"), + textOutput("selected_letter"), + shiny.semantic::actionButton("simple_button", "Update input to D") + ) + ) +} + +server <- shinyServer(function(input, output, session) { + output$selected_letter <- renderText(paste(input[["simple_checkbox"]], collapse = ", ")) + + observeEvent(input$simple_button, { + update_multiple_checkbox(session, "simple_checkbox", selected = "D") + }) +}) + +shinyApp(ui = ui(), server = server) + +} + +} diff --git a/man/update_numeric_input.Rd b/man/update_numeric_input.Rd index 1b2f4446..4e37fb64 100644 --- a/man/update_numeric_input.Rd +++ b/man/update_numeric_input.Rd @@ -16,7 +16,7 @@ update_numeric_input( ) updateNumericInput( - session, + session = getDefaultReactiveDomain(), inputId, label = NULL, value = NULL, From 801bf9388a698361f3bfa6930e84514fd86cb7a0 Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Fri, 5 Nov 2021 15:24:59 +0100 Subject: [PATCH 07/11] Adopt `warn_unsupported_args` to r-devel `intersect` implementation In r-devel `intersect` returns NULL if any of arguments are NULL in contrast to previous R versions in which `intersect` returned a vector of length 0 of a type same as given arguments --- R/utils.R | 2 ++ tests/testthat/test_utils.R | 1 + 2 files changed, 3 insertions(+) diff --git a/R/utils.R b/R/utils.R index 0a12ae3a..b7a1b423 100644 --- a/R/utils.R +++ b/R/utils.R @@ -73,6 +73,8 @@ warn_unsupported_args <- function(args) { to_wrn <- paste0(as.character(names(args)), collapse = ',') else if (class(args) == "character") to_wrn <- paste0(args, collapse = ',') + else if (is.null(args)) + return() else stop("Wrong input type!") if (nchar(to_wrn) >= 1) diff --git a/tests/testthat/test_utils.R b/tests/testthat/test_utils.R index 55f8c43b..aa30a4dd 100644 --- a/tests/testthat/test_utils.R +++ b/tests/testthat/test_utils.R @@ -14,6 +14,7 @@ test_that("test check_proper_color", { }) test_that("test warn_unsupported_args", { + expect_null(warn_unsupported_args(NULL)) expect_error(warn_unsupported_args(1), "Wrong input type!") expect_warning(warn_unsupported_args(c("a","b")), "arguments: `a,b` are not supported yet") expect_warning(warn_unsupported_args(list(a=1,b=2)), "arguments: `a,b` are not supported yet") From cb29808e1b879cbc0705c7146c993f6aaa64c74f Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Fri, 5 Nov 2021 15:28:08 +0100 Subject: [PATCH 08/11] Fix R CMD check notes - Updated links in DESCRIPTION and vignette - Removed vignettes from .Rbuildignore --- .Rbuildignore | 1 - DESCRIPTION | 2 +- vignettes/basics.Rmd | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.Rbuildignore b/.Rbuildignore index 50b376b4..4917606f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -21,4 +21,3 @@ ^CODE_OF_CONDUCT.md$ ^doc/* ^Meta$ -^vignettes$ diff --git a/DESCRIPTION b/DESCRIPTION index 40d4fa4b..06eec92b 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -22,7 +22,7 @@ Description: Creating a great user interface for your Shiny apps can be a hassle, especially if you want to work purely in R and don't want to use, for instance HTML templates. This package adds support for a powerful UI library Fomantic UI - - (before Semantic). It also supports + (before Semantic). It also supports universal UI input binding that works with various DOM elements. BugReports: https://github.com/Appsilon/shiny.semantic/issues Encoding: UTF-8 diff --git a/vignettes/basics.Rmd b/vignettes/basics.Rmd index 533b4eef..c5886d1c 100644 --- a/vignettes/basics.Rmd +++ b/vignettes/basics.Rmd @@ -37,7 +37,7 @@ UI framework that works under the hood. - **What `shiny.semantic` has to do with Fomantic UI?** Similarly to `Shiny` attaching *Bootstrap* CSS and JS libraries, `shiny.semantic` relies on -[Fomantic UI](fomantic-ui.com/). Historically, we built this package around *Semantic UI* +[Fomantic UI](https://fomantic-ui.com/). Historically, we built this package around *Semantic UI* library, but it got deprecated and now (since December 2019) we rely on the well-supported and maintained community fork called [Fomantic UI](fomantic-ui.com/). @@ -107,7 +107,7 @@ text_input("txt", type = "text", placeholder = "Enter Text") date_input("date") ``` -For more components visit our [Components live demo website](https://demo.appsilon.ai/semantic/) +For more components visit our [Components live demo website](https://demo.appsilon.com/apps/semantic) or the `examples/` folder on our [repository](https://github.com/Appsilon/shiny.semantic/). Little sneak-peak of what you can get is listed on the graphics below. Most of the components From 2b08dc97cd8cced0fd2b7b5e0dd2c9a6179d879f Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Mon, 8 Nov 2021 10:21:30 +0100 Subject: [PATCH 09/11] Fix invalid URL note --- vignettes/basics.Rmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vignettes/basics.Rmd b/vignettes/basics.Rmd index c5886d1c..4d2dcd14 100644 --- a/vignettes/basics.Rmd +++ b/vignettes/basics.Rmd @@ -39,7 +39,7 @@ UI framework that works under the hood. Similarly to `Shiny` attaching *Bootstrap* CSS and JS libraries, `shiny.semantic` relies on [Fomantic UI](https://fomantic-ui.com/). Historically, we built this package around *Semantic UI* library, but it got deprecated and now (since December 2019) we rely on the well-supported -and maintained community fork called [Fomantic UI](fomantic-ui.com/). +and maintained community fork called [Fomantic UI](https://fomantic-ui.com/). - **Do I need to learn a new syntax to be able to use it?** @@ -70,7 +70,7 @@ You can use `shiny.semantic` in two ways: ### (a) Using Fomantic CSS classes If you know this and that about web development, you can create a number of components -by extending standard `Shiny` objects with class definitions from [Fomantic UI](fomantic-ui.com/) +by extending standard `Shiny` objects with class definitions from [Fomantic UI](https://fomantic-ui.com/) documentation. For example: ```{r echo=T, include = T, eval = FALSE, screenshot.force = FALSE} From b81d133c043b6dcafc02e312613b08fce1d2680d Mon Sep 17 00:00:00 2001 From: Jakub Sobolewski Date: Tue, 9 Nov 2021 10:22:21 +0100 Subject: [PATCH 10/11] Add R-devel and R-oldrel to CI --- .github/workflows/main.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 23da446f..be04eba0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,20 +12,23 @@ jobs: fail-fast: false matrix: config: - - { os: windows-latest, r: '3.6'} - - { os: macOS-latest, r: '3.6'} - - { os: ubuntu-18.04, r: '3.6', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: macOS-latest, r: 'release'} + - {os: windows-latest, r: 'release'} + - {os: ubuntu-18.04, r: 'devel', http-user-agent: 'release', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: 'release', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} + - {os: ubuntu-18.04, r: 'oldrel', cran: "https://demo.rstudiopm.com/all/__linux__/bionic/latest"} env: R_REMOTES_NO_ERRORS_FROM_WARNINGS: true CRAN: ${{ matrix.config.cran }} steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - uses: r-lib/actions/setup-r@master with: r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} - uses: r-lib/actions/setup-pandoc@master @@ -53,7 +56,7 @@ jobs: - name: Install vctrs if: runner.os == 'macos' run: Rscript -e "remotes::install_cran('Rcpp')" - + - name: Install dependencies run: Rscript -e "library(remotes)" -e "update(readRDS('depends.Rds'))" -e "remotes::install_cran('rcmdcheck')" @@ -68,6 +71,6 @@ jobs: path: check - name: Test coverage - if: matrix.config.os == 'macOS-latest' && matrix.config.r == '3.6' + if: matrix.config.os == 'ubuntu-18.04' && matrix.config.r == 'release' run: | Rscript -e 'covr::codecov(token = "${{secrets.CODECOV_TOKEN}}")' From 42fd2d9c4d03dac4e72630f1a686625148df433b Mon Sep 17 00:00:00 2001 From: Tymoteusz Makowski Date: Fri, 4 Mar 2022 19:28:50 +0100 Subject: [PATCH 11/11] fix: remove unnecessary warning Prior to this change checkboxInput() would throw an error with a default width value. This change makes the warning go off only if width argument is not NULL. --- R/checkbox.R | 3 ++- tests/testthat/test_checkbox.R | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/R/checkbox.R b/R/checkbox.R index fce96aaf..557ec561 100644 --- a/R/checkbox.R +++ b/R/checkbox.R @@ -55,7 +55,8 @@ checkbox_input <- function(input_id, label = "", type = NULL, is_marked = TRUE, #' @rdname checkbox #' @export checkboxInput <- function(inputId, label = "", value = FALSE, width = NULL){ - warn_unsupported_args(c("width")) + if (!is.null(width)) + warn_unsupported_args(c("width")) checkbox_input(inputId, label, is_marked = value) } diff --git a/tests/testthat/test_checkbox.R b/tests/testthat/test_checkbox.R index 4be24c74..5fab5097 100644 --- a/tests/testthat/test_checkbox.R +++ b/tests/testthat/test_checkbox.R @@ -24,3 +24,13 @@ test_that("test toggle alias for checkbox_input", { expect_true(any(grepl("toggle", si_str2, fixed = TRUE))) }) + +test_that("checkboxInput warns on unsupported arguments", { + expect_silent(checkboxInput("check")) + expect_silent(checkboxInput("check", NULL)) + expect_silent(checkboxInput("check", "My Label")) + expect_silent(checkboxInput("check", "My Label", TRUE)) + expect_silent(checkboxInput("check", "My Label", FALSE)) + expect_silent(checkboxInput("check", width = NULL)) + expect_warning(checkboxInput("check", width = "10%")) +})