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

Side by Side Diff: LayoutTests/fast/events/constructors/composition-event-constructor.html

Issue 85263002: Improve handling of dictionary conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Have conversion methods take a context argument; elaborate error msgs further. Created 7 years 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <script> 7 <script>
8 8
9 description("This tests the constructor for the CompositionEvent DOM class."); 9 description("This tests the constructor for the CompositionEvent DOM class.");
10 10
(...skipping 13 matching lines...) Expand all
24 // cancelable is passed. 24 // cancelable is passed.
25 shouldBe("new CompositionEvent('eventType', { cancelable: false }).cancelable", "false"); 25 shouldBe("new CompositionEvent('eventType', { cancelable: false }).cancelable", "false");
26 shouldBe("new CompositionEvent('eventType', { cancelable: true }).cancelable", " true"); 26 shouldBe("new CompositionEvent('eventType', { cancelable: true }).cancelable", " true");
27 27
28 // view is passed. 28 // view is passed.
29 // Window objects. 29 // Window objects.
30 shouldBe("new CompositionEvent('eventType', { view: window }).view", "window"); 30 shouldBe("new CompositionEvent('eventType', { view: window }).view", "window");
31 shouldBe("new CompositionEvent('eventType', { view: this }).view", "this"); 31 shouldBe("new CompositionEvent('eventType', { view: this }).view", "this");
32 32
33 // Non-window objects. 33 // Non-window objects.
34 shouldBe("new CompositionEvent('eventType', { view: testObject }).view", "null") ; 34 shouldThrow("new CompositionEvent('eventType', { view: testObject }).view");
35 shouldBe("new CompositionEvent('eventType', { view: document }).view", "null"); 35 shouldThrow("new CompositionEvent('eventType', { view: document }).view");
36 shouldBe("new CompositionEvent('eventType', { view: undefined }).view", "null"); 36 shouldBe("new CompositionEvent('eventType', { view: undefined }).view", "null");
37 shouldBe("new CompositionEvent('eventType', { view: null }).view", "null"); 37 shouldBe("new CompositionEvent('eventType', { view: null }).view", "null");
38 shouldBe("new CompositionEvent('eventType', { view: false }).view", "null"); 38 shouldThrow("new CompositionEvent('eventType', { view: false }).view");
39 shouldBe("new CompositionEvent('eventType', { view: true }).view", "null"); 39 shouldThrow("new CompositionEvent('eventType', { view: true }).view");
40 shouldBe("new CompositionEvent('eventType', { view: '' }).view", "null"); 40 shouldThrow("new CompositionEvent('eventType', { view: '' }).view");
41 shouldBe("new CompositionEvent('eventType', { view: 'chocolate' }).view", "null" ); 41 shouldThrow("new CompositionEvent('eventType', { view: 'chocolate' }).view");
42 shouldBe("new CompositionEvent('eventType', { view: 12345 }).view", "null"); 42 shouldThrow("new CompositionEvent('eventType', { view: 12345 }).view");
43 shouldBe("new CompositionEvent('eventType', { view: 18446744073709551615 }).view ", "null"); 43 shouldThrow("new CompositionEvent('eventType', { view: 18446744073709551615 }).v iew");
44 shouldBe("new CompositionEvent('eventType', { view: NaN }).view", "null"); 44 shouldThrow("new CompositionEvent('eventType', { view: NaN }).view");
45 // Note that valueOf() is not called, when the left hand side is evaluated. 45 // Note that valueOf() is not called, when the left hand side is evaluated.
46 shouldBeFalse("new CompositionEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window"); 46 shouldThrow("new CompositionEvent('eventType', { view: {valueOf: function () { r eturn window; } } }).view == window");
47 shouldBe("new CompositionEvent('eventType', { get view() { return 123; } }).view ", "null"); 47 shouldBe("new CompositionEvent('eventType', { get view() { return window; } }).v iew", "window");
48 shouldThrow("new CompositionEvent('eventType', { get view() { return 123; } }).v iew");
48 shouldThrow("new CompositionEvent('eventType', { get view() { throw 'Composition Event Error'; } })"); 49 shouldThrow("new CompositionEvent('eventType', { get view() { throw 'Composition Event Error'; } })");
49 50
50 // data is passed. 51 // data is passed.
51 // Strings. 52 // Strings.
52 shouldBeEqualToString("new CompositionEvent('eventType', { data: 'koakuma' }).da ta", "koakuma"); 53 shouldBeEqualToString("new CompositionEvent('eventType', { data: 'koakuma' }).da ta", "koakuma");
53 shouldBeEqualToString("new CompositionEvent('eventType', { data: '' }).data", "" ); 54 shouldBeEqualToString("new CompositionEvent('eventType', { data: '' }).data", "" );
54 55
55 // Non-strings. 56 // Non-strings.
56 shouldBeEqualToString("new CompositionEvent('eventType', { data: undefined }).da ta", "undefined"); 57 shouldBeEqualToString("new CompositionEvent('eventType', { data: undefined }).da ta", "undefined");
57 shouldBeEqualToString("new CompositionEvent('eventType', { data: null }).data", "null"); 58 shouldBeEqualToString("new CompositionEvent('eventType', { data: null }).data", "null");
58 shouldBeEqualToString("new CompositionEvent('eventType', { data: false }).data", "false"); 59 shouldBeEqualToString("new CompositionEvent('eventType', { data: false }).data", "false");
59 shouldBeEqualToString("new CompositionEvent('eventType', { data: true }).data", "true"); 60 shouldBeEqualToString("new CompositionEvent('eventType', { data: true }).data", "true");
60 shouldBeEqualToString("new CompositionEvent('eventType', { data: 12345 }).data", "12345"); 61 shouldBeEqualToString("new CompositionEvent('eventType', { data: 12345 }).data", "12345");
61 shouldBeEqualToString("new CompositionEvent('eventType', { data: 184467440737095 51615 }).data", "18446744073709552000"); 62 shouldBeEqualToString("new CompositionEvent('eventType', { data: 184467440737095 51615 }).data", "18446744073709552000");
62 shouldBeEqualToString("new CompositionEvent('eventType', { data: NaN }).data", " NaN"); 63 shouldBeEqualToString("new CompositionEvent('eventType', { data: NaN }).data", " NaN");
63 shouldBeEqualToString("new CompositionEvent('eventType', { data: [] }).data", "" ); 64 shouldBeEqualToString("new CompositionEvent('eventType', { data: [] }).data", "" );
64 shouldBeEqualToString("new CompositionEvent('eventType', { data: [1, 2, 3] }).da ta", "1,2,3"); 65 shouldBeEqualToString("new CompositionEvent('eventType', { data: [1, 2, 3] }).da ta", "1,2,3");
65 shouldBeEqualToString("new CompositionEvent('eventType', { data: {koakuma: 12345 } }).data", "[object Object]"); 66 shouldBeEqualToString("new CompositionEvent('eventType', { data: {koakuma: 12345 } }).data", "[object Object]");
66 shouldBeEqualToString("new CompositionEvent('eventType', { data: {valueOf: funct ion () { return 'koakuma'; } } }).data", "[object Object]"); 67 shouldBeEqualToString("new CompositionEvent('eventType', { data: {valueOf: funct ion () { return 'koakuma'; } } }).data", "[object Object]");
67 68
68 // All initializers are passed. 69 // All initializers are passed.
69 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).bubbles", "true"); 70 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).bubbles", "true");
70 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).cancelable", "true"); 71 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).cancelable", "true");
71 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).view", "window"); 72 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).view", "window");
72 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).detail", "111"); 73 shouldBe("new CompositionEvent('eventType', { bubbles: true, cancelable: true, v iew: window, detail: 111, data: 'koakuma' }).detail", "111");
73 shouldBeEqualToString("new CompositionEvent('eventType', { bubbles: true, cancel able: true, view: window, detail: 111, data: 'koakuma' }).data", "koakuma"); 74 shouldBeEqualToString("new CompositionEvent('eventType', { bubbles: true, cancel able: true, view: window, detail: 111, data: 'koakuma' }).data", "koakuma");
74 </script> 75 </script>
75 </body> 76 </body>
76 </html> 77 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698