summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/editing/dnd
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-15 03:35:49 +0000
commitd8bbc7858622b6d9c278469aab701ca0b609cddf (patch)
treeeff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/html/editing/dnd
parentReleasing progress-linux version 125.0.3-1~progress7.99u1. (diff)
downloadfirefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz
firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/editing/dnd')
-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
-rw-r--r--testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html108
8 files changed, 235 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();
diff --git a/testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html b/testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html
new file mode 100644
index 0000000000..acd8450308
--- /dev/null
+++ b/testing/web-platform/tests/html/editing/dnd/the-datatransfer-interface/dnd-datatransfer-setdragimage-manual.html
@@ -0,0 +1,108 @@
+<!DOCTYPE html>
+<html>
+
+<head>
+ <style>
+ div {
+ margin: 0em;
+ padding: 2em;
+ }
+
+ #source1,
+ #source2 {
+ color: blue;
+ border: 1px solid black;
+ }
+
+ #target {
+ border: 1px solid black;
+ }
+ </style>
+ <script>
+ function getSolidColorImageBase64(color) {
+ var canvas = document.createElement('canvas');
+ canvas.width = 256;
+ canvas.height = 256;
+ var ctx = canvas.getContext('2d');
+ ctx.fillStyle = color;
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
+ return canvas.toDataURL();
+ }
+ function setDragImage(ev) {
+ var dragImage = document.createElement('img');
+ if (ev.type === 'dragstart') {
+ dragImage = document.getElementById('dragImage');
+ }
+ if (ev.type === 'dragover') {
+ // Red color image
+ dragImage.src = getSolidColorImageBase64('#FF0000');
+ }
+ if (ev.type === 'dragenter') {
+ // Green color image
+ dragImage.src = getSolidColorImageBase64('#00FF00');
+ }
+ if (ev.type === 'drop') {
+ // Yellow color image
+ dragImage.src = getSolidColorImageBase64('#FFFF00');
+ }
+ ev.dataTransfer.setDragImage(dragImage, 10, 10);
+ }
+
+ function dragstart_with_image_handler(ev) {
+ ev.dataTransfer.setData("text/plain", ev.target.id);
+ setDragImage(ev);
+ }
+
+ function dragstart_without_image_handler(ev) {
+ ev.dataTransfer.setData("text/plain", ev.target.id);
+ }
+
+ function dragover_handler(ev) {
+ setDragImage(ev);
+ ev.preventDefault();
+ }
+
+ function drag_enter(ev) {
+ setDragImage(ev);
+ ev.preventDefault();
+ }
+
+ function drop_handler(ev) {
+ setDragImage(ev);
+ ev.preventDefault();
+ var data = ev.dataTransfer.getData("text");
+ ev.target.appendChild(document.getElementById(data));
+ }
+ </script>
+</head>
+
+<body>
+ <div id="dragImageDiv">
+ </div>
+ <div>
+ <p id="source1" ondragstart="dragstart_with_image_handler(event);" draggable="true">
+ Select this element, drag it to the Drop Zone and drag image
+ should be visible. The drag image should be identical to the above image.
+ And the drag image should not change through out the drag and drop operation.
+ </p>
+ </div>
+ <div>
+ <p id="source2" ondragstart="dragstart_without_image_handler(event);" draggable="true">
+ Select this element, drag it to the Drop Zone and drag image
+ should not be visible.
+ </p>
+ </div>
+ <div id="target" ondragenter="drag_enter(event);" ondrop="drop_handler(event);" ondragover="dragover_handler(event);">
+ Drop Zone
+ </div>
+ <script>
+ var initialDragImage = document.createElement('img')
+ // Blue color image
+ initialDragImage.src = getSolidColorImageBase64('#0000FF')
+ initialDragImage.id = "dragImage"
+ var dragImageDiv = document.getElementById('dragImageDiv')
+ dragImageDiv.appendChild(initialDragImage);
+ </script>
+</body>
+
+</html>