-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for [[sharePromise]] internal slot
- Loading branch information
1 parent
07f1195
commit 785685c
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
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,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<link rel="help" href="https://github.com/w3c/web-share/pull/113" /> | ||
<title>WebShare Test: only one share at a time</title> | ||
<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> | ||
</head> | ||
<body> | ||
<script> | ||
promise_test(async t => { | ||
const [, promise2, promise3] = await test_driver.bless( | ||
"share needs user activation", | ||
() => { | ||
return [ | ||
navigator.share({ title: "should be pending" }), | ||
navigator.share({ title: "should reject" }), | ||
navigator.share({ title: "should also reject" }), | ||
]; | ||
} | ||
); | ||
await Promise.all([ | ||
promise_rejects(t, "InvalidStateError", promise2), | ||
promise_rejects(t, "InvalidStateError", promise3), | ||
]); | ||
}, "Only allow one share call at a time, which is controlled by the [[sharePromise]] internal slot."); | ||
</script> | ||
</body> | ||
</html> |