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