Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Async Clipboard API] Add supports method to async clipboard API. #41993

Merged
merged 1 commit into from
Oct 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions clipboard-apis/clipboard-item.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,18 @@
const text = await (new Response(blob)).text();
assert_equals(text, 'xxx');
}, "getType(DOMString invalid type) converts DOMString to Blob");

promise_test(async () => {
assert_true(ClipboardItem.supports('text/plain'));
assert_true(ClipboardItem.supports('text/html'));
assert_true(ClipboardItem.supports('image/png'));
assert_false(ClipboardItem.supports('web '));
assert_false(ClipboardItem.supports('web')); // without space.
assert_false(ClipboardItem.supports('web foo'));
assert_false(ClipboardItem.supports('foo/bar'));
assert_true(ClipboardItem.supports('web foo/bar'));
assert_true(ClipboardItem.supports('web text/html'));
assert_false(ClipboardItem.supports('image/svg+xml'));
assert_false(ClipboardItem.supports('not a/real type'));
}, "supports(DOMString) returns true for types that are supported, false otherwise");
</script>