Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/smoke/site/render-listings.test.ts
6434 views
1
/*
2
* render-listings.test.ts
3
*
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
*
6
*/
7
import { dirname, join } from "../../../src/deno_ral/path.ts";
8
import { testQuartoCmd, Verify } from "../../test.ts";
9
10
import { docs } from "../../utils.ts";
11
import { ensureHtmlElements, fileExists } from "../../verify.ts";
12
13
const input = docs("listings/index.qmd");
14
const outputDir = join(docs("listings"), "_site");
15
const htmlOutput = join(
16
outputDir,
17
"index.html",
18
);
19
20
const verify: Verify[] = [];
21
verify.push(fileExists(htmlOutput));
22
// 1. Testing listing type
23
24
25
verify.push(ensureHtmlElements(htmlOutput, [
26
// 1. Testing listing type
27
"div#listing-reports table.quarto-listing-table",
28
"div#listing-other-reports .quarto-listing-default",
29
"div#listing-notes .quarto-grid-item",
30
// 2. Testing image-placeholder is correctly chosen
31
"div#listing-other-reports .quarto-post div.thumbnail img[src^='other-report.png']",
32
"div#listing-notes .quarto-grid-item .card-img-top img[src^='meeting-notes.png']",
33
// 3. Testing that empty div is used when no image is present
34
"div#listing-reports span.listing-image div.listing-item-img-placeholder",
35
// 4. Testing that `.preview-image` is correctly taken
36
'div#listing-other-reports .quarto-post div.thumbnail img[src$="2\.png"]',
37
]));
38
39
testQuartoCmd(
40
"render",
41
[
42
dirname(input),
43
],
44
verify,
45
{
46
name: "Site Render",
47
teardown: async () => {
48
await Deno.remove(outputDir, { recursive: true });
49
},
50
},
51
);
52
53