-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1733575 [wpt PR 30777] - Added WPTs for user-activation from keyp…
…ress and keyup events., a=testonly Automatic update from web-platform-tests Added WPTs for user-activation from keypress and keyup events. These tests are for the following HTML PR: whatwg/html#6818 Also renamed the existing click event test for consistency. Change-Id: If77750f4159828b68bd91a4b48f46606421b7df6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3159551 Reviewed-by: Robert Flack <flackr@chromium.org> Commit-Queue: Mustaq Ahmed <mustaq@chromium.org> Cr-Commit-Position: refs/heads/main@{#926812} -- wpt-commits: aa4a6c240131c34425819ecd981423332f9028f0 wpt-pr: 30777
- Loading branch information
1 parent
7e92cee
commit 82404bf
Showing
4 changed files
with
85 additions
and
30 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
testing/web-platform/tests/html/user-activation/activation-trigger-click.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,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="resources/utils.js"></script> | ||
</head> | ||
<body> | ||
<h1>Test for click activation trigger</h1> | ||
<p>Tests that a popup is allowed with user activation from a click event.</p> | ||
<ol id="instructions"> | ||
<li>Click anywhere in the document. | ||
</ol> | ||
<script> | ||
promise_test(async () => { | ||
test_driver.click(document.body); | ||
await getEvent('click'); | ||
let consumed = await consumeTransientActivation(); | ||
assert_true(consumed, "click event should result in activation"); | ||
}, "Activation through mouse event"); | ||
</script> | ||
</body> | ||
</html> |
36 changes: 36 additions & 0 deletions
36
testing/web-platform/tests/html/user-activation/activation-trigger-keypress.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,36 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="/resources/testdriver.js"></script> | ||
<script src="/resources/testdriver-vendor.js"></script> | ||
<script src="resources/utils.js"></script> | ||
</head> | ||
<body> | ||
<h1>Test for keypress activation trigger</h1> | ||
<p>Tests that a popup is allowed with user activation from a keypress event.</p> | ||
<input type="text" autofocus /> | ||
<ol id="instructions"> | ||
<li>Press ENTER key. | ||
</ol> | ||
<script> | ||
promise_test(async () => { | ||
const ENTER_KEY = '\uE007'; | ||
test_driver.send_keys(document.body, ENTER_KEY); | ||
|
||
let keyup_event = getEvent('keyup'); | ||
|
||
await getEvent('keypress'); | ||
let consumed = await consumeTransientActivation(); | ||
assert_true(consumed, | ||
"ENTER keypress event should result in activation"); | ||
|
||
await keyup_event; | ||
consumed = await consumeTransientActivation(); | ||
assert_false(consumed, | ||
"ENTER keyup should have no activation after keypress consumption"); | ||
}, "Activation through keyboard event"); | ||
</script> | ||
</body> | ||
</html> |
30 changes: 0 additions & 30 deletions
30
testing/web-platform/tests/html/user-activation/basic.html
This file was deleted.
Oops, something went wrong.
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