@@ -101,7 +101,7 @@ const source = [
101101 '~~~unrecognized-language\n<literal> & **not emphasis**\n~~~' ,
102102 ' indented code' ,
103103 '## Diagram' ,
104- '```mermaid\nflowchart LR\n A[Start] --> B[Validate] --> C[Finish]\n```' ,
104+ '```mermaid\nflowchart LR\n A[Start] --> B[Validate] --> C[Finish]\n B --> D["$$\\frac{1}{2}$$"]\n ```' ,
105105 '## Images' ,
106106 '' ,
107107 '## Preserved source' ,
@@ -321,7 +321,22 @@ async function proveFeatures(page: Page) {
321321 ) ,
322322 'Image exceeds the reading column'
323323 )
324- await expect ( page . locator ( '.mermaid-diagram-frame svg' ) ) . toBeAttached ( { timeout : 30_000 } )
324+ const diagram = page . locator ( '.mermaid-diagram-frame svg' )
325+ await expect ( diagram ) . toBeAttached ( { timeout : 30_000 } )
326+ const fraction = diagram . locator ( 'math mfrac' )
327+ await expect ( fraction ) . toBeVisible ( )
328+ const fractionLayout = await fraction . evaluate ( ( element ) => {
329+ const numerator = element . children [ 0 ] ?. getBoundingClientRect ( )
330+ const denominator = element . children [ 1 ] ?. getBoundingClientRect ( )
331+ return numerator && denominator
332+ ? { numeratorBottom : numerator . bottom , denominatorTop : denominator . top }
333+ : null
334+ } )
335+ assert ( fractionLayout , 'The diagram must render both parts of its fraction' )
336+ assert (
337+ fractionLayout . numeratorBottom < fractionLayout . denominatorTop ,
338+ 'The diagram must typeset the fraction vertically instead of displaying raw math source'
339+ )
325340 await contained ( page )
326341}
327342
0 commit comments