OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../js/resources/js-test-pre.js"></script> |
| 5 <script> |
| 6 var testDataTransfer; |
| 7 function copy(event) |
| 8 { |
| 9 event.preventDefault(); |
| 10 |
| 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'); |
| 16 |
| 17 shouldNotThrow('testDataTransfer.clearData(null)'); // Gets converted to "nu
ll" string. |
| 18 shouldNotThrow('testDataTransfer.clearData(undefined)'); // Gets converted t
o "undefined" string. |
| 19 |
| 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 worl
d'); |
| 24 |
| 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")', ''); |
| 30 |
| 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")', ''); |
| 36 } |
| 37 </script> |
| 38 </head> |
| 39 <body oncopy="copy(event)"> |
| 40 <script> |
| 41 description("Tests clipboard.clearData()"); |
| 42 |
| 43 document.execCommand('copy'); |
| 44 </script> |
| 45 <script src="../js/resources/js-test-post.js"></script> |
| 46 </body> |
| 47 </html> |
OLD | NEW |