Skip to content

Commit

Permalink
test - code block font size should not be applied twiced
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cderv committed Oct 28, 2024
1 parent f40a89a commit 9e01d1c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/docs/playwright/html/code-font-size.qmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
title: Testing code font size
format: html
---

```python
1 + 1
```
10 changes: 10 additions & 0 deletions tests/integration/playwright/tests/html-themes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,14 @@ test('Dark theming toggle change to dark background ', async ({ page }) => {
await page.locator("a.quarto-color-scheme-toggle").click();
const locatr2 = await page.locator('div').filter({ hasText: 'Quarto Playground' }).first()
await expect(locatr2).toHaveCSS('background-color', 'rgb(255, 0, 0)');
});

test('Code block font size did not change and still equals to pre size', async ({ page }) => {
await page.goto('./html/code-font-size.html');
const code = page.getByRole('code')
const pre = page.locator('pre')
const preFontSize = await pre.evaluate((element) =>
window.getComputedStyle(element).getPropertyValue('font-size'),
);
await expect(code).toHaveCSS('font-size', preFontSize);
});

0 comments on commit 9e01d1c

Please sign in to comment.