tests/testthat/test-hotwire-modifiers.R

test_that("set_data() works", {

  tag <- set_data(tags$a(), hello = "1")
  expect_equal(tag_get_attribute(tag, "data-hello"), "1")
  tag <- set_data(tag, hello = "2")
  expect_equal(tag_get_attribute(tag, "data-hello"), "2")

})

test_that("add_data() works", {

  tag <- add_data(tags$a(), hello = "1")
  expect_equal(tag_get_attribute(tag, "data-hello"), "1")
  tag <- add_data(tag, hello = "2")
  expect_equal(tag_get_attribute(tag, "data-hello"), "1 2")

})
tjpalanca/hotwire.R documentation built on Dec. 23, 2021, 10:59 a.m.