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

Side by Side Diff: LayoutTests/fast/events/constructors/clipboard-event-constructor.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
« no previous file with comments | « no previous file | LayoutTests/fast/events/constructors/clipboard-event-constructor-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/js-test.js"></script>
3 <body>
4 <div id="divTag">DefaultText</div>
5 <script>
6 description("This tests the constructor for the ClipboardEvent DOM class.");
7
8 //No Initializer is passed
9 shouldBe("new ClipboardEvent('eventType').bubbles", "false");
10 shouldBe("new ClipboardEvent('eventType').cancelable", "false");
11
12 // bubbles is passed.
13 shouldBe("new ClipboardEvent('eventType', { bubbles: false }).bubbles", "false") ;
14 shouldBe("new ClipboardEvent('eventType', { bubbles: true }).bubbles", "true");
15
16 // cancelable is passed.
17 shouldBe("new ClipboardEvent('eventType', { cancelable: false }).cancelable", "f alse");
18 shouldBe("new ClipboardEvent('eventType', { cancelable: true }).cancelable", "tr ue");
19
20 //text data is passed
21 shouldBeEqualToString("new ClipboardEvent('cut', { data: 'hellodata', dataType: 'text' }).clipboardData.getData('text')", "hellodata");
22 shouldBeEqualToString("new ClipboardEvent('copy', { data: 'hellodata', dataType: 'text' }).clipboardData.getData('text')", "hellodata");
23 shouldBeEqualToString("new ClipboardEvent('paste', { data: 'hellodata', dataType : 'text' }).clipboardData.getData('text')", "hellodata");
24
25 //url data is passed
26 shouldBeEqualToString("new ClipboardEvent('cut', { data: 'http://www.google.com/ ', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/");
27 shouldBeEqualToString("new ClipboardEvent('copy', { data: 'http://www.google.com /', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/");
28 shouldBeEqualToString("new ClipboardEvent('paste', { data: 'http://www.google.co m/', dataType: 'url' }).clipboardData.getData('url')", "http://www.google.com/") ;
29
30 //html data is passed
31 shouldBeEqualToString("new ClipboardEvent('cut', { data: '<em>Markup</em>', data Type: 'html' }).clipboardData.getData('html')", "<em>Markup</em>");
32 shouldBeEqualToString("new ClipboardEvent('copy', { data: '<em>Markup</em>', dat aType: 'html' }).clipboardData.getData('html')", "<em>Markup</em>");
33 shouldBeEqualToString("new ClipboardEvent('paste', { data: '<em>Markup</em>', da taType: 'html' }).clipboardData.getData('html')", "<em>Markup</em>");
34
35 //no dataType is passed
36 shouldBeEqualToString("new ClipboardEvent('copy', { data: '<em>Markup</em>'}).cl ipboardData.getData('html')", "");
37 shouldBeEqualToString("new ClipboardEvent('copy', { data: '<em>Markup</em>'}).cl ipboardData.getData('html')", "");
38
39 // Non-strings.
40 shouldBeEqualToString("new ClipboardEvent('copy', { data: undefined, dataType: ' text' }).clipboardData.getData('text')", "");
41 shouldBeEqualToString("new ClipboardEvent('copy', { data: null, dataType: 'text' }).clipboardData.getData('text')", "null");
42 shouldBeEqualToString("new ClipboardEvent('copy', { data: false, dataType: 'text ' }).clipboardData.getData('text')", "false");
43 shouldBeEqualToString("new ClipboardEvent('copy', { data: true, dataType: 'text' }).clipboardData.getData('text')", "true");
44 shouldBeEqualToString("new ClipboardEvent('copy', { data: 12345, dataType: 'text ' }).clipboardData.getData('text')", "12345");
45 shouldBeEqualToString("new ClipboardEvent('copy', { data: 18446744073709551615, dataType: 'text' }).clipboardData.getData('text')", "18446744073709552000");
46 shouldBeEqualToString("new ClipboardEvent('copy', { data: NaN, dataType: 'text' }).clipboardData.getData('text')", "NaN");
47 shouldBeEqualToString("new ClipboardEvent('copy', { data: [], dataType: 'text' } ).clipboardData.getData('text')", "");
48 shouldBeEqualToString("new ClipboardEvent('copy', { data: [1, 2, 3], dataType: ' text' }).clipboardData.getData('text')", "1,2,3");
49
50 // All initializers are passed.
51 shouldBe("new ClipboardEvent('eventType', { bubbles: true, cancelable: true, dat a: 'http://www.google.com/', dataType: 'url' }).bubbles", "true");
52 shouldBe("new ClipboardEvent('eventType', { bubbles: true, cancelable: true, dat a: 'http://www.google.com/', dataType: 'url' }).cancelable", "true");
53 shouldBeEqualToString("new ClipboardEvent('copy', { bubbles: true, cancelable: t rue, data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('u rl')", "http://www.google.com/");
54
55 //invalid eventType
56 shouldBeEqualToString("new ClipboardEvent('invalid', { bubbles: true, cancelable : true, data: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData ('url')", "");
57 //no eventType specified
58 shouldBeEqualToString("new ClipboardEvent({ bubbles: true, cancelable: true, dat a: 'http://www.google.com/', dataType: 'url' }).clipboardData.getData('url')", " ");
59
60 var event = new ClipboardEvent('paste', { data: 'hellodata', dataType: 'text' }) ;
61 var divtag = document.getElementById("divTag");
62 divtag.dispatchEvent(event);
63 shouldBeEqualToString("divTag.textContent", "DefaultText");
dcheng 2015/06/17 03:00:14 Without a paste handler, this won't change (divs a
64
65 </script>
66 </body>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/events/constructors/clipboard-event-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698