Path: blob/main/tests/smoke/site/render-listings.test.ts
6434 views
/*1* render-listings.test.ts2*3* Copyright (C) 2020-2022 Posit Software, PBC4*5*/6import { dirname, join } from "../../../src/deno_ral/path.ts";7import { testQuartoCmd, Verify } from "../../test.ts";89import { docs } from "../../utils.ts";10import { ensureHtmlElements, fileExists } from "../../verify.ts";1112const input = docs("listings/index.qmd");13const outputDir = join(docs("listings"), "_site");14const htmlOutput = join(15outputDir,16"index.html",17);1819const verify: Verify[] = [];20verify.push(fileExists(htmlOutput));21// 1. Testing listing type222324verify.push(ensureHtmlElements(htmlOutput, [25// 1. Testing listing type26"div#listing-reports table.quarto-listing-table",27"div#listing-other-reports .quarto-listing-default",28"div#listing-notes .quarto-grid-item",29// 2. Testing image-placeholder is correctly chosen30"div#listing-other-reports .quarto-post div.thumbnail img[src^='other-report.png']",31"div#listing-notes .quarto-grid-item .card-img-top img[src^='meeting-notes.png']",32// 3. Testing that empty div is used when no image is present33"div#listing-reports span.listing-image div.listing-item-img-placeholder",34// 4. Testing that `.preview-image` is correctly taken35'div#listing-other-reports .quarto-post div.thumbnail img[src$="2\.png"]',36]));3738testQuartoCmd(39"render",40[41dirname(input),42],43verify,44{45name: "Site Render",46teardown: async () => {47await Deno.remove(outputDir, { recursive: true });48},49},50);515253