4 <script src=
"../../resources/js-test.js"></script>
9 event
.preventDefault();
11 testDataTransfer
= event
.clipboardData
;
12 testDataTransfer
.setData('text', 'sample');
13 testDataTransfer
.setData('url', 'http://www.google.com/');
14 testDataTransfer
.setData('text/html', '<em>Markup</em>');
15 testDataTransfer
.setData('custom-data', 'hello world');
17 shouldNotThrow('testDataTransfer.clearData(null)'); // Gets converted to "null" string.
18 shouldNotThrow('testDataTransfer.clearData(undefined)'); // Gets converted to "undefined" string.
20 shouldBeEqualToString('testDataTransfer.getData("text")', 'sample');
21 shouldBeEqualToString('testDataTransfer.getData("url")', 'http://www.google.com/');
22 shouldBeEqualToString('testDataTransfer.getData("text/html")', '<em>Markup</em>');
23 shouldBeEqualToString('testDataTransfer.getData("custom-data")', 'hello world');
25 shouldNotThrow('testDataTransfer.clearData("custom-data")');
26 shouldBeEqualToString('testDataTransfer.getData("text")', 'sample');
27 shouldBeEqualToString('testDataTransfer.getData("url")', 'http://www.google.com/');
28 shouldBeEqualToString('testDataTransfer.getData("text/html")', '<em>Markup</em>');
29 shouldBeEqualToString('testDataTransfer.getData("custom-data")', '');
31 shouldNotThrow('testDataTransfer.clearData()');
32 shouldBeEqualToString('testDataTransfer.getData("text")', '');
33 shouldBeEqualToString('testDataTransfer.getData("url")', '');
34 shouldBeEqualToString('testDataTransfer.getData("text/html")', '');
35 shouldBeEqualToString('testDataTransfer.getData("custom-data")', '');
39 <body oncopy=
"copy(event)">
41 description("Tests clipboard.clearData()");
43 document
.execCommand('copy');