Skip to content

Commit 30b8c87

Browse files
committed
Update test and snapshot test for local use
1 parent 1f8dd34 commit 30b8c87

File tree

9 files changed

+77
-8
lines changed

9 files changed

+77
-8
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
title: Markdown Tables
3+
tbl-cap-location: bottom
4+
---
5+
6+
They should be styled by Quarto
7+
8+
## labelled {#labelled}
9+
10+
| Col1 | Col2 | Col3 |
11+
|------|------|------|
12+
| A | B | C |
13+
| E | F | G |
14+
| A | G | G |
15+
16+
: My Caption {#tbl-letters}
17+
18+
See @tbl-letters.
19+
20+
## non-labelled table {#non-labelled}
21+
22+
| Col1 | Col2 | Col3 |
23+
|------|------|------|
24+
| A | B | C |
25+
| E | F | G |
26+
27+
: A non-labelled table with a caption
28+
29+
## Computational table {#computation}
30+
31+
<!-- This is equivalent to intermediate markdown from a `knitr::kable()` output with `echo: false` -->
32+
33+
:::: {.cell}
34+
::: {.cell-output-display}
35+
36+
Table: A caption
37+
38+
| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
39+
|-------------:|------------:|-------------:|------------:|:--------|
40+
| 5.1 | 3.5 | 1.4 | 0.2 | setosa |
41+
| 4.9 | 3.0 | 1.4 | 0.2 | setosa |
42+
| 4.7 | 3.2 | 1.3 | 0.2 | setosa |
43+
| 4.6 | 3.1 | 1.5 | 0.2 | setosa |
44+
| 5.0 | 3.6 | 1.4 | 0.2 | setosa |
45+
| 5.4 | 3.9 | 1.7 | 0.4 | setosa |
46+
:::
47+
::::

tests/docs/playwright/html/markdown-tables.qmd renamed to tests/docs/playwright/html/tables/markdown-tables.qmd

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
---
22
title: Markdown Tables
3+
tbl-cap-location: bottom
34
---
45

56
They should be styled by Quarto
67

8+
## labelled {#labelled}
9+
710
| Col1 | Col2 | Col3 |
811
|------|------|------|
912
| A | B | C |
@@ -14,12 +17,24 @@ They should be styled by Quarto
1417

1518
See @tbl-letters.
1619

17-
## Computational table
20+
## non-labelled table {#non-labelled}
21+
22+
| Col1 | Col2 | Col3 |
23+
|------|------|------|
24+
| A | B | C |
25+
| E | F | G |
26+
27+
: A non-labelled table with a caption
28+
29+
## Computational table {#computation}
1830

1931
<!-- This is equivalent to intermediate markdown from a `knitr::kable()` output with `echo: false` -->
2032

21-
:::: cell
22-
::: cell-output-display
33+
:::: {.cell}
34+
::: {.cell-output-display}
35+
36+
Table: A caption
37+
2338
| Sepal.Length | Sepal.Width | Petal.Length | Petal.Width | Species |
2439
|-------------:|------------:|-------------:|------------:|:--------|
2540
| 5.1 | 3.5 | 1.4 | 0.2 | setosa |
4 Bytes
Loading
-7.06 KB
Loading
12.9 KB
Loading
3.38 KB
Loading
4.69 KB
Loading
12.9 KB
Loading
Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
import { test, expect } from '@playwright/test';
22

3-
test('Markdown tables are styled correctly', async ({ page }) => {
4-
await page.goto('html/markdown-tables.html');
5-
await expect(page.getByRole('figure', { name: 'Table 1: My Caption' }).locator('table')).toHaveScreenshot()
6-
await expect(page.locator('a.quarto-xref[href="#tbl-letters"]')).toContainText('Table 1');
3+
async function testTables(page, path: string) {
4+
await page.goto(`html/tables/${path}`);
5+
await expect(page.locator('#labelled table')).toHaveScreenshot();
6+
await expect(page.locator('a.quarto-xref[href="#tbl-letters"]')).toContainText('Table 1');
7+
await expect(page.locator('#non-labelled table')).toHaveScreenshot();
8+
await expect(page.locator('#computation table')).toHaveScreenshot();
9+
}
710

8-
await expect(page.locator('#computational-table table')).toHaveScreenshot()
11+
test('Markdown tables are styled correctly', async ({ page }) => {
12+
// Test with default caption position
13+
await testTables(page, 'markdown-tables.html');
914

15+
// Test with bottom caption
16+
await testTables(page, 'markdown-tables-cap-bottom.html');
1017
});

0 commit comments

Comments
 (0)