context("checkbox")
test_that("test checkbox_input input values", {
# type
expect_is(checkbox_input("check"), "shiny.tag")
# empty input
si_str <- as.character(checkbox_input("check"))
expect_true(any(grepl("
\n My Label",
si_str, fixed = TRUE)))
# is_marked
si_str <- as.character(checkbox_input("check", is_marked = FALSE))
expect_false(any(grepl("ui checked checkbox",
si_str, fixed = TRUE)))
})
test_that("test toggle alias for checkbox_input", {
si_str1 <- as.character(checkbox_input("check", "My Label",
type = "toggle", is_marked = FALSE))
si_str2 <- as.character(toggle("check", "My Label", is_marked = FALSE))
expect_equal(si_str1, si_str2)
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%"))
})