Skip to content

Commit 8dacfae

Browse files
committed
Bug 1841545 [wpt PR 40861] - Account that send_keys throws different exceptions in inert test, a=testonly
Automatic update from web-platform-tests Account that send_keys throws different exceptions in inert test (#40861) #40774 made it so send_keys no longer throws in non-interactive nodes, however it still throws for a different reason. Use test_driver actions and stop checking that an exception is thrown. The value assert below is enough to check that the field is not editable. -- wpt-commits: 9150c19f5e6af10b1487d177779cceaf30f33d96 wpt-pr: 40861 UltraBlame original commit: 639ba1e0792736f8f9f79e2a835f0577dabd8186
1 parent b4f5455 commit 8dacfae

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

testing/web-platform/tests/inert/inert-node-is-uneditable.html

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<script src="/resources/testharness.js"></script>
88
<script src="/resources/testharnessreport.js"></script>
99
<script src="/resources/testdriver.js"></script>
10+
<script src="/resources/testdriver-actions.js"></script>
1011
<script src="/resources/testdriver-vendor.js"></script>
1112
</head>
1213
<body>
@@ -16,23 +17,26 @@
1617
var notEditable = document.querySelector('#not-editable');
1718
var editable = document.querySelector('#editable');
1819

20+
function sendKey(key) {
21+
return new test_driver.Actions()
22+
.keyDown(key)
23+
.keyUp(key)
24+
.send();
25+
}
26+
1927
promise_test(async function() {
2028
notEditable.focus();
2129
var oldValue = notEditable.textContent;
2230
assert_equals(oldValue, "I'm not editable.");
23-
await promise_rejects_js(
24-
this,
25-
Error,
26-
test_driver.send_keys(notEditable, 'a'),
27-
"send_keys should reject for non-interactive elements");
31+
await sendKey('a');
2832
assert_equals(notEditable.textContent, oldValue);
2933
}, "Can't edit inert contenteditable");
3034

3135
promise_test(async () => {
3236
editable.focus();
3337
var oldValue = editable.textContent;
3438
assert_equals(oldValue, "I'm editable.");
35-
await test_driver.send_keys(editable, 'a');
39+
await sendKey('a');
3640
assert_not_equals(editable.textContent, oldValue);
3741
}, "Can edit non-inert contenteditable");
3842

0 commit comments

Comments
 (0)