Skip to content

Commit 9e01d1c

Browse files
committed
test - code block font size should not be applied twiced
add a test with playwright to check that we don't modify code fontsize in a way that this is will get a different value for code inside pre than font-size of pre itself
1 parent f40a89a commit 9e01d1c

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: Testing code font size
3+
format: html
4+
---
5+
6+
```python
7+
1 + 1
8+
```

tests/integration/playwright/tests/html-themes.spec.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,14 @@ test('Dark theming toggle change to dark background ', async ({ page }) => {
1919
await page.locator("a.quarto-color-scheme-toggle").click();
2020
const locatr2 = await page.locator('div').filter({ hasText: 'Quarto Playground' }).first()
2121
await expect(locatr2).toHaveCSS('background-color', 'rgb(255, 0, 0)');
22+
});
23+
24+
test('Code block font size did not change and still equals to pre size', async ({ page }) => {
25+
await page.goto('./html/code-font-size.html');
26+
const code = page.getByRole('code')
27+
const pre = page.locator('pre')
28+
const preFontSize = await pre.evaluate((element) =>
29+
window.getComputedStyle(element).getPropertyValue('font-size'),
30+
);
31+
await expect(code).toHaveCSS('font-size', preFontSize);
2232
});

0 commit comments

Comments
 (0)