Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / events / constructors / webkit-animation-event-constructor.html
blobf5686a7bc1bfaefc5955f8f7ee59e18bc13cc2da
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <script>
9 description("This tests the constructor for the WebKitAnimationEvent DOM class.");
11 // No initializer is passed.
12 shouldBe("new WebKitAnimationEvent('eventType').bubbles", "false");
13 shouldBe("new WebKitAnimationEvent('eventType').cancelable", "false");
14 shouldBeEqualToString("new WebKitAnimationEvent('eventType').animationName", "");
15 shouldBe("new WebKitAnimationEvent('eventType').elapsedTime", "0");
17 // bubbles is passed.
18 shouldBe("new WebKitAnimationEvent('eventType', { bubbles: false }).bubbles", "false");
19 shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true }).bubbles", "true");
21 // cancelable is passed.
22 shouldBe("new WebKitAnimationEvent('eventType', { cancelable: false }).cancelable", "false");
23 shouldBe("new WebKitAnimationEvent('eventType', { cancelable: true }).cancelable", "true");
25 // animationName is passed.
26 // Strings.
27 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: 'doremi' }).animationName", "doremi");
28 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: '' }).animationName", "");
30 // Non-strings.
31 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: undefined }).animationName", "");
32 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: null }).animationName", "null");
33 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: false }).animationName", "false");
34 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: true }).animationName", "true");
35 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: 12345 }).animationName", "12345");
36 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: 18446744073709551615 }).animationName", "18446744073709552000");
37 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: NaN }).animationName", "NaN");
38 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: [] }).animationName", "");
39 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: [1, 2, 3] }).animationName", "1,2,3");
40 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: {doremi: 12345} }).animationName", "[object Object]");
41 shouldBeEqualToString("new WebKitAnimationEvent('eventType', { animationName: {valueOf: function () { return 'doremi'; } } }).animationName", "[object Object]");
43 // elapsedTime is passed.
44 // Numeric values.
45 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 0 }).elapsedTime", "0");
46 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 123.45 }).elapsedTime", "123.45");
47 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: -123.45 }).elapsedTime", "-123.45");
48 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: 18446744073709551615 }).elapsedTime", "18446744073709551615");
49 shouldThrow("new WebKitAnimationEvent('eventType', { elapsedTime: NaN }).elapsedTime");
50 shouldThrow("new WebKitAnimationEvent('eventType', { elapsedTime: Infinity }).elapsedTime");
51 shouldThrow("new WebKitAnimationEvent('eventType', { elapsedTime: -Infinity }).elapsedTime");
53 // Non-numeric values.
54 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: undefined }).elapsedTime", "0");
55 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: null }).elapsedTime", "0");
56 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: false }).elapsedTime", "0");
57 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: true }).elapsedTime", "1");
58 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: '' }).elapsedTime", "0");
59 shouldThrow("new WebKitAnimationEvent('eventType', { elapsedTime: 'doremi' }).elapsedTime");
60 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: [] }).elapsedTime", "0");
61 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: [123.45] }).elapsedTime", "123.45");
62 shouldThrow("new WebKitAnimationEvent('eventType', { elapsedTime: [123.45, 678.90] }).elapsedTime");
63 shouldThrow("new WebKitAnimationEvent('eventType', { elapsedTime: {doremi: 123.45} }).elapsedTime");
64 shouldBe("new WebKitAnimationEvent('eventType', { elapsedTime: {valueOf: function () { return 123.45 } } }).elapsedTime", "123.45");
66 // All initializers are passed.
67 shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).bubbles", "true");
68 shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).cancelable", "true");
69 shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).animationName", "'doremi'");
70 shouldBe("new WebKitAnimationEvent('eventType', { bubbles: true, cancelable: true, animationName: 'doremi', elapsedTime: 123.45 }).elapsedTime", "123.45");
71 </script>
72 </body>
73 </html>