| 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 FocusEvent DOM class."); | 9 description("This tests the constructor for the FocusEvent DOM class."); |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // cancelable is passed. | 26 // cancelable is passed. |
| 27 shouldBe("new FocusEvent('eventType', { cancelable: false }).cancelable", "false
"); | 27 shouldBe("new FocusEvent('eventType', { cancelable: false }).cancelable", "false
"); |
| 28 shouldBe("new FocusEvent('eventType', { cancelable: true }).cancelable", "true")
; | 28 shouldBe("new FocusEvent('eventType', { cancelable: true }).cancelable", "true")
; |
| 29 | 29 |
| 30 // view is passed. | 30 // view is passed. |
| 31 // Window objects. | 31 // Window objects. |
| 32 shouldBe("new FocusEvent('eventType', { view: window }).view", "window"); | 32 shouldBe("new FocusEvent('eventType', { view: window }).view", "window"); |
| 33 shouldBe("new FocusEvent('eventType', { view: this }).view", "this"); | 33 shouldBe("new FocusEvent('eventType', { view: this }).view", "this"); |
| 34 | 34 |
| 35 // Non-window objects. | 35 // Non-window objects. |
| 36 shouldBe("new FocusEvent('eventType', { view: testObject }).view", "null"); | 36 shouldThrow("new FocusEvent('eventType', { view: testObject }).view"); |
| 37 shouldBe("new FocusEvent('eventType', { view: document }).view", "null"); | 37 shouldThrow("new FocusEvent('eventType', { view: document }).view"); |
| 38 shouldBe("new FocusEvent('eventType', { view: undefined }).view", "null"); | 38 shouldBe("new FocusEvent('eventType', { view: undefined }).view", "null"); |
| 39 shouldBe("new FocusEvent('eventType', { view: null }).view", "null"); | 39 shouldBe("new FocusEvent('eventType', { view: null }).view", "null"); |
| 40 shouldBe("new FocusEvent('eventType', { view: false }).view", "null"); | 40 shouldThrow("new FocusEvent('eventType', { view: false }).view"); |
| 41 shouldBe("new FocusEvent('eventType', { view: true }).view", "null"); | 41 shouldThrow("new FocusEvent('eventType', { view: true }).view"); |
| 42 shouldBe("new FocusEvent('eventType', { view: '' }).view", "null"); | 42 shouldThrow("new FocusEvent('eventType', { view: '' }).view"); |
| 43 shouldBe("new FocusEvent('eventType', { view: 'chocolate' }).view", "null"); | 43 shouldThrow("new FocusEvent('eventType', { view: 'chocolate' }).view"); |
| 44 shouldBe("new FocusEvent('eventType', { view: 12345 }).view", "null"); | 44 shouldThrow("new FocusEvent('eventType', { view: 12345 }).view"); |
| 45 shouldBe("new FocusEvent('eventType', { view: 18446744073709551615 }).view", "nu
ll"); | 45 shouldThrow("new FocusEvent('eventType', { view: 18446744073709551615 }).view"); |
| 46 shouldBe("new FocusEvent('eventType', { view: NaN }).view", "null"); | 46 shouldThrow("new FocusEvent('eventType', { view: NaN }).view"); |
| 47 // Note that valueOf() is not called, when the left hand side is evaluated. | 47 // Note that valueOf() is not called, when the left hand side is evaluated. |
| 48 shouldBeFalse("new FocusEvent('eventType', { view: {valueOf: function () { retur
n window; } } }).view == window"); | 48 shouldThrow("new FocusEvent('eventType', { view: {valueOf: function () { return
window; } } }).view == window"); |
| 49 shouldBe("new FocusEvent('eventType', { get view() { return 123; } }).view", "nu
ll"); | 49 shouldBe("new FocusEvent('eventType', { get view() { return window; } }).view",
"window"); |
| 50 shouldThrow("new FocusEvent('eventType', { get view() { return 123; } }).view"); |
| 50 shouldThrow("new FocusEvent('eventType', { get view() { throw 'FocusEvent Error'
; } })"); | 51 shouldThrow("new FocusEvent('eventType', { get view() { throw 'FocusEvent Error'
; } })"); |
| 51 | 52 |
| 52 // relatedTarget is passed. | 53 // relatedTarget is passed. |
| 53 // Valid objects. | 54 // Valid objects. |
| 54 shouldBe("new FocusEvent('eventType', { relatedTarget: testDiv }).relatedTarget"
, "testDiv"); | 55 shouldBe("new FocusEvent('eventType', { relatedTarget: testDiv }).relatedTarget"
, "testDiv"); |
| 55 shouldBe("new FocusEvent('eventType', { relatedTarget: document }).relatedTarget
", "document"); | 56 shouldBe("new FocusEvent('eventType', { relatedTarget: document }).relatedTarget
", "document"); |
| 56 shouldBe("new FocusEvent('eventType', { relatedTarget: xhr }).relatedTarget", "x
hr"); | 57 shouldBe("new FocusEvent('eventType', { relatedTarget: xhr }).relatedTarget", "x
hr"); |
| 57 shouldBe("new FocusEvent('eventType', { relatedTarget: window }).relatedTarget",
"window"); | 58 shouldBe("new FocusEvent('eventType', { relatedTarget: window }).relatedTarget",
"window"); |
| 58 | 59 |
| 59 // Invalid objects. | 60 // Invalid objects. |
| 60 shouldBe("new FocusEvent('eventType', { relatedTarget: testObject }).relatedTarg
et", "null"); | 61 shouldThrow("new FocusEvent('eventType', { relatedTarget: testObject }).relatedT
arget"); |
| 61 shouldBe("new FocusEvent('eventType', { relatedTarget: undefined }).relatedTarge
t", "null"); | 62 shouldBe("new FocusEvent('eventType', { relatedTarget: undefined }).relatedTarge
t", "null"); |
| 62 shouldBe("new FocusEvent('eventType', { relatedTarget: null }).relatedTarget", "
null"); | 63 shouldBe("new FocusEvent('eventType', { relatedTarget: null }).relatedTarget", "
null"); |
| 63 shouldBe("new FocusEvent('eventType', { relatedTarget: false }).relatedTarget",
"null"); | 64 shouldThrow("new FocusEvent('eventType', { relatedTarget: false }).relatedTarget
"); |
| 64 shouldBe("new FocusEvent('eventType', { relatedTarget: true }).relatedTarget", "
null"); | 65 shouldThrow("new FocusEvent('eventType', { relatedTarget: true }).relatedTarget"
); |
| 65 shouldBe("new FocusEvent('eventType', { relatedTarget: '' }).relatedTarget", "nu
ll"); | 66 shouldThrow("new FocusEvent('eventType', { relatedTarget: '' }).relatedTarget"); |
| 66 shouldBe("new FocusEvent('eventType', { relatedTarget: 'chocolate' }).relatedTar
get", "null"); | 67 shouldThrow("new FocusEvent('eventType', { relatedTarget: 'chocolate' }).related
Target"); |
| 67 shouldBe("new FocusEvent('eventType', { relatedTarget: 12345 }).relatedTarget",
"null"); | 68 shouldThrow("new FocusEvent('eventType', { relatedTarget: 12345 }).relatedTarget
"); |
| 68 shouldBe("new FocusEvent('eventType', { relatedTarget: 18446744073709551615 }).r
elatedTarget", "null"); | 69 shouldThrow("new FocusEvent('eventType', { relatedTarget: 18446744073709551615 }
).relatedTarget"); |
| 69 shouldBe("new FocusEvent('eventType', { relatedTarget: NaN }).relatedTarget", "n
ull"); | 70 shouldThrow("new FocusEvent('eventType', { relatedTarget: NaN }).relatedTarget")
; |
| 70 // Note that valueOf() is not called, when the left hand side is evaluated. | 71 // Note that valueOf() is not called, when the left hand side is evaluated. |
| 71 shouldBeFalse("new FocusEvent('eventType', { relatedTarget: {valueOf: function (
) { return testDiv; } } }).relatedTarget == testDiv"); | 72 shouldThrow("new FocusEvent('eventType', { relatedTarget: {valueOf: function ()
{ return testDiv; } } }).relatedTarget == testDiv"); |
| 72 shouldBe("new FocusEvent('eventType', { get relatedTarget() { return 123; } }).r
elatedTarget", "null"); | 73 shouldBeTrue("new FocusEvent('eventType', { get relatedTarget() { return testDiv
; } }).relatedTarget == testDiv"); |
| 74 shouldThrow("new FocusEvent('eventType', { get relatedTarget() { return 123; } }
).relatedTarget"); |
| 73 shouldThrow("new FocusEvent('eventType', { get relatedTarget() { throw 'FocusEve
nt Error'; } })"); | 75 shouldThrow("new FocusEvent('eventType', { get relatedTarget() { throw 'FocusEve
nt Error'; } })"); |
| 74 | 76 |
| 75 // All initializers are passed. | 77 // All initializers are passed. |
| 76 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).bubbles", "true"); | 78 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).bubbles", "true"); |
| 77 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).cancelable", "true"); | 79 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).cancelable", "true"); |
| 78 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).view", "window"); | 80 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).view", "window"); |
| 79 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).detail", "111"); | 81 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).detail", "111"); |
| 80 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).relatedTarget", "testDiv"); | 82 shouldBe("new FocusEvent('eventType', { bubbles: true, cancelable: true, view: w
indow, detail: 111, relatedTarget: testDiv }).relatedTarget", "testDiv"); |
| 81 </script> | 83 </script> |
| 82 </body> | 84 </body> |
| 83 </html> | 85 </html> |
| OLD | NEW |