swh:1:snp:bdc19e867479541d0f4994ceaa711217d0dc28ed
Tip revision: 1ad2332a4119217014f512bdf05025fa6f2bb72f authored by Hadley Wickham on 09 April 2020, 13:00:02 UTC
version 1.5.1
version 1.5.1
Tip revision: 1ad2332
test-autolink_html.R
context("test-autolink_html.R")
autolink_html(test_path("assets/autolink.html"), test_path("assets/autolink-out.html"))
on.exit(fs::file_delete(test_path("assets/autolink-out.html")))
out <- xml2::read_xml(test_path("assets/autolink-out.html"))
test_that("code is linked", {
a <- out %>% xml2::xml_find_first(".//code/a")
expect_true(xml2::xml_has_attr(a, "href"))
})
test_that("headers are not linked", {
h1 <- out %>% xml2::xml_find_first(".//h1/code")
expect_false(xml2::xml_has_attr(h1, "a"))
h2 <- out %>% xml2::xml_find_first(".//h2/code")
expect_false(xml2::xml_has_attr(h2, "a"))
})