test_that("tbl_qmd_span generates correct HTML with base64 encoding", {
expect_match(
tbl_qmd_span("**bold text**"),
"**bold text**",
fixed = TRUE
)
expect_match(
tbl_qmd_span("$\\alpha + \\beta$", display = "Greek formula"),
"Greek formula",
fixed = TRUE
)
})
test_that("tbl_qmd_span_raw generates correct HTML with raw encoding", {
expect_match(
tbl_qmd_span_raw("Simple text"),
"Simple text",
fixed = TRUE
)
})
test_that("tbl_qmd_div generates correct HTML with base64 encoding", {
# Test with default base64 encoding
expect_match(
tbl_qmd_div("## Section Title\n\nContent here"),
"
## Section Title\n\nContent here
",
fixed = TRUE
)
# Test with display text
expect_match(
tbl_qmd_div(
"{{< video https://example.com >}}",
display = "[Video content]"
),
"[Video content]
",
fixed = TRUE
)
})
test_that("tbl_qmd_div_raw generates correct HTML with raw encoding", {
result <- tbl_qmd_div_raw("## Simple header")
expect_true(grepl("display",
fixed = TRUE
)
expect_match(
.tbl_qmd_element("div", "content", "display", TRUE),
"
display
",
fixed = TRUE
)
})
test_that(".tbl_qmd_element handles class and additional attributes", {
expect_match(
.tbl_qmd_element(
"span",
"content",
"display",
TRUE,
class = "test-class",
attrs = list(id = "test-id", tabindex = "0")
),
"
display",
fixed = TRUE
)
})