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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../resources/js-test.js"></script>
3 <body>
4 <div id="divTag" contenteditable='true' onpaste='handlepaste(this,event)' oncopy ='handlecopy(this,event)' oncut='handlecut(this,event)'>DefaultText</div>
5
6 <script>
7 description("Tests clipboard synthetic events");
8
9 function handlepaste(elem,e)
10 {
11 if(e && e.clipboardData && e.clipboardData.getData) {
12 elem.innerHTML = e.clipboardData.getData('text/plain');
13 }
14 }
15
16 function handlecopy(elem,e)
17 {
18 if(e && e.clipboardData && e.clipboardData.getData) {
19 elem.innerHTML = e.clipboardData.getData('text/plain');
20 }
21 }
22
23 function handlecut(elem,e)
24 {
25 if(e && e.clipboardData && e.clipboardData.getData) {
26 elem.innerHTML = e.clipboardData.getData('text/plain');
27 }
28 }
29
30 var cutevent = new ClipboardEvent('cut', { data: 'hellodata', dataType: 'text/pl ain' });
31 var copyevent = new ClipboardEvent('copy', { data: 'hellodata', dataType: 'text/ plain' });
32 var pasteevent = new ClipboardEvent('paste', { data: 'hellodata', dataType: 'tex t/plain' });
33
34 var divtag = document.getElementById("divTag");
35 divtag.dispatchEvent(cutevent);
36 shouldBeEqualToString("divTag.textContent", "helloData");
37
38 divtag.dispatchEvent(copyevent);
39 shouldBeEqualToString("divTag.textContent", "helloData");
40
41 divtag.dispatchEvent(pasteevent);
42 shouldBeEqualToString("divTag.textContent", "helloData");
43
44 </script>
45 </body>
OLDNEW
« 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