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> |