| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description("This tests the constructor for the TransitionEvent DOM class."); |
| |
| // No initializer is passed. |
| shouldBe("new TransitionEvent('eventType').bubbles", "false"); |
| shouldBe("new TransitionEvent('eventType').cancelable", "false"); |
| shouldBeEqualToString("new TransitionEvent('eventType').propertyName", ""); |
| shouldBe("new TransitionEvent('eventType').elapsedTime", "0"); |
| shouldBeEqualToString("new TransitionEvent('eventType').pseudoElement", ""); |
| |
| // bubbles is passed. |
| shouldBe("new TransitionEvent('eventType', { bubbles: false }).bubbles", "false"); |
| shouldBe("new TransitionEvent('eventType', { bubbles: true }).bubbles", "true"); |
| |
| // cancelable is passed. |
| shouldBe("new TransitionEvent('eventType', { cancelable: false }).cancelable", "false"); |
| shouldBe("new TransitionEvent('eventType', { cancelable: true }).cancelable", "true"); |
| |
| // propertyName is passed. |
| // Strings. |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: 'doremi' }).propertyName", "doremi"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: '' }).propertyName", ""); |
| |
| // Non-strings. |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: undefined }).propertyName", ""); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: null }).propertyName", "null"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: false }).propertyName", "false"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: true }).propertyName", "true"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: 12345 }).propertyName", "12345"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: 18446744073709551615 }).propertyName", "18446744073709552000"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: NaN }).propertyName", "NaN"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: [] }).propertyName", ""); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: [1, 2, 3] }).propertyName", "1,2,3"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: {doremi: 12345} }).propertyName", "[object Object]"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { propertyName: {valueOf: function () { return 'doremi'; } } }).propertyName", "[object Object]"); |
| |
| // elapsedTime is passed. |
| // Numeric values. |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: 0 }).elapsedTime", "0"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: 123.45 }).elapsedTime", "123.45"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: -123.45 }).elapsedTime", "-123.45"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: 18446744073709551615 }).elapsedTime", "18446744073709551615"); |
| shouldThrowErrorName("new TransitionEvent('eventType', { elapsedTime: NaN }).elapsedTime", "TypeError"); |
| shouldThrowErrorName("new TransitionEvent('eventType', { elapsedTime: Infinity }).elapsedTime", "TypeError"); |
| shouldThrowErrorName("new TransitionEvent('eventType', { elapsedTime: -Infinity }).elapsedTime", "TypeError"); |
| |
| // pseudoElement is passed. |
| // Strings. |
| shouldBeEqualToString("new TransitionEvent('eventType', { pseudoElement: '::before' }).pseudoElement", "::before"); |
| shouldBeEqualToString("new TransitionEvent('eventType', { pseudoElement: '' }).pseudoElement", ""); |
| |
| // Non-numeric values. |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: undefined }).elapsedTime", "0"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: null }).elapsedTime", "0"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: false }).elapsedTime", "0"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: true }).elapsedTime", "1"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: '' }).elapsedTime", "0"); |
| shouldThrowErrorName("new TransitionEvent('eventType', { elapsedTime: 'doremi' }).elapsedTime", "TypeError"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: [] }).elapsedTime", "0"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: [123.45] }).elapsedTime", "123.45"); |
| shouldThrowErrorName("new TransitionEvent('eventType', { elapsedTime: [123.45, 678.90] }).elapsedTime", "TypeError"); |
| shouldThrowErrorName("new TransitionEvent('eventType', { elapsedTime: {doremi: 123.45} }).elapsedTime", "TypeError"); |
| shouldBe("new TransitionEvent('eventType', { elapsedTime: {valueOf: function () { return 123.45 } } }).elapsedTime", "123.45"); |
| |
| // All initializers are passed. |
| shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).bubbles", "true"); |
| shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).cancelable", "true"); |
| shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).propertyName", "'doremi'"); |
| shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).elapsedTime", "123.45"); |
| shouldBe("new TransitionEvent('eventType', { bubbles: true, cancelable: true, propertyName: 'doremi', elapsedTime: 123.45, pseudoElement: '::after' }).pseudoElement", "'::after'"); |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |