| OLD | NEW |
| 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 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script> | 7 <script> |
| 8 | 8 |
| 9 description("This tests the constructor for the UIEvent DOM class."); | 9 description("This tests the constructor for the UIEvent DOM class."); |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // cancelable is passed. | 23 // cancelable is passed. |
| 24 shouldBe("new UIEvent('eventType', { cancelable: false }).cancelable", "false"); | 24 shouldBe("new UIEvent('eventType', { cancelable: false }).cancelable", "false"); |
| 25 shouldBe("new UIEvent('eventType', { cancelable: true }).cancelable", "true"); | 25 shouldBe("new UIEvent('eventType', { cancelable: true }).cancelable", "true"); |
| 26 | 26 |
| 27 // view is passed. | 27 // view is passed. |
| 28 // Window objects. | 28 // Window objects. |
| 29 shouldBe("new UIEvent('eventType', { view: window }).view", "window"); | 29 shouldBe("new UIEvent('eventType', { view: window }).view", "window"); |
| 30 shouldBe("new UIEvent('eventType', { view: this }).view", "this"); | 30 shouldBe("new UIEvent('eventType', { view: this }).view", "this"); |
| 31 | 31 |
| 32 // Non-window objects. | 32 // Non-window objects. |
| 33 shouldBe("new UIEvent('eventType', { view: testObject }).view", "null"); | 33 shouldThrow("new UIEvent('eventType', { view: testObject }).view"); |
| 34 shouldBe("new UIEvent('eventType', { view: document }).view", "null"); | 34 shouldThrow("new UIEvent('eventType', { view: document }).view"); |
| 35 shouldBe("new UIEvent('eventType', { view: undefined }).view", "null"); | 35 shouldBe("new UIEvent('eventType', { view: undefined }).view", "null"); |
| 36 shouldBe("new UIEvent('eventType', { view: null }).view", "null"); | 36 shouldBe("new UIEvent('eventType', { view: null }).view", "null"); |
| 37 shouldBe("new UIEvent('eventType', { view: false }).view", "null"); | 37 shouldThrow("new UIEvent('eventType', { view: false }).view"); |
| 38 shouldBe("new UIEvent('eventType', { view: true }).view", "null"); | 38 shouldThrow("new UIEvent('eventType', { view: true }).view"); |
| 39 shouldBe("new UIEvent('eventType', { view: '' }).view", "null"); | 39 shouldThrow("new UIEvent('eventType', { view: '' }).view"); |
| 40 shouldBe("new UIEvent('eventType', { view: 'chocolate' }).view", "null"); | 40 shouldThrow("new UIEvent('eventType', { view: 'chocolate' }).view"); |
| 41 shouldBe("new UIEvent('eventType', { view: 12345 }).view", "null"); | 41 shouldThrow("new UIEvent('eventType', { view: 12345 }).view"); |
| 42 shouldBe("new UIEvent('eventType', { view: 18446744073709551615 }).view", "null"
); | 42 shouldThrow("new UIEvent('eventType', { view: 18446744073709551615 }).view"); |
| 43 shouldBe("new UIEvent('eventType', { view: NaN }).view", "null"); | 43 shouldThrow("new UIEvent('eventType', { view: NaN }).view"); |
| 44 // Note that valueOf() is not called, when the left hand side is evaluated. | 44 // Note that valueOf() is not called, when the left hand side is evaluated. |
| 45 shouldBeFalse("new UIEvent('eventType', { view: {valueOf: function () { return w
indow; } } }).view == window"); | 45 shouldThrow("new UIEvent('eventType', { view: {valueOf: function () { return win
dow; } } }).view == window"); |
| 46 shouldBe("new UIEvent('eventType', { get view() { return 123; } }).view", "null"
); | 46 shouldBe("new UIEvent('eventType', { get view() { return window; } }).view", "wi
ndow"); |
| 47 shouldThrow("new UIEvent('eventType', { get view() { return 123; } }).view"); |
| 47 shouldThrow("new UIEvent('eventType', { get view() { throw 'UIEvent Error'; } })
"); | 48 shouldThrow("new UIEvent('eventType', { get view() { throw 'UIEvent Error'; } })
"); |
| 48 | 49 |
| 49 // detail is passed. | 50 // detail is passed. |
| 50 // numbers within the long range. | 51 // numbers within the long range. |
| 51 shouldBe("new UIEvent('eventType', { detail: 0 }).detail", "0"); | 52 shouldBe("new UIEvent('eventType', { detail: 0 }).detail", "0"); |
| 52 shouldBe("new UIEvent('eventType', { detail: 2147483647 }).detail", "2147483647"
); | 53 shouldBe("new UIEvent('eventType', { detail: 2147483647 }).detail", "2147483647"
); |
| 53 shouldBe("new UIEvent('eventType', { detail: -1 }).detail", "-1"); | 54 shouldBe("new UIEvent('eventType', { detail: -1 }).detail", "-1"); |
| 54 shouldBe("new UIEvent('eventType', { detail: -2147483648 }).detail", "-214748364
8"); | 55 shouldBe("new UIEvent('eventType', { detail: -2147483648 }).detail", "-214748364
8"); |
| 55 | 56 |
| 56 // numbers out of the long range. | 57 // numbers out of the long range. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 77 shouldBe("new UIEvent('eventType', { detail: {valueOf: function () { return 1234
5; }} }).detail", "12345"); | 78 shouldBe("new UIEvent('eventType', { detail: {valueOf: function () { return 1234
5; }} }).detail", "12345"); |
| 78 | 79 |
| 79 // All initializers are passed. | 80 // All initializers are passed. |
| 80 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).bubbles", "true"); | 81 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).bubbles", "true"); |
| 81 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).cancelable", "true"); | 82 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).cancelable", "true"); |
| 82 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).view", "window"); | 83 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).view", "window"); |
| 83 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).detail", "123"); | 84 shouldBe("new UIEvent('eventType', { bubbles: true, cancelable: true, view: wind
ow, detail: 123 }).detail", "123"); |
| 84 </script> | 85 </script> |
| 85 </body> | 86 </body> |
| 86 </html> | 87 </html> |
| OLD | NEW |