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-init.R
context("test-init.R")
test_that("extra.css and extra.js copied and linked", {
pkg <- test_path("assets/init-extra-2")
expect_output(init_site(pkg))
on.exit(clean_site(pkg))
expect_true(file_exists(path(pkg, "docs", "extra.css")))
expect_true(file_exists(path(pkg, "docs", "extra.js")))
skip_if_no_pandoc()
# Now check they actually get used .
expect_output(build_home(pkg))
html <- xml2::read_html(path(pkg, "docs", "index.html"))
links <- xml2::xml_find_all(html, ".//link")
paths <- xml2::xml_attr(links, "href")
expect_true("extra.css" %in% paths)
})
test_that("single extra.css correctly copied", {
pkg <- test_path("assets/init-extra-1")
expect_output(init_site(pkg))
on.exit(clean_site(pkg))
expect_true(file_exists(path(pkg, "docs", "extra.css")))
})
test_that("asset subdirectories are copied", {
pkg <- test_path("assets/init-asset-subdirs")
expect_output(init_site(pkg))
on.exit(clean_site(pkg))
expect_true(file_exists(path(pkg, "docs", "subdir1", "file1.txt")))
expect_true(file_exists(path(pkg, "docs", "subdir1", "subdir2", "file2.txt")))
})