Skip to content

Commit 785685c

Browse files
Marcos Cáceresmarcoscaceres
authored andcommitted
Add tests for [[sharePromise]] internal slot
1 parent 07f1195 commit 785685c

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<link rel="help" href="https://github.com/w3c/web-share/pull/113" />
6+
<title>WebShare Test: only one share at a time</title>
7+
<script src="/resources/testharness.js"></script>
8+
<script src="/resources/testharnessreport.js"></script>
9+
<script src="/resources/testdriver.js"></script>
10+
<script src="/resources/testdriver-vendor.js"></script>
11+
</head>
12+
<body>
13+
<script>
14+
promise_test(async t => {
15+
const [, promise2, promise3] = await test_driver.bless(
16+
"share needs user activation",
17+
() => {
18+
return [
19+
navigator.share({ title: "should be pending" }),
20+
navigator.share({ title: "should reject" }),
21+
navigator.share({ title: "should also reject" }),
22+
];
23+
}
24+
);
25+
await Promise.all([
26+
promise_rejects(t, "InvalidStateError", promise2),
27+
promise_rejects(t, "InvalidStateError", promise3),
28+
]);
29+
}, "Only allow one share call at a time, which is controlled by the [[sharePromise]] internal slot.");
30+
</script>
31+
</body>
32+
</html>

0 commit comments

Comments
 (0)