-
Notifications
You must be signed in to change notification settings - Fork 137
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
As of Shiny 1.12.0, tests/testthat/test-golem_utils_ui.R fails because of tests on actionButton().
To Reproduce
library(shiny)
library(testthat)
b <- shiny::actionButton("go_filter", "go")
expect_equal(
as.character(b),
'<button id="go_filter" type="button" class="btn btn-default action-button">go</button>'
)
#> Error: Expected `as.character(b)` to equal "<button id=\"go_filter\" type=\"button\" class=\"btn btn-default action-button\">go</button>".
#> Differences:
#> 1/1 mismatches
#> x[1]: "<button id=\"go_filter\" type=\"button\" class=\"btn btn-default action-b
#> x[1]: utton\">\n <span class=\"action-label\">go</span>\n</button>"
#> y[1]: "<button id=\"go_filter\" type=\"button\" class=\"btn btn-default action-b
#> y[1]: utton\">go</button>"library(shiny)
library(testthat)
undisplay <- function(tag) {
# if not already hidden
if (
!is.null(tag$attribs$style) &&
!grepl("display:\\s+none", tag$attribs$style)
) {
tag$attribs$style <- paste(
"display: none;",
tag$attribs$style
)
} else {
tag$attribs$style <- "display: none;"
}
tag
}
b <- shiny::actionButton("go_filter", "go")
b_undisplay <- undisplay(b)
expect_equal(
as.character(b_undisplay),
'<button id="go_filter" type="button" class="btn btn-default action-button" style="display: none;">go</button>'
)
#> Error: Expected `as.character(b_undisplay)` to equal "<button id=\"go_filter\" type=\"button\" class=\"btn btn-default action-button\" style=\"display: none;\">go</button>".
#> Differences:
#> 1/1 mismatches
#> x[1]: "<button id=\"go_filter\" type=\"button\" class=\"btn btn-default action-b
#> x[1]: utton\" style=\"display: none;\">\n <span class=\"action-label\">go</span
#> x[1]: >\n</button>"
#> y[1]: "<button id=\"go_filter\" type=\"button\" class=\"btn btn-default action-b
#> y[1]: utton\" style=\"display: none;\">go</button>"Expected behavior
The tests should succeed.
session info
R version 4.5.2 (2025-10-31)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.3 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0 LAPACK version 3.12.0
locale:
[1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8 LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8
[6] LC_MESSAGES=C.UTF-8 LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Paris
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices datasets utils methods base
other attached packages:
[1] testthat_3.3.1 shiny_1.12.0
loaded via a namespace (and not attached):
[1] waldo_0.6.2 desc_1.4.3 digest_0.6.39 later_1.4.4 R6_2.6.1 httpuv_1.6.16
[7] fastmap_1.2.0 magrittr_2.0.4 htmltools_0.5.9 lifecycle_1.0.4 promises_1.5.0 cli_3.6.5
[13] xtable_1.8-4 renv_1.1.5 pkgload_1.4.1 compiler_4.5.2 rprojroot_2.1.1 rstudioapi_0.17.1
[19] tools_4.5.2 brio_1.1.5 mime_0.13 Rcpp_1.1.0 otel_0.2.0 rlang_1.1.6 Additional context
I opened the issue rstudio/shiny#4332, but it was before I read the latest version news and breaking changes.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working