From 797f6f301ab310f6d55e442407d51d2d6219e836 Mon Sep 17 00:00:00 2001 From: Simon Bennetts Date: Wed, 1 Jul 2026 13:16:29 +0100 Subject: [PATCH] Added more tests Signed-off-by: Simon Bennetts --- server.js | 13 ++++++ tests/dynamic-content/08-template-element.js | 20 ++++++++++ tests/dynamic-content/09-infinite-scroll.js | 42 ++++++++++++++++++++ tests/dynamic-content/10-localstorage.js | 30 ++++++++++++++ tests/forms/11-fetch-get.js | 17 ++++++++ tests/forms/12-xhr-post.js | 21 ++++++++++ tests/frames/03-iframe-src.js | 8 ++++ tests/frames/04-shadow-dom-closed.js | 16 ++++++++ tests/js-events/12-pointer-events.js | 17 ++++++++ tests/js-events/13-long-press.js | 24 +++++++++++ tests/js-events/14-custom-event.js | 18 +++++++++ tests/links/05-target-blank.js | 7 ++++ tests/links/06-javascript-href.js | 14 +++++++ tests/links/07-image-map.js | 14 +++++++ tests/navigation/06-http-redirect.js | 8 ++++ tests/navigation/07-base-href.js | 12 ++++++ tests/navigation/08-window-open.js | 14 +++++++ tests/navigation/09-history-replace-state.js | 20 ++++++++++ 18 files changed, 315 insertions(+) create mode 100644 tests/dynamic-content/08-template-element.js create mode 100644 tests/dynamic-content/09-infinite-scroll.js create mode 100644 tests/dynamic-content/10-localstorage.js create mode 100644 tests/forms/11-fetch-get.js create mode 100644 tests/forms/12-xhr-post.js create mode 100644 tests/frames/03-iframe-src.js create mode 100644 tests/frames/04-shadow-dom-closed.js create mode 100644 tests/js-events/12-pointer-events.js create mode 100644 tests/js-events/13-long-press.js create mode 100644 tests/js-events/14-custom-event.js create mode 100644 tests/links/05-target-blank.js create mode 100644 tests/links/06-javascript-href.js create mode 100644 tests/links/07-image-map.js create mode 100644 tests/navigation/06-http-redirect.js create mode 100644 tests/navigation/07-base-href.js create mode 100644 tests/navigation/08-window-open.js create mode 100644 tests/navigation/09-history-replace-state.js diff --git a/server.js b/server.js index e4ff50a..26394a6 100644 --- a/server.js +++ b/server.js @@ -67,6 +67,19 @@ app.post('/set-tool', (req, res) => { res.json({ ok: true, tool: store.currentTool }); }); +// Used by navigation/06-http-redirect: issues a 302 redirect to the target URL. +app.get('/api/redirect', (req, res) => { + const url = req.query.url || '/'; + res.redirect(302, url); +}); + +// Used by frames/03-iframe-src: returns a minimal HTML page containing a link to +// the given URL, so the iframe has a same-origin src rather than inline srcdoc. +app.get('/api/page', (req, res) => { + const url = req.query.url || ''; + res.send(`Click me`); +}); + // Used by the fetch-injected dynamic-content test: echoes back a known score URL // so the link is only discoverable after a network round-trip. app.get('/api/reveal', (req, res) => { diff --git a/tests/dynamic-content/08-template-element.js b/tests/dynamic-content/08-template-element.js new file mode 100644 index 0000000..8a77ca7 --- /dev/null +++ b/tests/dynamic-content/08-template-element.js @@ -0,0 +1,20 @@ +module.exports = { + name: 'Score link inside