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

Side by Side Diff: LayoutTests/fast/events/constructors/keyboard-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 KeyboardEvent DOM class."); 9 description("This tests the constructor for the KeyboardEvent DOM class.");
10 10
(...skipping 19 matching lines...) Expand all
30 // cancelable is passed. 30 // cancelable is passed.
31 shouldBe("new KeyboardEvent('eventType', { cancelable: false }).cancelable", "fa lse"); 31 shouldBe("new KeyboardEvent('eventType', { cancelable: false }).cancelable", "fa lse");
32 shouldBe("new KeyboardEvent('eventType', { cancelable: true }).cancelable", "tru e"); 32 shouldBe("new KeyboardEvent('eventType', { cancelable: true }).cancelable", "tru e");
33 33
34 // view is passed. 34 // view is passed.
35 // Window objects. 35 // Window objects.
36 shouldBe("new KeyboardEvent('eventType', { view: window }).view", "window"); 36 shouldBe("new KeyboardEvent('eventType', { view: window }).view", "window");
37 shouldBe("new KeyboardEvent('eventType', { view: this }).view", "this"); 37 shouldBe("new KeyboardEvent('eventType', { view: this }).view", "this");
38 38
39 // Non-window objects. 39 // Non-window objects.
40 shouldBe("new KeyboardEvent('eventType', { view: testObject }).view", "null"); 40 shouldThrow("new KeyboardEvent('eventType', { view: testObject }).view");
41 shouldBe("new KeyboardEvent('eventType', { view: document }).view", "null"); 41 shouldThrow("new KeyboardEvent('eventType', { view: document }).view");
42 shouldBe("new KeyboardEvent('eventType', { view: undefined }).view", "null"); 42 shouldBe("new KeyboardEvent('eventType', { view: undefined }).view", "null");
43 shouldBe("new KeyboardEvent('eventType', { view: null }).view", "null"); 43 shouldBe("new KeyboardEvent('eventType', { view: null }).view", "null");
44 shouldBe("new KeyboardEvent('eventType', { view: false }).view", "null"); 44 shouldThrow("new KeyboardEvent('eventType', { view: false }).view");
45 shouldBe("new KeyboardEvent('eventType', { view: true }).view", "null"); 45 shouldThrow("new KeyboardEvent('eventType', { view: true }).view");
46 shouldBe("new KeyboardEvent('eventType', { view: '' }).view", "null"); 46 shouldThrow("new KeyboardEvent('eventType', { view: '' }).view");
47 shouldBe("new KeyboardEvent('eventType', { view: 'chocolate' }).view", "null"); 47 shouldThrow("new KeyboardEvent('eventType', { view: 'chocolate' }).view");
48 shouldBe("new KeyboardEvent('eventType', { view: 12345 }).view", "null"); 48 shouldThrow("new KeyboardEvent('eventType', { view: 12345 }).view");
49 shouldBe("new KeyboardEvent('eventType', { view: 18446744073709551615 }).view", "null"); 49 shouldThrow("new KeyboardEvent('eventType', { view: 18446744073709551615 }).view ");
50 shouldBe("new KeyboardEvent('eventType', { view: NaN }).view", "null"); 50 shouldThrow("new KeyboardEvent('eventType', { view: NaN }).view");
51 // Note that valueOf() is not called, when the left hand side is evaluated. 51 // Note that valueOf() is not called, when the left hand side is evaluated.
52 shouldBeFalse("new KeyboardEvent('eventType', { view: {valueOf: function () { re turn window; } } }).view == window"); 52 shouldThrow("new KeyboardEvent('eventType', { view: {valueOf: function () { retu rn window; } } }).view == window");
53 shouldBe("new KeyboardEvent('eventType', { get view() { return 123; } }).view", "null"); 53 shouldBe("new KeyboardEvent('eventType', { get view() { return window; } }).view ", "window");
54 shouldThrow("new KeyboardEvent('eventType', { get view() { return 123; } }).view ");
54 shouldThrow("new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } })"); 55 shouldThrow("new KeyboardEvent('eventType', { get view() { throw 'KeyboardEvent Error'; } })");
55 56
56 // keyIdentifier is passed. 57 // keyIdentifier is passed.
57 // Strings. 58 // Strings.
58 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier", "koakuma"); 59 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 'koakuma' }).keyIdentifier", "koakuma");
59 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: '' }).key Identifier", ""); 60 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: '' }).key Identifier", "");
60 61
61 // Non-strings. 62 // Non-strings.
62 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier", "undefined"); 63 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: undefined }).keyIdentifier", "undefined");
63 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: null }).k eyIdentifier", "null"); 64 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: null }).k eyIdentifier", "null");
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl e: true, view: window, detail: 111, keyIdentifier: 'chocolate', location: 222, c trlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).keyId entifier", "chocolate"); 123 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl e: true, view: window, detail: 111, keyIdentifier: 'chocolate', location: 222, c trlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).keyId entifier", "chocolate");
123 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).location", "222"); 124 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).location", "222");
124 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).ctrlKey", "true"); 125 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).ctrlKey", "true");
125 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).altKey", "true"); 126 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).altKey", "true");
126 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).shiftKey", "true") ; 127 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).shiftKey", "true") ;
127 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).metaKey", "true"); 128 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).metaKey", "true");
128 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).repeat", "true"); 129 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, repeat: true }).repeat", "true");
129 </script> 130 </script>
130 </body> 131 </body>
131 </html> 132 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698