|
| 1 | +import { ensureHtmlElements } from "../../verify.ts"; |
| 2 | +import { testRender } from "../render/render.ts"; |
| 3 | +import { docs, outputForInput } from "../../utils.ts"; |
| 4 | +import { join } from "path/mod.ts"; |
| 5 | + |
| 6 | +const verifySmallCaps = ["main.content span.smallcaps"]; |
| 7 | +const verifyBehead = ["main.content em"]; |
| 8 | +const verifyBeheadExclude = ["h2"]; |
| 9 | + |
| 10 | +// Test that the small cap filter properly runs |
| 11 | +const luaInput = docs(join("filters", "lua-filter.qmd")); |
| 12 | +const luaOutput = outputForInput(luaInput, "html"); |
| 13 | +testRender(luaInput, "html", false, [ |
| 14 | + ensureHtmlElements(luaOutput.outputPath, [ |
| 15 | + ...verifySmallCaps, |
| 16 | + ]), |
| 17 | +]); |
| 18 | + |
| 19 | +// Test that the python behead filter is working |
| 20 | +const pythonInput = docs(join("filters", "python-filter.qmd")); |
| 21 | +const pythonOutput = outputForInput(pythonInput, "html"); |
| 22 | +testRender(pythonInput, "html", false, [ |
| 23 | + ensureHtmlElements(pythonOutput.outputPath, [ |
| 24 | + ...verifyBehead, |
| 25 | + ], [ |
| 26 | + ...verifyBeheadExclude, |
| 27 | + ]), |
| 28 | +]); |
| 29 | + |
| 30 | +// Test that the python behead filter is working |
| 31 | +const bothInput = docs(join("filters", "both.qmd")); |
| 32 | +const bothOutput = outputForInput(bothInput, "html"); |
| 33 | +testRender(bothInput, "html", false, [ |
| 34 | + ensureHtmlElements(bothOutput.outputPath, [ |
| 35 | + ...verifySmallCaps, |
| 36 | + ...verifyBehead, |
| 37 | + ], [ |
| 38 | + ...verifyBeheadExclude, |
| 39 | + ]), |
| 40 | +]); |
| 41 | + |
| 42 | +// Test that filter order works |
| 43 | +const orderInput = docs(join("filters", "filter-order.qmd")); |
| 44 | +testRender(orderInput, "html", false); |
0 commit comments