diff --git a/dom/nodes/Document-createEvent-touchevent.window.js b/dom/nodes/Document-createEvent-touchevent.window.js new file mode 100644 index 00000000000000..6523ac5a023fc4 --- /dev/null +++ b/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/dom/nodes/Document-createEvent.https.html b/dom/nodes/Document-createEvent.https.html index 8e948a37e68630..f80c1c3672225d 100644 --- a/dom/nodes/Document-createEvent.https.html +++ b/dom/nodes/Document-createEvent.https.html @@ -7,13 +7,20 @@