tests/testthat/test-hover_reload_button.R

test_that("hover_reload_button has expected structure", {

  # Create testing input
  test_me <- hover_reload_button("id", "label")

  # Test 1: attribs type is a button
  expect_equal(
    ## actual
    test_me$attribs$type,
    ## expect
    "button"
  )

  # Test 2: names on attribs list contains onClick
  expect_true(any("onClick" %in% names(test_me$attribs)))

  # Test 3: Look for javascript command
  expect_equal(
    ## actual
    test_me$attribs$onClick,
    ## expect
    "location.reload();"
  )
})

Try the hover package in your browser

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

hover documentation built on March 21, 2021, 1:06 a.m.