test_that("wa_include defaults render the minimal wrapper", {
expect_exact_html(
render_html(shiny.webawesome:::wa_include()),
c("")
)
})
test_that("wa_include override render includes attrs", {
expect_exact_html(
render_html(
shiny.webawesome:::wa_include(
id = "include",
allow_scripts = TRUE,
dir = "rtl",
lang = "en",
mode = "same-origin",
src = "panel.html"
)
),
c(
paste0(
''
)
)
)
})
test_that("wa_include allow_scripts validates and renders correctly", {
default_html <- render_html(shiny.webawesome:::wa_include())
expect_exact_html(
render_html(shiny.webawesome:::wa_include(allow_scripts = TRUE)),
c("")
)
expect_equal(
render_html(shiny.webawesome:::wa_include(allow_scripts = FALSE)),
default_html
)
expect_equal(
render_html(shiny.webawesome:::wa_include(allow_scripts = NULL)),
default_html
)
expect_error(
shiny.webawesome:::wa_include(allow_scripts = "yes"),
"`allow_scripts` must be TRUE, FALSE, or NULL.",
fixed = TRUE
)
})
test_that("wa_include mode enum validates exactly", {
expect_exact_html(
render_html(shiny.webawesome:::wa_include(mode = "no-cors")),
c('')
)
expect_error(
shiny.webawesome:::wa_include(mode = "private"),
"`mode` must be one of ",
fixed = TRUE
)
})