Skip to content

Commit 6920dc1

Browse files
committed
test - Add playwright tests for katex rendering in Jupyter document
1 parent 5be7cb2 commit 6920dc1

4 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
format: html
3+
html-math-method: katex
4+
embed-resources: true
5+
---
6+
7+
$\alpha$
8+
9+
```{python}
10+
import pandas as pd
11+
pd.DataFrame([1])
12+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
format: html
3+
html-math-method: katex
4+
embed-resources: true
5+
self-contained-math: true
6+
---
7+
8+
$\alpha$
9+
10+
```{python}
11+
import pandas as pd
12+
pd.DataFrame([1])
13+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
format: html
3+
html-math-method: katex
4+
---
5+
6+
$\alpha$
7+
8+
```{python}
9+
import pandas as pd
10+
pd.DataFrame([1])
11+
```
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test.describe('KaTeX math rendering in Jupyter engine document', () => {
4+
const testCases = [
5+
{ url: 'html/math/katex/not-embed.html', description: 'not embedding resources' },
6+
{ url: 'html/math/katex/embed-with-math.html', description: 'embedding resources including Math' },
7+
{ url: 'html/math/katex/embed-except-math.html', description: 'embedding resources except Math' }
8+
];
9+
10+
for (const { url, description } of testCases) {
11+
test(`KaTeX math is rendered while ${description}`, async ({ page }) => {
12+
await page.goto(url);
13+
// Check that math is rendered
14+
await expect(page.locator("span.katex")).toContainText('α');
15+
});
16+
}
17+
});

0 commit comments

Comments
 (0)