Skip to content

Commit 307b951

Browse files
committed
test: cover paginated listing items and minimal HTML
1 parent b86bc0b commit 307b951

3 files changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "External Links Test - Minimal HTML"
3+
format:
4+
html:
5+
minimal: true
6+
---
7+
8+
An [Outside](https://example.com/minimal) link.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: "External Links Test - Paginated"
3+
listing:
4+
id: paged-listing
5+
contents:
6+
- path: local-post.qmd
7+
title: "Local Post"
8+
- path: https://example.com/external-article
9+
title: "External Article"
10+
type: default
11+
page-size: 1
12+
---
13+
14+
::: {#paged-listing}
15+
:::

‎tests/integration/playwright/tests/html-listing-external-links.spec.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,3 +159,28 @@ test.describe("External links without link-external-newwindow", () => {
159159
await expect(link.locator(".quarto-ext-newwindow")).toHaveCount(0);
160160
});
161161
});
162+
163+
test.describe("External links shown after listing updates", () => {
164+
test("item on page 2 is decorated after pagination", async ({ page: browserPage }) => {
165+
await browserPage.goto("./listings/external-links/_site/paged.html");
166+
const listing = browserPage.locator("#paged-listing");
167+
await listing.locator(".pagination .page.page-link", { hasText: "2" }).click();
168+
169+
const link = listing.locator('.listing-title a[href="https://example.com/external-article"]');
170+
await expect(link).toHaveAttribute("target", "_blank");
171+
await expect(link).toHaveAccessibleName(/\(opens in a new tab\)$/);
172+
await expect(link.locator(".quarto-ext-newwindow")).toHaveCount(1);
173+
});
174+
});
175+
176+
test.describe("External links in minimal HTML", () => {
177+
test("new-tab announcement stays visually hidden", async ({ page: browserPage }) => {
178+
await browserPage.goto("./listings/external-links/_site/minimal.html");
179+
180+
const note = browserPage.locator('a[href="https://example.com/minimal"] .quarto-ext-newwindow');
181+
await expect(note).toHaveCount(1);
182+
const box = await note.boundingBox();
183+
expect(box?.width ?? 0).toBeLessThanOrEqual(1);
184+
expect(box?.height ?? 0).toBeLessThanOrEqual(1);
185+
});
186+
});

0 commit comments

Comments
 (0)