tests/testthat/test-updateAwesomeRadio.R

context("updateAwesomeRadio")


test_that("Send message", {

  session <- as.environment(list(
    ns = identity,
    sendInputMessage = function(inputId, message) {
      session$lastInputMessage = list(id = inputId, message = message)
    }
  ))

  updateAwesomeRadio(session = session, inputId = "idarsw", choices = c("A", "B", "C"))
  resultAR <- session$lastInputMessage

  expect_equal("A", resultAR$message$value)
  expect_true(grepl('"idarsw"', resultAR$message$options))

})
dreamRs/shinyWidgets documentation built on June 5, 2019, 4:07 a.m.