Index: LayoutTests/fast/events/clipboard-clearData.html |
diff --git a/LayoutTests/fast/events/clipboard-clearData.html b/LayoutTests/fast/events/clipboard-clearData.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..84d1352418ad1499f32e0504d9ccbf00aa787547 |
--- /dev/null |
+++ b/LayoutTests/fast/events/clipboard-clearData.html |
@@ -0,0 +1,47 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../js/resources/js-test-pre.js"></script> |
+<script> |
+var testDataTransfer; |
+function copy(event) |
+{ |
+ event.preventDefault(); |
+ |
+ testDataTransfer = event.clipboardData; |
+ testDataTransfer.setData('text', 'sample'); |
+ testDataTransfer.setData('url', 'http://www.google.com/'); |
+ testDataTransfer.setData('text/html', '<em>Markup</em>'); |
+ testDataTransfer.setData('custom-data', 'hello world'); |
+ |
+ shouldNotThrow('testDataTransfer.clearData(null)'); // Gets converted to "null" string. |
+ shouldNotThrow('testDataTransfer.clearData(undefined)'); // Gets converted to "undefined" string. |
+ |
+ shouldBeEqualToString('testDataTransfer.getData("text")', 'sample'); |
+ shouldBeEqualToString('testDataTransfer.getData("url")', 'http://www.google.com/'); |
+ shouldBeEqualToString('testDataTransfer.getData("text/html")', '<em>Markup</em>'); |
+ shouldBeEqualToString('testDataTransfer.getData("custom-data")', 'hello world'); |
+ |
+ shouldNotThrow('testDataTransfer.clearData("custom-data")'); |
+ shouldBeEqualToString('testDataTransfer.getData("text")', 'sample'); |
+ shouldBeEqualToString('testDataTransfer.getData("url")', 'http://www.google.com/'); |
+ shouldBeEqualToString('testDataTransfer.getData("text/html")', '<em>Markup</em>'); |
+ shouldBeEqualToString('testDataTransfer.getData("custom-data")', ''); |
+ |
+ shouldNotThrow('testDataTransfer.clearData()'); |
+ shouldBeEqualToString('testDataTransfer.getData("text")', ''); |
+ shouldBeEqualToString('testDataTransfer.getData("url")', ''); |
+ shouldBeEqualToString('testDataTransfer.getData("text/html")', ''); |
+ shouldBeEqualToString('testDataTransfer.getData("custom-data")', ''); |
+} |
+</script> |
+</head> |
+<body oncopy="copy(event)"> |
+<script> |
+description("Tests clipboard.clearData()"); |
+ |
+document.execCommand('copy'); |
+</script> |
+<script src="../js/resources/js-test-post.js"></script> |
+</body> |
+</html> |