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

Unified 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, 1 month 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor.html b/third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
index 7fdb26e3f014ba1133c1fb3c2c1650fd425c7db0..254dbc66293c2e158b0ae72cfde63a841c955f2d 100644
--- a/third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
+++ b/third_party/WebKit/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
@@ -73,6 +73,42 @@ shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: [1, 2, 3]
shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {koakuma: 12345} }).keyIdentifier", "[object Object]");
shouldBeEqualToString("new KeyboardEvent('eventType', { keyIdentifier: {valueOf: function () { return 'koakuma'; } } }).keyIdentifier", "[object Object]");
+// code is passed.
+// Strings.
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: 'koakuma' }).code", "koakuma");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: '' }).code", "");
+
+// Non-strings.
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: undefined }).code", "");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: null }).code", "null");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: false }).code", "false");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: true }).code", "true");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: 12345 }).code", "12345");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: 18446744073709551615 }).code", "18446744073709552000");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: NaN }).code", "NaN");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: [] }).code", "");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: [1, 2, 3] }).code", "1,2,3");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: {koakuma: 12345} }).code", "[object Object]");
+shouldBeEqualToString("new KeyboardEvent('eventType', { code: {valueOf: function () { return 'koakuma'; } } }).code", "[object Object]");
+
+// key is passed.
+// Strings.
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: 'koakuma' }).key", "koakuma");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: '' }).key", "");
+
+// Non-strings.
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: undefined }).key", "");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: null }).key", "null");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: false }).key", "false");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: true }).key", "true");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: 12345 }).key", "12345");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: 18446744073709551615 }).key", "18446744073709552000");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: NaN }).key", "NaN");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: [] }).key", "");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: [1, 2, 3] }).key", "1,2,3");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: {koakuma: 12345} }).key", "[object Object]");
+shouldBeEqualToString("new KeyboardEvent('eventType', { key: {valueOf: function () { return 'koakuma'; } } }).key", "[object Object]");
+
// location is passed.
// numbers within the unsigned long range.
shouldBe("new KeyboardEvent('eventType', { location: KeyboardEvent.DOM_KEY_LOCATION_STANDARD }).location", "KeyboardEvent.DOM_KEY_LOCATION_STANDARD");
@@ -123,17 +159,19 @@ forEachModifier(function(attr, modifierName) {
});
// All initializers are passed.
-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");
-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");
-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");
-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");
-shouldBeEqualToString("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 }).keyIdentifier", "chocolate");
-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");
-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");
-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");
-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");
-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");
-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");
+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, repeat: true }).bubbles", "true");
+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, repeat: true }).cancelable", "true");
+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, repeat: true }).view", "window");
+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, repeat: true }).detail", "111");
+shouldBeEqualToString("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, repeat: true }).keyIdentifier", "chocolate");
+shouldBeEqualToString("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, repeat: true }).code", "chocode");
+shouldBeEqualToString("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, repeat: true }).key", "chokey");
+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, repeat: true }).location", "222");
+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, repeat: true }).ctrlKey", "true");
+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, repeat: true }).altKey", "true");
+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, repeat: true }).shiftKey", "true");
+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, repeat: true }).metaKey", "true");
+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, repeat: true }).repeat", "true");
</script>
</body>
</html>
« 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