Skip to content

Commit

Permalink
Bug 1860922 [wpt PR 41993] - [Async Clipboard API] Add supports metho…
Browse files Browse the repository at this point in the history
…d to async clipboard API., a=testonly

Automatic update from web-platform-tests
[Async Clipboard API] Add supports method to async clipboard API.

In this change we are adding a new static method `supports` to the
ClipboardItem interface to help web authors detect clipboard format
types that are supported by Chromium.
Github Issue: w3c/clipboard-apis#170
Spec: w3c/clipboard-apis#192
w3c/clipboard-apis#195
I2S: https://groups.google.com/a/chromium.org/g/blink-dev/c/pjpN9Lwv5Tk/m/KrAZRbdwAQAJ?utm_medium=email&utm_source=footer&pli=1

Bug: 1483026, 1490635

Change-Id: Ief7c0786833548d2fb51215cefbc39e5930af875
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4865377
Reviewed-by: Kent Tamura <tkentchromium.org>
Commit-Queue: Anupam Snigdha <snianumicrosoft.com>
Reviewed-by: Evan Stade <estadechromium.org>
Cr-Commit-Position: refs/heads/main{#1214477}

--

wpt-commits: d1bd5741a6ec790fbec6e6d69158178d26f65269
wpt-pr: 41993

UltraBlame original commit: 1603ba63e55624bd159b523ea1c7430df469e647
  • Loading branch information
marco-c committed Nov 8, 2023
1 parent 583bd36 commit 8e556be
Showing 1 changed file with 14 additions and 0 deletions.
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>

0 comments on commit 8e556be

Please sign in to comment.