4
4
* Copyright (C) 2020-2022 Posit Software, PBC
5
5
*
6
6
*/
7
- import { dirname , join } from "path/mod.ts" ;
7
+ import { dirname , extname , join } from "path/mod.ts" ;
8
8
import { docs , outputForInput } from "../../utils.ts" ;
9
9
import {
10
10
ensureFileRegexMatches ,
@@ -13,6 +13,7 @@ import {
13
13
noErrorsOrWarnings ,
14
14
} from "../../verify.ts" ;
15
15
import { testRender } from "../render/render.ts" ;
16
+ import { walkSync } from "fs/mod.ts" ;
16
17
17
18
const format = "html" ;
18
19
const input = docs ( "embed/embed-qmd.qmd" ) ;
@@ -102,3 +103,35 @@ testRender(ipynbInput, format, false, [
102
103
return Promise . resolve ( ) ;
103
104
} ,
104
105
} ) ;
106
+
107
+ // Test different echo settings (bug 8472)
108
+ const docInput = docs ( "embed/qmd-embed/index.qmd" ) ;
109
+ const docOutput = outputForInput ( docInput , "html" ) ;
110
+ testRender ( docInput , "html" , false , [
111
+ noErrorsOrWarnings ,
112
+ ensureHtmlElements ( docOutput . outputPath , [
113
+ // Make sure the embeds produce expected output
114
+ "#fig-polar" ,
115
+ "#fig-index-plot" ,
116
+ // Make sure notebook links are present
117
+ "a.quarto-notebook-link" ,
118
+ ".quarto-alternate-notebooks a" ,
119
+ ] ) ,
120
+ // Ensure the captions look good
121
+ ensureFileRegexMatches ( docOutput . outputPath , [
122
+ / F i g u r e .* 1 : / ,
123
+ / F i g u r e .* 2 : / ,
124
+ ] ) ,
125
+ ] , {
126
+ teardown : ( ) => {
127
+ // Only qmds should be left in this directory
128
+ const dir = join ( Deno . cwd ( ) , dirname ( docInput ) ) ;
129
+
130
+ const cleanup = [ "notebook.embed_files" , "notebook.embed-preview.html" , "notebook2.embed_files" , "notebook2.embed-preview.html" ] ;
131
+ cleanup . forEach ( ( path ) => {
132
+ Deno . removeSync ( join ( dir , path ) , { recursive : true } ) ;
133
+ } )
134
+ return Promise . resolve ( ) ;
135
+ } ,
136
+ } ) ;
137
+
0 commit comments