blob: d72b73ac9ef2f70825714764a273759dbb192f29 [file] [log] [blame]
This tests the constructor for the MouseEvent DOM class.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS new MouseEvent('eventType').bubbles is false
PASS new MouseEvent('eventType').cancelable is false
PASS new MouseEvent('eventType').view is null
PASS new MouseEvent('eventType').detail is 0
PASS new MouseEvent('eventType').screenX is 0
PASS new MouseEvent('eventType').screenY is 0
PASS new MouseEvent('eventType').clientX is 0
PASS new MouseEvent('eventType').clientY is 0
PASS new MouseEvent('eventType').ctrlKey is false
PASS new MouseEvent('eventType').shiftKey is false
PASS new MouseEvent('eventType').altKey is false
PASS new MouseEvent('eventType').metaKey is false
PASS new MouseEvent('eventType').button is 0
PASS new MouseEvent('eventType').relatedTarget is null
PASS new MouseEvent('eventType', { bubbles: false }).bubbles is false
PASS new MouseEvent('eventType', { bubbles: true }).bubbles is true
PASS new MouseEvent('eventType', { cancelable: false }).cancelable is false
PASS new MouseEvent('eventType', { cancelable: true }).cancelable is true
PASS new MouseEvent('eventType', { view: window }).view is window
PASS new MouseEvent('eventType', { view: this }).view is this
PASS new MouseEvent('eventType', { view: testObject }).view is null
PASS new MouseEvent('eventType', { view: document }).view is null
PASS new MouseEvent('eventType', { view: undefined }).view is null
PASS new MouseEvent('eventType', { view: null }).view is null
PASS new MouseEvent('eventType', { view: false }).view is null
PASS new MouseEvent('eventType', { view: true }).view is null
PASS new MouseEvent('eventType', { view: '' }).view is null
PASS new MouseEvent('eventType', { view: 'chocolate' }).view is null
PASS new MouseEvent('eventType', { view: 12345 }).view is null
PASS new MouseEvent('eventType', { view: 18446744073709551615 }).view is null
PASS new MouseEvent('eventType', { view: NaN }).view is null
PASS new MouseEvent('eventType', { view: {valueOf: function () { return window; } } }).view == window is false
PASS new MouseEvent('eventType', { get view() { return 123; } }).view is null
PASS new MouseEvent('eventType', { get view() { throw 'MouseEvent Error'; } }) threw exception MouseEvent Error.
PASS new MouseEvent('eventType', { detail: 0 }).detail is 0
PASS new MouseEvent('eventType', { detail: 2147483647 }).detail is 2147483647
PASS new MouseEvent('eventType', { detail: -1 }).detail is -1
PASS new MouseEvent('eventType', { detail: -2147483648 }).detail is -2147483648
PASS new MouseEvent('eventType', { detail: 4294967295 }).detail is -1
PASS new MouseEvent('eventType', { detail: 9007199254740991 }).detail is -1
PASS new MouseEvent('eventType', { detail: 18446744073709551615 }).detail is 0
PASS new MouseEvent('eventType', { detail: 123.45 }).detail is 123
PASS new MouseEvent('eventType', { detail: NaN }).detail is 0
PASS new MouseEvent('eventType', { detail: undefined }).detail is 0
PASS new MouseEvent('eventType', { detail: null }).detail is 0
PASS new MouseEvent('eventType', { detail: '' }).detail is 0
PASS new MouseEvent('eventType', { detail: '12345' }).detail is 12345
PASS new MouseEvent('eventType', { detail: '12345a' }).detail is 0
PASS new MouseEvent('eventType', { detail: 'abc' }).detail is 0
PASS new MouseEvent('eventType', { detail: [] }).detail is 0
PASS new MouseEvent('eventType', { detail: [12345] }).detail is 12345
PASS new MouseEvent('eventType', { detail: [12345, 67890] }).detail is 0
PASS new MouseEvent('eventType', { detail: {} }).detail is 0
PASS new MouseEvent('eventType', { detail: {moemoe: 12345} }).detail is 0
PASS new MouseEvent('eventType', { detail: {valueOf: function () { return 12345; }} }).detail is 12345
PASS new MouseEvent('eventType', { screenX: 0 }).screenX is 0
PASS new MouseEvent('eventType', { screenX: 2147483647 }).screenX is 2147483647
PASS new MouseEvent('eventType', { screenX: -1 }).screenX is -1
PASS new MouseEvent('eventType', { screenX: -2147483648 }).screenX is -2147483648
PASS new MouseEvent('eventType', { screenX: 4294967295 }).screenX is -1
PASS new MouseEvent('eventType', { screenX: 9007199254740991 }).screenX is -1
PASS new MouseEvent('eventType', { screenX: 18446744073709551615 }).screenX is 0
PASS new MouseEvent('eventType', { screenX: 123.45 }).screenX is 123
PASS new MouseEvent('eventType', { screenX: NaN }).screenX is 0
PASS new MouseEvent('eventType', { screenX: undefined }).screenX is 0
PASS new MouseEvent('eventType', { screenX: null }).screenX is 0
PASS new MouseEvent('eventType', { screenX: '' }).screenX is 0
PASS new MouseEvent('eventType', { screenX: '12345' }).screenX is 12345
PASS new MouseEvent('eventType', { screenX: '12345a' }).screenX is 0
PASS new MouseEvent('eventType', { screenX: 'abc' }).screenX is 0
PASS new MouseEvent('eventType', { screenX: [] }).screenX is 0
PASS new MouseEvent('eventType', { screenX: [12345] }).screenX is 12345
PASS new MouseEvent('eventType', { screenX: [12345, 67890] }).screenX is 0
PASS new MouseEvent('eventType', { screenX: {} }).screenX is 0
PASS new MouseEvent('eventType', { screenX: {moemoe: 12345} }).screenX is 0
PASS new MouseEvent('eventType', { screenX: {valueOf: function () { return 12345; }} }).screenX is 12345
PASS new MouseEvent('eventType', { screenY: 0 }).screenY is 0
PASS new MouseEvent('eventType', { screenY: 2147483647 }).screenY is 2147483647
PASS new MouseEvent('eventType', { screenY: -1 }).screenY is -1
PASS new MouseEvent('eventType', { screenY: -2147483648 }).screenY is -2147483648
PASS new MouseEvent('eventType', { screenY: 4294967295 }).screenY is -1
PASS new MouseEvent('eventType', { screenY: 9007199254740991 }).screenY is -1
PASS new MouseEvent('eventType', { screenY: 18446744073709551615 }).screenY is 0
PASS new MouseEvent('eventType', { screenY: 123.45 }).screenY is 123
PASS new MouseEvent('eventType', { screenY: NaN }).screenY is 0
PASS new MouseEvent('eventType', { screenY: undefined }).screenY is 0
PASS new MouseEvent('eventType', { screenY: null }).screenY is 0
PASS new MouseEvent('eventType', { screenY: '' }).screenY is 0
PASS new MouseEvent('eventType', { screenY: '12345' }).screenY is 12345
PASS new MouseEvent('eventType', { screenY: '12345a' }).screenY is 0
PASS new MouseEvent('eventType', { screenY: 'abc' }).screenY is 0
PASS new MouseEvent('eventType', { screenY: [] }).screenY is 0
PASS new MouseEvent('eventType', { screenY: [12345] }).screenY is 12345
PASS new MouseEvent('eventType', { screenY: [12345, 67890] }).screenY is 0
PASS new MouseEvent('eventType', { screenY: {} }).screenY is 0
PASS new MouseEvent('eventType', { screenY: {moemoe: 12345} }).screenY is 0
PASS new MouseEvent('eventType', { screenY: {valueOf: function () { return 12345; }} }).screenY is 12345
PASS new MouseEvent('eventType', { clientX: 0 }).clientX is 0
FAIL new MouseEvent('eventType', { clientX: 2147483647 }).clientX should be 2147483647. Was -1.
PASS new MouseEvent('eventType', { clientX: -1 }).clientX is -1
FAIL new MouseEvent('eventType', { clientX: -2147483648 }).clientX should be -2147483648. Was 0.
PASS new MouseEvent('eventType', { clientX: 4294967295 }).clientX is -1
PASS new MouseEvent('eventType', { clientX: 9007199254740991 }).clientX is -1
PASS new MouseEvent('eventType', { clientX: 18446744073709551615 }).clientX is 0
PASS new MouseEvent('eventType', { clientX: 123.45 }).clientX is 123
PASS new MouseEvent('eventType', { clientX: NaN }).clientX is 0
PASS new MouseEvent('eventType', { clientX: undefined }).clientX is 0
PASS new MouseEvent('eventType', { clientX: null }).clientX is 0
PASS new MouseEvent('eventType', { clientX: '' }).clientX is 0
PASS new MouseEvent('eventType', { clientX: '12345' }).clientX is 12345
PASS new MouseEvent('eventType', { clientX: '12345a' }).clientX is 0
PASS new MouseEvent('eventType', { clientX: 'abc' }).clientX is 0
PASS new MouseEvent('eventType', { clientX: [] }).clientX is 0
PASS new MouseEvent('eventType', { clientX: [12345] }).clientX is 12345
PASS new MouseEvent('eventType', { clientX: [12345, 67890] }).clientX is 0
PASS new MouseEvent('eventType', { clientX: {} }).clientX is 0
PASS new MouseEvent('eventType', { clientX: {moemoe: 12345} }).clientX is 0
PASS new MouseEvent('eventType', { clientX: {valueOf: function () { return 12345; }} }).clientX is 12345
PASS new MouseEvent('eventType', { clientY: 0 }).clientY is 0
FAIL new MouseEvent('eventType', { clientY: 2147483647 }).clientY should be 2147483647. Was -1.
PASS new MouseEvent('eventType', { clientY: -1 }).clientY is -1
FAIL new MouseEvent('eventType', { clientY: -2147483648 }).clientY should be -2147483648. Was 0.
PASS new MouseEvent('eventType', { clientY: 4294967295 }).clientY is -1
PASS new MouseEvent('eventType', { clientY: 9007199254740991 }).clientY is -1
PASS new MouseEvent('eventType', { clientY: 18446744073709551615 }).clientY is 0
PASS new MouseEvent('eventType', { clientY: 123.45 }).clientY is 123
PASS new MouseEvent('eventType', { clientY: NaN }).clientY is 0
PASS new MouseEvent('eventType', { clientY: undefined }).clientY is 0
PASS new MouseEvent('eventType', { clientY: null }).clientY is 0
PASS new MouseEvent('eventType', { clientY: '' }).clientY is 0
PASS new MouseEvent('eventType', { clientY: '12345' }).clientY is 12345
PASS new MouseEvent('eventType', { clientY: '12345a' }).clientY is 0
PASS new MouseEvent('eventType', { clientY: 'abc' }).clientY is 0
PASS new MouseEvent('eventType', { clientY: [] }).clientY is 0
PASS new MouseEvent('eventType', { clientY: [12345] }).clientY is 12345
PASS new MouseEvent('eventType', { clientY: [12345, 67890] }).clientY is 0
PASS new MouseEvent('eventType', { clientY: {} }).clientY is 0
PASS new MouseEvent('eventType', { clientY: {moemoe: 12345} }).clientY is 0
PASS new MouseEvent('eventType', { clientY: {valueOf: function () { return 12345; }} }).clientY is 12345
PASS new MouseEvent('eventType', { ctrlKey: false }).ctrlKey is false
PASS new MouseEvent('eventType', { ctrlKey: true }).ctrlKey is true
PASS new MouseEvent('eventType', { altKey: false }).altKey is false
PASS new MouseEvent('eventType', { altKey: true }).altKey is true
PASS new MouseEvent('eventType', { shiftKey: false }).shiftKey is false
PASS new MouseEvent('eventType', { shiftKey: true }).shiftKey is true
PASS new MouseEvent('eventType', { metaKey: false }).metaKey is false
PASS new MouseEvent('eventType', { metaKey: true }).metaKey is true
PASS new MouseEvent('eventType', { button: 0 }).button is 0
PASS new MouseEvent('eventType', { button: 1 }).button is 1
PASS new MouseEvent('eventType', { button: 65534 }).button is 65534
PASS new MouseEvent('eventType', { button: 65535 }).button is 0
PASS new MouseEvent('eventType', { button: 9007199254740991 }).button is 0
PASS new MouseEvent('eventType', { button: -1 }).button is 0
PASS new MouseEvent('eventType', { button: 18446744073709551615 }).button is 0
PASS new MouseEvent('eventType', { button: 12345678901234567890 }).button is 2048
PASS new MouseEvent('eventType', { button: 123.45 }).button is 123
PASS new MouseEvent('eventType', { button: NaN }).button is 0
PASS new MouseEvent('eventType', { button: undefined }).button is 0
PASS new MouseEvent('eventType', { button: null }).button is 0
PASS new MouseEvent('eventType', { button: '' }).button is 0
PASS new MouseEvent('eventType', { button: '12345' }).button is 12345
PASS new MouseEvent('eventType', { button: '12345a' }).button is 0
PASS new MouseEvent('eventType', { button: 'abc' }).button is 0
PASS new MouseEvent('eventType', { button: [] }).button is 0
PASS new MouseEvent('eventType', { button: [12345] }).button is 12345
PASS new MouseEvent('eventType', { button: [12345, 67890] }).button is 0
PASS new MouseEvent('eventType', { button: {} }).button is 0
PASS new MouseEvent('eventType', { button: {moemoe: 12345} }).button is 0
PASS new MouseEvent('eventType', { button: {valueOf: function () { return 12345; }} }).button is 12345
PASS new MouseEvent('eventType', { relatedTarget: testDiv }).relatedTarget is testDiv
PASS new MouseEvent('eventType', { relatedTarget: document }).relatedTarget is document
PASS new MouseEvent('eventType', { relatedTarget: xhr }).relatedTarget is xhr
PASS new MouseEvent('eventType', { relatedTarget: window }).relatedTarget is window
PASS new MouseEvent('eventType', { relatedTarget: testObject }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: undefined }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: null }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: false }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: true }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: '' }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: 'chocolate' }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: 12345 }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: 18446744073709551615 }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: NaN }).relatedTarget is null
PASS new MouseEvent('eventType', { relatedTarget: {valueOf: function () { return testDiv; } } }).relatedTarget == testDiv is false
PASS new MouseEvent('eventType', { get relatedTarget() { return 123; } }).relatedTarget is null
PASS new MouseEvent('eventType', { get relatedTarget() { throw 'MouseEvent Error'; } }) threw exception MouseEvent Error.
PASS 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 is true
PASS 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 is true
PASS 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 is window
PASS 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 is 111
PASS 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 is 222
PASS 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 is 333
PASS 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 is 444
PASS 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 is 555
PASS 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 is true
PASS 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 is true
PASS 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 is true
PASS 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 is true
PASS 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 is 666
PASS 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 is testDiv
PASS successfullyParsed is true
TEST COMPLETE