blob: c8c0593a988066decebb1420c7994ee224d5587c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
<!doctype html>
<title>The copy event</title>
<link rel="help" href="https://w3c.github.io/clipboard-apis/#clipboard-event-copy">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<div id=log></div>
<button id="copy">Trigger copy</button>
<input id="copyTarget" value="this text should be copied">
<script>
async_test(t => {
let button = document.getElementById("copy");
button.addEventListener("click", function(e) {
let input = document.getElementById("copyTarget");
input.focus();
input.select();
document.execCommand("copy");
});
document.oncopy = t.step_func_done(event => {
// Nothing can be asserted about the event target until
// https://github.com/w3c/clipboard-apis/issues/70 is resolved.
// assert_equals(event.target, document.body, 'event.target');
assert_true(event.isTrusted, 'event.isTrusted');
assert_true(event.composed, 'event.composed');
});
test_driver.click(button);
});
</script>
|