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

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

Issue 1178683007: Introducing ClipboardEvent Constructor Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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-syntheticEvents.html
diff --git a/LayoutTests/fast/events/clipboard-syntheticEvents.html b/LayoutTests/fast/events/clipboard-syntheticEvents.html
new file mode 100644
index 0000000000000000000000000000000000000000..fc83ff3bbece545b3c9c699db9724d4632004585
--- /dev/null
+++ b/LayoutTests/fast/events/clipboard-syntheticEvents.html
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<script src="../../resources/js-test.js"></script>
+<body>
+<div id="divTag" contenteditable='true' onpaste='handlepaste(this,event)' oncopy='handlecopy(this,event)' oncut='handlecut(this,event)'>DefaultText</div>
+
+<script>
+description("Tests clipboard synthetic events");
+
+function handlepaste(elem,e)
+{
+ if(e && e.clipboardData && e.clipboardData.getData) {
+ elem.innerHTML = e.clipboardData.getData('text/plain');
+ }
+}
+
+function handlecopy(elem,e)
+{
+ if(e && e.clipboardData && e.clipboardData.getData) {
+ elem.innerHTML = e.clipboardData.getData('text/plain');
+ }
+}
+
+function handlecut(elem,e)
+{
+ if(e && e.clipboardData && e.clipboardData.getData) {
+ elem.innerHTML = e.clipboardData.getData('text/plain');
+ }
+}
+
+var cutevent = new ClipboardEvent('cut', { data: 'hellodata', dataType: 'text/plain' });
+var copyevent = new ClipboardEvent('copy', { data: 'hellodata', dataType: 'text/plain' });
+var pasteevent = new ClipboardEvent('paste', { data: 'hellodata', dataType: 'text/plain' });
+
+var divtag = document.getElementById("divTag");
+divtag.dispatchEvent(cutevent);
+shouldBeEqualToString("divTag.textContent", "helloData");
+
+divtag.dispatchEvent(copyevent);
+shouldBeEqualToString("divTag.textContent", "helloData");
+
+divtag.dispatchEvent(pasteevent);
+shouldBeEqualToString("divTag.textContent", "helloData");
+
+</script>
+</body>
« no previous file with comments | « no previous file | LayoutTests/fast/events/clipboard-syntheticEvents-expected.txt » ('j') | Source/core/events/ClipboardEvent.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698