Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(102)

Unified Diff: LayoutTests/fast/events/clipboard-clearData.html

Issue 26023003: Get rid of custom code for clipboard.clearData() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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>
« no previous file with comments | « no previous file | LayoutTests/fast/events/clipboard-clearData-expected.txt » ('j') | Source/core/dom/Clipboard.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698