summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd/drop
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd/drop')
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html19
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html15
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html16
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html15
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html16
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html15
-rw-r--r--testing/web-platform/tests/html/editing/dnd/drop/support/events.js31
7 files changed, 127 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html
new file mode 100644
index 0000000000..9e513eb836
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html
@@ -0,0 +1,19 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Selection drag and drop: events for contenteditable</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+[data-placeholder]:empty::before { content: attr(data-placeholder); }
+</style>
+<body data-expected-events="
+ b:drop:,
+ a:beforeinput:deleteByDrag,
+ a:input:deleteByDrag,
+ b:beforeinput:insertFromDrop,
+ b:textInput:,
+ b:input:insertFromDrop">
+<div><input id=a data-select="0,7" value="Drag me"></div>
+<div contenteditable=true id=b data-placeholder="...to here"></div>
+<script src="/uievents/textInput/support/common.js"></script>
+<script src="support/events.js"></script>
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html
new file mode 100644
index 0000000000..907306301f
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Selection drag and drop: events for contenteditable (same element)</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body data-expected-events="
+ b:drop:,
+ b:beforeinput:deleteByDrag,
+ b:input:deleteByDrag,
+ b:beforeinput:insertFromDrop,
+ b:textInput:,
+ b:input:insertFromDrop">
+<div contenteditable=true id=b data-select="0,7">Drag me ...to here:</div>
+<script src="/uievents/textInput/support/common.js"></script>
+<script src="support/events.js"></script>
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html
new file mode 100644
index 0000000000..2f9914cca9
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Selection drag and drop: events for &lt;input></title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body data-expected-events="
+ b:drop:,
+ a:beforeinput:deleteByDrag,
+ a:input:deleteByDrag,
+ b:beforeinput:insertFromDrop,
+ b:textInput:,
+ b:input:insertFromDrop">
+<div><input id=a data-select="0,7" value="Drag me"></div>
+<div><input id=b placeholder="...to here"></div>
+<script src="/uievents/textInput/support/common.js"></script>
+<script src="support/events.js"></script>
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html
new file mode 100644
index 0000000000..8a578d51ad
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Selection drag and drop: events for &lt;input> (same element)</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body data-expected-events="
+ b:drop:,
+ b:beforeinput:deleteByDrag,
+ b:input:deleteByDrag,
+ b:beforeinput:insertFromDrop,
+ b:textInput:,
+ b:input:insertFromDrop">
+<input id=b data-select="0,7" value="Drag me ...to here:">
+<script src="/uievents/textInput/support/common.js"></script>
+<script src="support/events.js"></script>
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html
new file mode 100644
index 0000000000..7fb8bf437f
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Selection drag and drop: events for &lt;textarea></title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body data-expected-events="
+ b:drop:,
+ a:beforeinput:deleteByDrag,
+ a:input:deleteByDrag,
+ b:beforeinput:insertFromDrop,
+ b:textInput:,
+ b:input:insertFromDrop">
+<div><input id=a data-select="0,7" value="Drag me"></div>
+<div><textarea id=b placeholder="...to here"></textarea></div>
+<script src="/uievents/textInput/support/common.js"></script>
+<script src="support/events.js"></script>
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html
new file mode 100644
index 0000000000..c856fd4fbe
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html
@@ -0,0 +1,15 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Selection drag and drop: events for &lt;textarea> (same element)</title>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<body data-expected-events="
+ b:drop:,
+ b:beforeinput:deleteByDrag,
+ b:input:deleteByDrag,
+ b:beforeinput:insertFromDrop,
+ b:textInput:,
+ b:input:insertFromDrop">
+<textarea id=b data-select="0,7">Drag me ...to here:</textarea>
+<script src="/uievents/textInput/support/common.js"></script>
+<script src="support/events.js"></script>
diff --git a/testing/web-platform/tests/html/editing/dnd/drop/support/events.js b/testing/web-platform/tests/html/editing/dnd/drop/support/events.js
new file mode 100644
index 0000000000..015cead385
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/drop/support/events.js
@@ -0,0 +1,31 @@
+setup({ explicit_timeout: true, single_test: true });
+function rAF() {
+ return new Promise(resolve => {
+ requestAnimationFrame(resolve);
+ });
+}
+const a = document.getElementById('a');
+const b = document.getElementById('b');
+const actualEvents = [];
+const expectedEvents = document.body.dataset.expectedEvents.replace(/\s+/g, '').split(',');
+const eventTypes = new Set(expectedEvents.map(s => s.split(':')[1]));
+for (const eventType of eventTypes) {
+ if (a) {
+ a.addEventListener(eventType, e => {
+ actualEvents.push(`a:${e.type}:${e.inputType || ''}`);
+ });
+ }
+ b.addEventListener(eventType, async (e) => {
+ actualEvents.push(`b:${e.type}:${e.inputType || ''}`);
+ if (e.type === "input") {
+ await rAF();
+ await rAF();
+ assert_array_equals(actualEvents, expectedEvents);
+ done();
+ }
+ });
+}
+const dragMeElement = document.querySelector('[data-select]');
+const [selectionStart, selectionEnd] = dragMeElement.dataset.select.split(',').map(s => parseInt(s, 10));
+setSelection(dragMeElement, selectionStart, selectionEnd);
+dragMeElement.focus();