tests/testthat/test-aaa-deps.R

# ===========================================================================
# Tests for use_a11y() and with_a11y_deps()
# ===========================================================================

test_that("use_a11y returns an htmlDependency object", {
  dep <- a11yShiny:::use_a11y()
  expect_s3_class(dep, "html_dependency")
  expect_equal(dep$name, "a11yShiny")
})

test_that("use_a11y dependency includes CSS and JS", {
  dep <- a11yShiny:::use_a11y()
  expect_true(any(grepl("a11yShiny\\.css", dep$stylesheet)))
  expect_true(any(grepl("a11yShiny\\.js", dep$script)))
})

test_that("with_a11y_deps attaches dependency to a tag", {
  tag <- htmltools::tags$div("test")
  result <- a11yShiny:::with_a11y_deps(tag)
  deps <- htmltools::htmlDependencies(result)
  expect_true(length(deps) > 0)
  dep_names <- vapply(deps, function(d) d$name, character(1))
  expect_true("a11yShiny" %in% dep_names)
})

Try the a11yShiny package in your browser

Any scripts or data that you put into this service are public.

a11yShiny documentation built on April 1, 2026, 5:07 p.m.