Chromium Code Reviews| Index: LayoutTests/fast/events/constructors/mouse-event-constructor.html |
| diff --git a/LayoutTests/fast/events/constructors/mouse-event-constructor.html b/LayoutTests/fast/events/constructors/mouse-event-constructor.html |
| index 956f818eba1ab01146893d728323090e1411a93d..21ba133017e42b34c918bb06ff35488c5973eeda 100644 |
| --- a/LayoutTests/fast/events/constructors/mouse-event-constructor.html |
| +++ b/LayoutTests/fast/events/constructors/mouse-event-constructor.html |
| @@ -26,6 +26,7 @@ shouldBe("new MouseEvent('eventType').shiftKey", "false"); |
| shouldBe("new MouseEvent('eventType').altKey", "false"); |
| shouldBe("new MouseEvent('eventType').metaKey", "false"); |
| shouldBe("new MouseEvent('eventType').button", "0"); |
| +shouldBe("new MouseEvent('eventType').buttons", "0"); |
| shouldBe("new MouseEvent('eventType').relatedTarget", "null"); |
| // bubbles is passed. |
| @@ -133,6 +134,38 @@ shouldBe("new MouseEvent('eventType', { button: {} }).button", "0"); |
| shouldBe("new MouseEvent('eventType', { button: {moemoe: 12345} }).button", "0"); |
| shouldBe("new MouseEvent('eventType', { button: {valueOf: function () { return 12345; }} }).button", "12345"); |
| +// buttons is passed. |
| +// Numbers within the unsigned short range. |
| +shouldBe("new MouseEvent('eventType', { buttons: 0 }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: 1 }).buttons", "1"); |
| +shouldBe("new MouseEvent('eventType', { buttons: 65534 }).buttons", "65534"); |
| + |
| +// Numbers that are equal to ((unsigned short)-1) should be treated as 0. |
| +shouldBe("new MouseEvent('eventType', { buttons: 65535 }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: 9007199254740991 }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: -1 }).buttons", "0"); |
|
Rick Byers
2014/11/25 17:44:27
what about other negative numbers? You special-ca
zino
2014/11/28 12:29:28
Sorry, My thinking was incorrect.
If the button is
Rick Byers
2014/11/28 17:36:02
Ok, thanks for checking - I'll take your word on w
|
| + |
| +// Numbers out of the unsigned short range. |
| +// 2^{64}-1 |
| +shouldBe("new MouseEvent('eventType', { buttons: 18446744073709551615 }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: 12345678901234567890 }).buttons", "2048"); |
| +shouldBe("new MouseEvent('eventType', { buttons: 123.45 }).buttons", "123"); |
| +shouldBe("new MouseEvent('eventType', { buttons: NaN }).buttons", "0"); |
| + |
| +// Non-numeric values. |
| +shouldBe("new MouseEvent('eventType', { buttons: undefined }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: null }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: '' }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: '12345' }).buttons", "12345"); |
| +shouldBe("new MouseEvent('eventType', { buttons: '12345a' }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: 'abc' }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: [] }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: [12345] }).buttons", "12345"); |
| +shouldBe("new MouseEvent('eventType', { buttons: [12345, 67890] }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: {} }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: {moemoe: 12345} }).buttons", "0"); |
| +shouldBe("new MouseEvent('eventType', { buttons: {valueOf: function () { return 12345; }} }).buttons", "12345"); |
| + |
| // relatedTarget is passed. |
| // Valid objects. |
| shouldBe("new MouseEvent('eventType', { relatedTarget: testDiv }).relatedTarget", "testDiv"); |
| @@ -158,20 +191,20 @@ shouldThrow("new MouseEvent('eventType', { get relatedTarget() { return 123; } } |
| shouldThrow("new MouseEvent('eventType', { get relatedTarget() { throw 'MouseEvent Error'; } })"); |
| // All initializers are passed. |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).bubbles", "true"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).cancelable", "true"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).view", "window"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).detail", "111"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).screenX", "222"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).screenY", "333"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).clientX", "444"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).clientY", "555"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).ctrlKey", "true"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).shiftKey", "true"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).altKey", "true"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).metaKey", "true"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).button", "666"); |
| -shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, relatedTarget: testDiv }).relatedTarget", "testDiv"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).bubbles", "true"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).cancelable", "true"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).view", "window"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).detail", "111"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).screenX", "222"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).screenY", "333"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).clientX", "444"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).clientY", "555"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).ctrlKey", "true"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).shiftKey", "true"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).altKey", "true"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).metaKey", "true"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).button", "666"); |
| +shouldBe("new MouseEvent('eventType', { bubbles: true, cancelable: true, view: window, detail: 111, screenX: 222, screenY: 333, clientX: 444, clientY: 555, ctrlKey: true, shiftKey: true, altKey: true, metaKey: true, button: 666, buttons: 777, relatedTarget: testDiv }).relatedTarget", "testDiv"); |
| </script> |
| </body> |
| </html> |