Skip to content

Commit f978b6d

Browse files
committed
rewrite autoload tests to snapshots
1 parent 54932cc commit f978b6d

2 files changed

Lines changed: 37 additions & 34 deletions

File tree

testsuite/tests/input/tex/Autoload.test.ts

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { afterAll, beforeEach, describe, test } from '@jest/globals';
2-
import { getTokens, toXmlMatch, setupTexTypeset, typeset2mml, setupComponents } from '#helpers';
1+
import { afterAll, beforeEach, describe, expect, test } from '@jest/globals';
2+
import { getTokens, setupTexTypeset, typeset2mml, setupComponents } from '#helpers';
33

44
setupComponents({loader: {load: ['input/tex-base', '[tex]/autoload']}});
55

@@ -13,41 +13,11 @@ describe('Autoload', () => {
1313
/********************************************************************************/
1414

1515
test('Autoload package', async () => {
16-
toXmlMatch(
17-
await typeset2mml('\\bbox[red]{x}'),
18-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\bbox[red]{x}" display="block">
19-
<mstyle mathbackground="red" data-latex="\\bbox [red]{x}">
20-
<mi data-latex="x">x</mi>
21-
</mstyle>
22-
</math>`
23-
);
16+
expect(await typeset2mml('\\bbox[red]{x}')).toMatchSnapshot();
2417
});
2518

2619
test('Autoload environment', async () => {
27-
toXmlMatch(
28-
await typeset2mml('\\begin{CD} a @>>> b\\end{CD}'),
29-
`<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{CD} a @&gt;&gt;&gt; b\\end{CD}" display="block">
30-
<mtable columnspacing="5pt" rowspacing="5pt" displaystyle="true" data-latex="\\begin{CD} a @&gt;&gt;&gt; b\\end{CD}">
31-
<mtr>
32-
<mtd>
33-
<mi data-latex="a">a</mi>
34-
<mpadded height="8.5pt" depth="2pt"></mpadded>
35-
</mtd>
36-
<mtd>
37-
<mover>
38-
<mo minsize="2.75em">&#x2192;</mo>
39-
<mpadded width="+.67em" lspace=".33em" voffset=".1em">
40-
<mspace width="2.75em" linebreak="nobreak" data-latex="\\kern 2.75em"></mspace>
41-
</mpadded>
42-
</mover>
43-
</mtd>
44-
<mtd>
45-
<mi data-latex="b">b</mi>
46-
</mtd>
47-
</mtr>
48-
</mtable>
49-
</math>`
50-
);
20+
expect(await typeset2mml('\\begin{CD} a @>>> b\\end{CD}')).toMatchSnapshot();
5121
});
5222
});
5323

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Autoload Autoload environment 1`] = `
4+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\begin{CD} a @&gt;&gt;&gt; b\\end{CD}" display="block">
5+
<mtable columnspacing="5pt" rowspacing="5pt" displaystyle="true" data-latex="\\begin{CD} a @&gt;&gt;&gt; b\\end{CD}">
6+
<mtr>
7+
<mtd>
8+
<mi data-latex="a">a</mi>
9+
<mpadded height="8.5pt" depth="2pt"></mpadded>
10+
</mtd>
11+
<mtd>
12+
<mover>
13+
<mo minsize="2.75em">&#x2192;</mo>
14+
<mpadded width="+.67em" lspace=".33em" voffset=".1em">
15+
<mspace width="2.75em" linebreak="nobreak" data-latex="\\kern 2.75em"></mspace>
16+
</mpadded>
17+
</mover>
18+
</mtd>
19+
<mtd>
20+
<mi data-latex="b">b</mi>
21+
</mtd>
22+
</mtr>
23+
</mtable>
24+
</math>"
25+
`;
26+
27+
exports[`Autoload Autoload package 1`] = `
28+
"<math xmlns="http://www.w3.org/1998/Math/MathML" data-latex="\\bbox[red]{x}" display="block">
29+
<mstyle mathbackground="red" data-latex="\\bbox [red]{x}">
30+
<mi data-latex="x">x</mi>
31+
</mstyle>
32+
</math>"
33+
`;

0 commit comments

Comments
 (0)