context("CreateCustomTable")
xx <- structure(1:5, .Names = c("a", "b", "c", "d", "e"), statistic = "%")
x2 <- matrix(1:12, 4, 3, dimnames = list(letters[1:4], c("X", "Y", "Z")))
test_that("Percentage data",
{
expect_error(res <- CreateCustomTable(xx), NA)
expect_equal(attr(res, "ChartData"), xx, check.attributes = FALSE)
expect_equal(attr(attr(res, "ChartData"), "statistic"), attr(xx, "statistic"))
})
test_that("iframes",
{
res1 <- CreateCustomTable(xx)
expect_true(attr(res1, "can-run-in-root-dom"))
res2 <- CreateCustomTable(xx, custom.css = "table { background-color:green }")
expect_equal(attr(res2, "can-run-in-root-dom"), NULL)
})
test_that("Runs without column headers",
{
expect_error(CreateCustomTable(x2, col.widths = '200px',
col.header.border.width = NULL, border.color = "red"), NA)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.