Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / clipboard-clearData.html
blob744bc277a0ac366be557a5e2ebae182a37745b82
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script>
6 var testDataTransfer;
7 function copy(event)
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")', '');
37 </script>
38 </head>
39 <body oncopy="copy(event)">
40 <script>
41 description("Tests clipboard.clearData()");
43 document.execCommand('copy');
44 </script>
45 </body>
46 </html>