Skip to content

Commit

Permalink
Add tests for [[sharePromise]] internal slot
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcos Cáceres authored and marcoscaceres committed Sep 10, 2019
1 parent 07f1195 commit 785685c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions web-share/share-sharePromise-internal-slot.html
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>

0 comments on commit 785685c

Please sign in to comment.