From d9133004e21fd8d7a47c32541839c2f81f04761b Mon Sep 17 00:00:00 2001 From: Philipp Daun Date: Fri, 26 Jan 2024 16:41:44 +0100 Subject: [PATCH] Add functional tests for SVG anchor elements --- tests/fixtures/link-types.html | 38 +++++++++++++++++++++++++ tests/functional/preload-plugin.spec.ts | 8 ++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/fixtures/link-types.html diff --git a/tests/fixtures/link-types.html b/tests/fixtures/link-types.html new file mode 100644 index 0000000..6045bf4 --- /dev/null +++ b/tests/fixtures/link-types.html @@ -0,0 +1,38 @@ + + + + + + Link types + + + +
+

Link types

+ +

Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.

+ + + + + SVG link to page + + + + + + Map link to page + +
+ + + + + diff --git a/tests/functional/preload-plugin.spec.ts b/tests/functional/preload-plugin.spec.ts index 01786bb..ebb34f2 100644 --- a/tests/functional/preload-plugin.spec.ts +++ b/tests/functional/preload-plugin.spec.ts @@ -93,6 +93,14 @@ test.describe('active links', () => { await expectSwupToHaveCacheEntry(page, '/page-2.html'); await expectSwupToHaveCacheEntry(page, '/page-3.html'); }); + + test('preloads svg links', async ({ page }) => { + await page.goto('/link-types.html'); + await waitForSwup(page); + await expectSwupNotToHaveCacheEntry(page, '/page-2.html'); + await page.focus('svg a', { strict: true }); + await expectSwupToHaveCacheEntry(page, '/page-2.html'); + }); }); test.describe('visible links', () => {