tests/testthat/helper-shiny-tag.R

is_shiny_tag <- function(x) {
  inherits_any(x, "shiny.tag")
}

expect_shiny_tag <- function(object) {
  # 1. Capture object and label
  act <- quasi_label(rlang::enquo(object), arg = "object")

  # 2. Call expect()
  found <- class(act$val)[1]

  expect(
    is_shiny_tag(act$val),
    sprintf('%s is %s, not shiny tag.', act$lab, found)
  )

  # 3. Invisibly return the value
  invisible(act$val)
}

Try the cascadess package in your browser

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

cascadess documentation built on Oct. 30, 2024, 9:29 a.m.