Skip to content

Commit

Permalink
Change test rather than math method
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed May 29, 2024
1 parent c74a633 commit 032c3de
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions tests/testthat/test-build-home-index.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@ test_that("title and description come from DESCRIPTION by default", {
})

test_that("math is handled", {
pkg <- local_pkgdown_site(
test_path("assets/home-readme-rmd"),
meta = list(template = list(`math-rendering` = "mathjax")),
clone = TRUE
)
pkg <- local_pkgdown_site(test_path("assets/home-readme-rmd"), clone = TRUE)
write_lines(c("$1 + 1$"), path(pkg$src_path, "README.md"))

suppressMessages(init_site(pkg))
suppressMessages(build_home_index(pkg))

html <- xml2::read_html(path(pkg$dst_path, "index.html"))
expect_equal(xpath_text(html, ".//span[contains(@class, 'math')]"), "\\(1 + 1\\)")
expect_equal(xpath_length(html, ".//math"), 1)
})

test_that("data_home() validates yaml metadata", {
Expand Down

0 comments on commit 032c3de

Please sign in to comment.