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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor.html

Issue 1471883003: Added code and key to KeyboardEventInit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make code/key RuntimeEnabled Created 5 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-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
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 <script src="../resources/input-modifiers.js"></script> 5 <script src="../resources/input-modifiers.js"></script>
6 </head> 6 </head>
7 <body> 7 <body>
8 <script> 8 <script>
9 9
10 description("This tests the constructor for the KeyboardEvent DOM class."); 10 description("This tests the constructor for the KeyboardEvent DOM class.");
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: false }). keyIdentifier", "false"); 66 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: false }). keyIdentifier", "false");
67 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: true }).k eyIdentifier", "true"); 67 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: true }).k eyIdentifier", "true");
68 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 12345 }). keyIdentifier", "12345"); 68 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 12345 }). keyIdentifier", "12345");
69 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 184467440 73709551615 }).keyIdentifier", "18446744073709552000"); 69 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: 184467440 73709551615 }).keyIdentifier", "18446744073709552000");
70 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: NaN }).ke yIdentifier", "NaN"); 70 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: NaN }).ke yIdentifier", "NaN");
71 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [] }).key Identifier", ""); 71 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [] }).key Identifier", "");
72 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [1, 2, 3] }).keyIdentifier", "1,2,3"); 72 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [1, 2, 3] }).keyIdentifier", "1,2,3");
73 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {koakuma: 12345} }).keyIdentifier", "[object Object]"); 73 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {koakuma: 12345} }).keyIdentifier", "[object Object]");
74 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {valueOf: function () { return 'koakuma'; } } }).keyIdentifier", "[object Object]"); 74 shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {valueOf: function () { return 'koakuma'; } } }).keyIdentifier", "[object Object]");
75 75
76 // code is passed.
77 // Strings.
78 shouldBeEqualToString("new KeyboardEvent('eventType', { code: 'koakuma' }).code" , "koakuma");
79 shouldBeEqualToString("new KeyboardEvent('eventType', { code: '' }).code", "");
80
81 // Non-strings.
82 shouldBeEqualToString("new KeyboardEvent('eventType', { code: undefined }).code" , "");
83 shouldBeEqualToString("new KeyboardEvent('eventType', { code: null }).code", "nu ll");
84 shouldBeEqualToString("new KeyboardEvent('eventType', { code: false }).code", "f alse");
85 shouldBeEqualToString("new KeyboardEvent('eventType', { code: true }).code", "tr ue");
86 shouldBeEqualToString("new KeyboardEvent('eventType', { code: 12345 }).code", "1 2345");
87 shouldBeEqualToString("new KeyboardEvent('eventType', { code: 184467440737095516 15 }).code", "18446744073709552000");
88 shouldBeEqualToString("new KeyboardEvent('eventType', { code: NaN }).code", "NaN ");
89 shouldBeEqualToString("new KeyboardEvent('eventType', { code: [] }).code", "");
90 shouldBeEqualToString("new KeyboardEvent('eventType', { code: [1, 2, 3] }).code" , "1,2,3");
91 shouldBeEqualToString("new KeyboardEvent('eventType', { code: {koakuma: 12345} } ).code", "[object Object]");
92 shouldBeEqualToString("new KeyboardEvent('eventType', { code: {valueOf: function () { return 'koakuma'; } } }).code", "[object Object]");
93
94 // key is passed.
95 // Strings.
96 shouldBeEqualToString("new KeyboardEvent('eventType', { key: 'koakuma' }).key", "koakuma");
97 shouldBeEqualToString("new KeyboardEvent('eventType', { key: '' }).key", "");
98
99 // Non-strings.
100 shouldBeEqualToString("new KeyboardEvent('eventType', { key: undefined }).key", "");
101 shouldBeEqualToString("new KeyboardEvent('eventType', { key: null }).key", "null ");
102 shouldBeEqualToString("new KeyboardEvent('eventType', { key: false }).key", "fal se");
103 shouldBeEqualToString("new KeyboardEvent('eventType', { key: true }).key", "true ");
104 shouldBeEqualToString("new KeyboardEvent('eventType', { key: 12345 }).key", "123 45");
105 shouldBeEqualToString("new KeyboardEvent('eventType', { key: 1844674407370955161 5 }).key", "18446744073709552000");
106 shouldBeEqualToString("new KeyboardEvent('eventType', { key: NaN }).key", "NaN") ;
107 shouldBeEqualToString("new KeyboardEvent('eventType', { key: [] }).key", "");
108 shouldBeEqualToString("new KeyboardEvent('eventType', { key: [1, 2, 3] }).key", "1,2,3");
109 shouldBeEqualToString("new KeyboardEvent('eventType', { key: {koakuma: 12345} }) .key", "[object Object]");
110 shouldBeEqualToString("new KeyboardEvent('eventType', { key: {valueOf: function () { return 'koakuma'; } } }).key", "[object Object]");
111
76 // location is passed. 112 // location is passed.
77 // numbers within the unsigned long range. 113 // numbers within the unsigned long range.
78 shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCAT ION_STANDARD }).location", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD"); 114 shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCAT ION_STANDARD }).location", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD");
79 shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCAT ION_LEFT }).location", "KeyboardEvent.DOM_KEY_LOCATION_LEFT"); 115 shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCAT ION_LEFT }).location", "KeyboardEvent.DOM_KEY_LOCATION_LEFT");
80 shouldBe("new KeyboardEvent('eventType', { location: 4294967294 }).location", "4 294967294"); 116 shouldBe("new KeyboardEvent('eventType', { location: 4294967294 }).location", "4 294967294");
81 shouldBe("new KeyboardEvent('eventType', { location: 4294967295 }).location", "4 294967295"); 117 shouldBe("new KeyboardEvent('eventType', { location: 4294967295 }).location", "4 294967295");
82 118
83 // test for deprecated 'keyLocation'. 119 // test for deprecated 'keyLocation'.
84 shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0"); 120 shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0");
85 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1"); 121 shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1");
(...skipping 30 matching lines...) Expand all
116 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, " true"); 152 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true })." + attr, " true");
117 }); 153 });
118 154
119 // all modifiers are passed correctly. 155 // all modifiers are passed correctly.
120 forEachModifier(function(attr, modifierName) { 156 forEachModifier(function(attr, modifierName) {
121 shouldBe("new KeyboardEvent('eventType', { " + attr + ": false }).getModifie rState('" + modifierName + "');", "false"); 157 shouldBe("new KeyboardEvent('eventType', { " + attr + ": false }).getModifie rState('" + modifierName + "');", "false");
122 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true }).getModifier State('" + modifierName + "');", "true"); 158 shouldBe("new KeyboardEvent('eventType', { " + attr + ": true }).getModifier State('" + modifierName + "');", "true");
123 }); 159 });
124 160
125 // All initializers are passed. 161 // All initializers are passed.
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 }).bubbles", "true"); 162 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).bubbles", "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 }).cancelable", "true "); 163 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).cancelable", "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 }).view", "window"); 164 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).view", "window");
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 }).detail", "111"); 165 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).detail", "111");
130 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"); 166 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl e: true, view: window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey', location: 222, ctrlKey: true, altKey: true, shiftKey: true, meta Key: true, repeat: true }).keyIdentifier", "chocolate");
131 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"); 167 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl e: true, view: window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey', location: 222, ctrlKey: true, altKey: true, shiftKey: true, meta Key: true, repeat: true }).code", "chocode");
132 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"); 168 shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelabl e: true, view: window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey', location: 222, ctrlKey: true, altKey: true, shiftKey: true, meta Key: true, repeat: true }).key", "chokey");
133 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"); 169 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).location", "222");
134 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") ; 170 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).ctrlKey", "true");
135 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"); 171 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).altKey", "true");
136 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"); 172 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).shiftKey", "true");
173 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).metaKey", "true");
174 shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view : window, detail: 111, keyIdentifier: 'chocolate', code: 'chocode', key: 'chokey ', location: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true, re peat: true }).repeat", "true");
137 </script> 175 </script>
138 </body> 176 </body>
139 </html> 177 </html>
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698