test_that("hover_action_button accepts class arguments", {
make_button <- function(class) {
if (missing(class)) {
hover_action_button("id", "label")
} else {
hover_action_button("id", "label", class = class)
}
}
act <- make_button()
get_class <- function(act) {
act_html <- format(act)
regmatches(act_html, regexec("class=\"[^\"]\"", act_html))[[1]]
}
act_class <- get_class(act)
expect_equal(
get_class(make_button(NULL)), act_class
)
expect_equal(
get_class(make_button(NA)), act_class
)
expect_equal(
get_class(make_button("extra")), sub("\"$", " extra\"", act_class)
)
expect_equal(
get_class(make_button("extra extra2")), sub("\"$", " extra extra2\"", act_class)
)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.