From fbf27c7a0b8a99da3d9b416438330667f74ebfef Mon Sep 17 00:00:00 2001 From: Simon Pieters Date: Sat, 7 May 2022 11:33:09 +0000 Subject: [PATCH] Bug 1764306 [wpt PR 33605] - DOM: Test document.createEvent('touchevent'), a=testonly Automatic update from web-platform-tests DOM: Test document.createEvent('touchevent') See https://github.com/whatwg/dom/pull/1071 Co-authored-by: Anne van Kesteren -- wpt-commits: 75e0de2aa153aea2e31860cd6ec4628b7b673011 wpt-pr: 33605 --- .../Document-createEvent-touchevent.window.js | 12 ++++++++++++ .../dom/nodes/Document-createEvent.https.html | 17 +++++++++++++---- 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 testing/web-platform/tests/dom/nodes/Document-createEvent-touchevent.window.js diff --git a/testing/web-platform/tests/dom/nodes/Document-createEvent-touchevent.window.js b/testing/web-platform/tests/dom/nodes/Document-createEvent-touchevent.window.js new file mode 100644 index 0000000000000..6523ac5a023fc --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/Document-createEvent-touchevent.window.js @@ -0,0 +1,12 @@ +for (const variant of ['TouchEvent', 'touchevent', 'TOUCHEVENT']) { + test(() => { + if (!('ontouchstart' in document)) { + assert_throws_dom("NOT_SUPPORTED_ERR", () => { + document.createEvent(variant); + }); + } else { + document.createEvent(variant); + // The interface and other details of the event is tested in Document-createEvent.https.html + } + }, `document.createEvent('${variant}') should throw if 'expose legacy touch event APIs' is false`); +} diff --git a/testing/web-platform/tests/dom/nodes/Document-createEvent.https.html b/testing/web-platform/tests/dom/nodes/Document-createEvent.https.html index 8e948a37e6863..f80c1c3672225 100644 --- a/testing/web-platform/tests/dom/nodes/Document-createEvent.https.html +++ b/testing/web-platform/tests/dom/nodes/Document-createEvent.https.html @@ -7,13 +7,20 @@