forked from kdashg/gecko-cinn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1881760 [wpt PR 44744] - UIEvents: Tentative test for textInput w…
…ith drag and drop, a=testonly Automatic update from web-platform-tests UIEvents: Tentative test for textInput with drag and drop See w3c/uievents#367 -- wpt-commits: ee2fe53bf4b960b90a072d65a57b56b797a61289 wpt-pr: 44744
- Loading branch information
1 parent
b845676
commit 4e4fbaf
Showing
7 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
...ing/web-platform/tests/html/editing/dnd/drop/events-contenteditable-manual.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
15 changes: 15 additions & 0 deletions
15
...orm/tests/html/editing/dnd/drop/events-contenteditable-same-element-manual.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
16 changes: 16 additions & 0 deletions
16
testing/web-platform/tests/html/editing/dnd/drop/events-input-manual.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Selection drag and drop: events for <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> |
15 changes: 15 additions & 0 deletions
15
.../web-platform/tests/html/editing/dnd/drop/events-input-same-element-manual.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Selection drag and drop: events for <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> |
16 changes: 16 additions & 0 deletions
16
testing/web-platform/tests/html/editing/dnd/drop/events-textarea-manual.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Selection drag and drop: events for <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> |
15 changes: 15 additions & 0 deletions
15
...b-platform/tests/html/editing/dnd/drop/events-textarea-same-element-manual.tentative.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!doctype html> | ||
<meta charset=utf-8> | ||
<title>Selection drag and drop: events for <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> |
31 changes: 31 additions & 0 deletions
31
testing/web-platform/tests/html/editing/dnd/drop/support/events.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); |