Nothing
context("hidden")
getClasses <- function(tag) {
unlist(strsplit(htmltools::tagGetAttribute(tag, "class"), " "))
}
clsName <- "shinyjs-hide"
test_that("hidden fails on plain text", {
expect_error(("abc"), "Invalid shiny tag")
})
test_that("hidden works on simple div", {
tag <- (shiny::div("abc"))
expect_true(clsName %in% getClasses(tag))
})
test_that("hidden works on complex div", {
tag <- (shiny::div(shiny::span("abc")))
expect_true(clsName %in% getClasses(tag))
})
test_that("hidden works when div already contains a class", {
tag <- (shiny::div("abc", class = "test"))
expect_true(clsName %in% getClasses(tag))
})
test_that("hidden errors when one of multiple tags is not a tag", {
expect_error((shiny::p("abc"), "abc"), "Invalid shiny tag")
expect_error((list(shiny::p("abc"), "abc")), "Invalid shiny tag")
expect_error((shiny::tagList(shiny::p("abc"), "abc")), "Invalid shiny tag")
})
test_that("hidden works when given multiple tags", {
res <- (shiny::p("abc"), shiny::span("abc"))
expect_equal(length(res), 2)
expect_true(clsName %in% getClasses(res[[1]]))
expect_true(clsName %in% getClasses(res[[2]]))
})
test_that("hidden works when given list", {
res <- (list(shiny::p("abc"), shiny::span("abc")))
expect_equal(length(res), 2)
expect_true(clsName %in% getClasses(res[[1]]))
expect_true(clsName %in% getClasses(res[[2]]))
})
test_that("hidden works when given tagList", {
res <- (shiny::tagList(shiny::p("abc"), shiny::span("abc")))
expect_equal(length(res), 2)
expect_true(clsName %in% getClasses(res[[1]]))
expect_true(clsName %in% getClasses(res[[2]]))
})
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.