test_that("lineage-rate HTML controls retain their authored DOM", { source <- testthat::test_path( "../../vignettes/avian-skeleton-part-2.Rmd" ) testthat::skip_if_not( file.exists(source), "Lineage-rate vignette source is unavailable in installed tests" ) artifact_root <- Sys.getenv("BIFROST_ARTIFACT_DIR", unset = "") testthat::skip_if( !nzchar(artifact_root) || !file.exists(file.path(artifact_root, "empirical-artifacts.json")), "Repository empirical artifact directory is required for vignette rendering" ) testthat::skip_if_not_installed("rmarkdown") testthat::skip_if_not( rmarkdown::pandoc_available(), "Pandoc is required for the HTML widget regression test" ) output_dir <- withr::local_tempdir(pattern = "lineage-rate-widget-") rendered <- rmarkdown::render( input = source, output_format = "rmarkdown::html_vignette", output_file = "lineage-rate-widget.html", output_dir = output_dir, envir = new.env(parent = globalenv()), quiet = TRUE, clean = TRUE ) html <- paste(readLines(rendered, warn = FALSE), collapse = "\n") rate_match <- regexpr( '(?s)
\\s*]+type="range"', perl = TRUE ) readout_ids <- gregexpr( 'id="ldw-readout-part2"', html, fixed = TRUE )[[1L]] testthat::expect_equal(sum(readout_ids > 0L), 1L) testthat::expect_false(grepl("
Myr", html, fixed = TRUE)) })