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

Unified Diff: LayoutTests/fast/events/constructors/keyboard-event-constructor.html

Issue 20034002: Add support for KeyboardEvent.location attribute (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/constructors/keyboard-event-constructor.html
diff --git a/LayoutTests/fast/events/constructors/keyboard-event-constructor.html b/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
index db0bccb98e328d67429a3650554dfd61400263ba..ea80de5ef5a84f945fa32adac289efd5fb655cae 100644
--- a/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
+++ b/LayoutTests/fast/events/constructors/keyboard-event-constructor.html
@@ -16,7 +16,7 @@ shouldBe("new KeyboardEvent('eventType').cancelable", "false");
shouldBe("new KeyboardEvent('eventType').view", "null");
shouldBe("new KeyboardEvent('eventType').detail", "0");
shouldBeEqualToString("new KeyboardEvent('eventType').keyIdentifier", "");
-shouldBe("new KeyboardEvent('eventType').keyLocation", "0");
+shouldBe("new KeyboardEvent('eventType').location", "0");
shouldBe("new KeyboardEvent('eventType').ctrlKey", "false");
shouldBe("new KeyboardEvent('eventType').altKey", "false");
shouldBe("new KeyboardEvent('eventType').shiftKey", "false");
@@ -70,36 +70,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]");
-// keyLocation is passed.
+// location is passed.
// numbers within the unsigned long range.
+shouldBe("new KeyboardEvent('eventType', { location: 0 }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: 1 }).location", "1");
+shouldBe("new KeyboardEvent('eventType', { location: 4294967294 }).location", "4294967294");
+shouldBe("new KeyboardEvent('eventType', { location: 4294967295 }).location", "4294967295");
+
+// test for deprecated 'keyLocation'.
shouldBe("new KeyboardEvent('eventType', { keyLocation: 0 }).keyLocation", "0");
shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).keyLocation", "1");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 4294967294 }).keyLocation", "4294967294");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 4294967295 }).keyLocation", "4294967295");
+shouldBe("new KeyboardEvent('eventType', { keyLocation: 1 }).location", "1");
+shouldBe("new KeyboardEvent('eventType', { location: 1 }).keyLocation", "1");
// numbers out of the unsigned long range.
// 2^{53}-1, the largest number that can be exactly represented by double.
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 9007199254740991 }).keyLocation", "4294967295");
+shouldBe("new KeyboardEvent('eventType', { location: 9007199254740991 }).location", "4294967295");
// 2^{64}-1
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 18446744073709551615 }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 12345678901234567890 }).keyLocation", "3944679424");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: -1 }).keyLocation", "4294967295");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 123.45 }).keyLocation", "123");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: NaN }).keyLocation", "0");
+shouldBe("new KeyboardEvent('eventType', { location: 18446744073709551615 }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: 12345678901234567890 }).location", "3944679424");
+shouldBe("new KeyboardEvent('eventType', { location: -1 }).location", "4294967295");
+shouldBe("new KeyboardEvent('eventType', { location: 123.45 }).location", "123");
+shouldBe("new KeyboardEvent('eventType', { location: NaN }).location", "0");
// Non-numeric values.
-shouldBe("new KeyboardEvent('eventType', { keyLocation: undefined }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: null }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: '' }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: '12345' }).keyLocation", "12345");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: '12345a' }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: 'abc' }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: [] }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: [12345] }).keyLocation", "12345");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: [12345, 67890] }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: {} }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: {moemoe: 12345} }).keyLocation", "0");
-shouldBe("new KeyboardEvent('eventType', { keyLocation: {valueOf: function () { return 12345; }} }).keyLocation", "12345");
+shouldBe("new KeyboardEvent('eventType', { location: undefined }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: null }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: '' }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: '12345' }).location", "12345");
+shouldBe("new KeyboardEvent('eventType', { location: '12345a' }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: 'abc' }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: [] }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: [12345] }).location", "12345");
+shouldBe("new KeyboardEvent('eventType', { location: [12345, 67890] }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: {} }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: {moemoe: 12345} }).location", "0");
+shouldBe("new KeyboardEvent('eventType', { location: {valueOf: function () { return 12345; }} }).location", "12345");
// ctrlKey, altKey, shiftKey and metaKey are passed.
["ctrlKey", "altKey", "shiftKey", "metaKey"].forEach(function (attr) {
@@ -108,16 +114,16 @@ shouldBe("new KeyboardEvent('eventType', { keyLocation: {valueOf: function () {
});
// All initializers are passed.
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).bubbles", "true");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).cancelable", "true");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).view", "window");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).detail", "111");
-shouldBeEqualToString("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyIdentifier", "chocolate");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).keyLocation", "222");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).ctrlKey", "true");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).altKey", "true");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: true }).shiftKey", "true");
-shouldBe("new KeyboardEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, keyIdentifier: 'chocolate', keyLocation: 222, ctrlKey: true, altKey: true, shiftKey: true, metaKey: 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 }).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 }).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 }).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 }).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 }).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 }).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 }).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 }).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 }).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 }).metaKey", "true");
</script>
<script src="../../js/resources/js-test-post.js"></script>
</body>

Powered by Google App Engine
This is Rietveld 408576698