Skip to content

Commit

Permalink
UIEvents: Tentative test for textInput with drag and drop
Browse files Browse the repository at this point in the history
  • Loading branch information
zcorpan committed Feb 23, 2024
1 parent 97c6a6a commit 7979639
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
27 changes: 27 additions & 0 deletions html/editing/dnd/drop/events-contenteditable.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<!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>
<style>
[data-placeholder]:empty::before { content: attr(data-placeholder); }
</style>
<div><input id=a value="Drag me"></div>
<div contenteditable=true id=b data-placeholder="...to here"></div>
<script>
setup({ explicit_timeout: true, single_test: true });
const a = document.getElementById('a');
const b = document.getElementById('b');
const actualEvents = [];
const expectedEvents = ['drop', 'beforeinput', 'textInput', 'input'];
for (const eventType of expectedEvents) {
b.addEventListener(eventType, e => {
actualEvents.push(e.type);
if (actualEvents.length === expectedEvents.length) {
assert_array_equals(actualEvents, expectedEvents);
done();
}
});
}
a.select();
</script>
24 changes: 24 additions & 0 deletions html/editing/dnd/drop/events-input.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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>
<div><input id=a value="Drag me"></div>
<div><input id=b placeholder="...to here"></div>
<script>
setup({ explicit_timeout: true, single_test: true });
const a = document.getElementById('a');
const b = document.getElementById('b');
const actualEvents = [];
const expectedEvents = ['drop', 'beforeinput', 'textInput', 'input'];
for (const eventType of expectedEvents) {
b.addEventListener(eventType, e => {
actualEvents.push(e.type);
if (actualEvents.length === expectedEvents.length) {
assert_array_equals(actualEvents, expectedEvents);
done();
}
});
}
a.select();
</script>
24 changes: 24 additions & 0 deletions html/editing/dnd/drop/events-textarea.tentative.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!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>
<div><input id=a value="Drag me"></div>
<div><textarea id=b placeholder="...to here"></textarea></div>
<script>
setup({ explicit_timeout: true, single_test: true });
const a = document.getElementById('a');
const b = document.getElementById('b');
const actualEvents = [];
const expectedEvents = ['drop', 'beforeinput', 'textInput', 'input'];
for (const eventType of expectedEvents) {
b.addEventListener(eventType, e => {
actualEvents.push(e.type);
if (actualEvents.length === expectedEvents.length) {
assert_array_equals(actualEvents, expectedEvents);
done();
}
});
}
a.select();
</script>

0 comments on commit 7979639

Please sign in to comment.