tests/testthat/test-dropdownTabMenu.R

test_that("dropdownTabMenu creates the correct dropdown menu", {
  # Run the function
  test_obj <- dropdownTabMenu(type = "messages", title = "My Messages", header = "Header")

  # Check the class of the output
  expect_s3_class(test_obj, "shiny.tag")

  # Check the name of the tag
  expect_equal(test_obj$name, "li")

  # Check that the dropdown type is "messages"
  dropdown_class <- paste0("dropdown ", "messages", "-menu")
  expect_equal(test_obj$attribs$class, dropdown_class)

  # Check the header of the dropdown menu
  expect_equal(test_obj$children[[2]]$children[[1]]$children[[1]], "Header")
})

Try the vvshiny package in your browser

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

vvshiny documentation built on July 26, 2023, 5:50 p.m.