Skip to content

Commit f35ab2b

Browse files
committed
Add a test for this default style quarto applies
1 parent 83bb6bd commit f35ab2b

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*_files/
2+
*.html
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: Markdown Tables
3+
---
4+
5+
They should be styled by Quarto
6+
7+
| Col1 | Col2 | Col3 |
8+
|------|------|------|
9+
| A | B | C |
10+
| E | F | G |
11+
| A | G | G |
12+
13+
: My Caption {#tbl-letters}
14+
15+
See @tbl-letters.
16+
17+
## Computational table
18+
19+
<!-- This is equivalent to intermediate markdown from a `knitr::kable()` output with `echo: false` -->
20+
21+
:::: cell
22+
::: cell-output-display
23+
| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
24+
|-------------:|------------:|-------------:|------------:|:--------|
25+
| 5.1 | 3.5 | 1.4 | 0.2 | setosa |
26+
| 4.9 | 3.0 | 1.4 | 0.2 | setosa |
27+
| 4.7 | 3.2 | 1.3 | 0.2 | setosa |
28+
| 4.6 | 3.1 | 1.5 | 0.2 | setosa |
29+
| 5.0 | 3.6 | 1.4 | 0.2 | setosa |
30+
| 5.4 | 3.9 | 1.7 | 0.4 | setosa |
31+
:::
32+
::::
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { test, expect } from '@playwright/test';
2+
3+
test('Markdown tables are styled correct', async ({ page }) => {
4+
await page.goto('html/markdown-tables.html');
5+
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' })).toBeVisible();
6+
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' }).locator('table')).toHaveCSS('border-top-style', 'solid')
7+
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' }).locator('table')).toHaveCSS('border-top-width', '1px')
8+
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' }).locator('table')).toHaveCSS('border-bottom-style', 'solid')
9+
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' }).locator('table')).toHaveCSS('border-bottom-width', '1px')
10+
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' }).locator('table tr').nth(1)).toHaveCSS('border-style', 'solid')
11+
await expect(page.locator('a.quarto-xref[href="#tbl-letters"]')).toContainText('Table 1');
12+
13+
await expect(page.locator('#computational-table table')).toBeVisible();
14+
await expect(page.locator('#computational-table table')).toHaveCSS('border-top-style', 'solid')
15+
await expect(page.locator('#computational-table table')).toHaveCSS('border-top-width', '1px')
16+
await expect(page.locator('#computational-table table')).toHaveCSS('border-bottom-style', 'solid')
17+
await expect(page.locator('#computational-table table')).toHaveCSS('border-bottom-width', '1px')
18+
await expect(page.locator('#computational-table table')).toHaveCSS('border-style', /solid/)
19+
await expect(page.locator('#computational-table table').locator('td').nth(1)).toHaveCSS('box-shadow', /rgba\(0, 0, 0, 0\.05/)
20+
21+
});

0 commit comments

Comments
 (0)