tests/testthat/test-turbo-modifiers.R

test_that("turbo modifiers work", {

  expect_equal(
    tag_get_attribute(turbo_enable(tags$div()), "data-turbo"),
    "true"
  )
  expect_equal(
    tag_get_attribute(turbo_disable(tags$div()), "data-turbo"),
    "false"
  )
  expect_equal(
    tag_get_attribute(turbo_target(tags$div(), "hello"), "data-turbo-frame"),
    "hello"
  )
  expect_equal(
    tag_get_attribute(turbo_noeval(tags$script()), "data-turbo-eval"),
    "false"
  )
  expect_true(
    tag_has_attribute(turbo_permanent(tags$div(id = "a")),
                      "data-turbo-permanent")
  )

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