44 * Copyright (C) 2020-2022 Posit Software, PBC
55 */
66
7- import { docs } from "../../utils.ts" ;
7+ import { docs , projectOutputForInput } from "../../utils.ts" ;
88
99import { basename , dirname , extname , join , relative } from "../../../src/deno_ral/path.ts" ;
1010import { ensureHtmlElements } from "../../verify.ts" ;
1111import { testQuartoCmd } from "../../test.ts" ;
1212import { noErrors } from "../../verify.ts" ;
1313import { existsSync } from "fs/mod.ts" ;
1414
15- const siteOutputForInput = ( rootDir : string , input : string ) => {
16- const dir = join ( rootDir , "_site" ) ;
17- const stem = basename ( input , extname ( input ) ) ;
18-
19- const outputPath = join (
20- dir ,
21- dirname ( relative ( rootDir , input ) ) ,
22- `${ stem } .html` ,
23- ) ;
24- const supportPath = join ( dir , `site_libs` ) ;
25-
26- return {
27- outputPath,
28- supportPath,
29- } ;
30- } ;
31-
3215const testRender = (
33- rootDir : string ,
3416 input : string ,
3517 includeSelectors : string [ ] ,
3618 excludeSelectors : string [ ] ,
3719) => {
38- const output = siteOutputForInput ( rootDir , input ) ;
20+ const output = projectOutputForInput ( input ) ;
3921 const verifySel = ensureHtmlElements (
4022 output . outputPath ,
4123 includeSelectors ,
@@ -63,8 +45,7 @@ const rootDir = docs("extensions/project/");
6345
6446// Render the home page and verify the output
6547// contains the extension shortcodes and filter elements
66- const rootInput = join ( rootDir , "posts/welcome/index.qmd" ) ;
67- testRender ( rootDir , rootInput , [
48+ testRender ( join ( rootDir , "posts/welcome/index.qmd" ) , [
6849 "a.lightbox" ,
6950 "i.fa-solid.fa-anchor" ,
7051 "i.fa-solid.fa-bacteria" ,
@@ -74,7 +55,7 @@ testRender(rootDir, rootInput, [
7455// Render the welcome page (subdirectory) and verify the output
7556// contains the extension shortcodes and filter elements
7657const subdirInput = join ( rootDir , "posts/welcome/index.qmd" ) ;
77- testRender ( rootDir , subdirInput , [
58+ testRender ( join ( rootDir , "posts/welcome/index.qmd" ) , [
7859 "a.lightbox" ,
7960 "i.fa-solid.fa-anchor" ,
8061 "i.fa-solid.fa-bacteria" ,
0 commit comments