Path: blob/main/tests/smoke/render/render-reveal.test.ts
12925 views
/*1* render-reveal.test.ts2*3* Copyright (C) 2020-2022 Posit Software, PBC4*/56import { docs, fileLoader, outputForInput } from "../../utils.ts";7import {8ensureFileRegexMatches,9ensureHtmlElements,10ensureHtmlSelectorSatisfies,11} from "../../verify.ts";12import { testRender } from "./render.ts";1314// demo file renders ok15testRender(docs("reveal/index.qmd"), "revealjs", false);1617let input = docs("reveal/aside-footnotes.qmd");18let output = outputForInput(input, "revealjs");19testRender(input, "revealjs", false, [20ensureHtmlElements(output.outputPath, [21// speaker notes are left not moved22"section#slide-with-speaker-notes > aside.notes:last-child",23// div of class aside are moved24"section#slide-with-footnotes > aside:last-child > div > p",25// footnotes are put in aside26"section#slide-with-footnotes > aside:last-child > ol.aside-footnotes > li",27], [28// footnotes back are removed29"section#slide-with-footnotes > aside:last-child > ol.aside-footnotes > li > .footnote-back",30]),31]);3233// auto-stretch feature34input = docs("reveal/stretch.qmd");35output = outputForInput(input, "revealjs");36testRender(input, "revealjs", false, [37ensureHtmlElements(output.outputPath, [38"#simple-image > p + img.r-stretch",39"#chunk-below > p + img.r-stretch + p.caption + div.cell",40"#no-caption > p + img.r-stretch",41"#height-defined img:not(.r-stretch)",42"#rigth-aligned > img.r-stretch.quarto-figure-right",43"#only-image > img.r-stretch + p.caption",44"#alt-text > img.r-stretch[alt]",45"#caption-title > img.r-stretch[title] + p.caption",46"#with-class-no-caption > img.stretch",47"#with-class-caption > img.stretch.quarto-figure-center + p.caption",48"#knitr-plot > div.cell + img.r-stretch + p.caption",49"#knitr-plot-no-echo > img.r-stretch + p.caption",50"#knitr-and-text > img.r-stretch + p.caption + p",51"#knitr-align > img.r-stretch.quarto-figure-right + p.caption",52"#knitr-no-caption-and-content > img.r-stretch ~ div.cell",53"#no-content > img.r-stretch",54"#no-content-caption > img.r-stretch + p.caption",55"#custom-divs-opt-in > div.custom-block:not(.r-stretch) + img.r-stretch + p.caption",56], [57"#columns img.r-stretch",58"#more-than-one img.r-stretch",59"section#no-stretch-class.nostretch img.r-stretch",60"#knitr-height img.r-stretch",61"#knitr-height-pct img.r-stretch",62"#inline-image img.r-stretch",63"#block-layout img.r-stretch",64"#block-layout2 img.r-stretch",65"#fig-tab-layout img.r-stretch",66"#custom-divs-simple img.r-stretch",67"#custom-divs-caption img.r-stretch",68"#custom-divs-caption img.r-stretch",69"#custom-divs-knitr img.r-stretch",70"#custom-divs-knitr-caption img.r-stretch",71"#aside img.r-stretch",72"#absolute img.r-stretch",73"#link img.r-stretch",74]),75]);7677// fragments78const fragmentsDiv = fileLoader("reveal")("fragments.qmd", "revealjs");79testRender(fragmentsDiv.input, "revealjs", false, [80ensureHtmlElements(fragmentsDiv.output.outputPath, [81"#slide-2 > div.fragment > h3",82], []),83]);8485// output-location86const outputLocation = fileLoader("reveal")("output-location.qmd", "revealjs");87testRender(outputLocation.input, "revealjs", false, [88ensureHtmlElements(outputLocation.output.outputPath, [89"section#loc-slide + section#loc-slide-output > div.output-location-slide",90"section#loc-fragment > div.fragment > div.cell-output-display",91"section#loc-col-fragment > div.columns > div.column:nth-child(2).fragment > div.cell-output-display",92], [93"section#loc-slide > div.output-location-slide",94]),95ensureHtmlSelectorSatisfies(96outputLocation.output.outputPath,97"section#loc-column > div.columns > div.column",98(nodeList) => {99return nodeList.length === 2;100},101),102ensureHtmlSelectorSatisfies(103outputLocation.output.outputPath,104"section#loc-col-fragment > div.columns > div.column",105(nodeList) => {106return nodeList.length === 2;107},108),109]);110111// reveal-config112const revealConfigs = fileLoader("reveal")("reveal-configs.qmd", "revealjs");113testRender(revealConfigs.input, "revealjs", false, [114ensureFileRegexMatches(revealConfigs.output.outputPath, [115"pdfSeparateFragments.*true",116"smaller.*true",117"pdfSeparateFragments.*true",118'autoAnimateEasing.*"ease-in-out"',119"autoAnimateDuration.*5",120"autoAnimateUnmatched.*false",121"pdfMaxPagesPerSlide.*1",122], []),123]);124125126