3 <script src=
"../../resources/js-test.js"></script>
6 @-webkit-keyframes example {
7 from { width:
50px; height:
50px; }
8 to { width:
10px; height:
10px; }
12 from { width:
50px; height:
50px; }
13 to { width:
10px; height:
10px; }
24 -webkit-animation: example
2s;
25 -moz-animation: example
2s;
26 animation: example
2s;
31 display: inline-block;
32 border:
1px solid black;
38 <div class=
"before"></div>
39 <div class=
"before" id=
"before"></div>
40 <div class=
"before"></div>
41 <div class=
"after"></div>
42 <div class=
"after" id=
"after"></div>
43 <div class=
"after"></div>
46 description('Animations on :before and :after pseudo elements should run when applied before onload.');
48 if (window
.testRunner
)
49 testRunner
.dumpAsText();
51 // FIXME: This test should be modified so subpixel doesn't cause off by one
52 // below and it no longer needs shouldBeCloseTo.
54 function testAnimations()
56 if (window
.internals
) {
57 internals
.pauseAnimations(1);
58 var div
= document
.getElementById('before');
60 shouldBeCloseTo('div.offsetWidth', 20, 1);
61 var div
= document
.getElementById('after');
63 shouldBeCloseTo('div.offsetWidth', 20, 1);
65 internals
.pauseAnimations(2);
66 var div
= document
.getElementById('before');
68 shouldBeCloseTo('div.offsetWidth', 12, 1);
69 var div
= document
.getElementById('after');
71 shouldBeCloseTo('div.offsetWidth', 12, 1);
73 // This will be flaky, but it's a reasonable approximation for testing
74 // in a browser instead of DRT.
75 setTimeout(function() {
76 var div
= document
.getElementById('before');
78 shouldBeCloseTo('div.offsetWidth', 20, 1);
79 var div
= document
.getElementById('after');
81 shouldBeCloseTo('div.offsetWidth', 20, 1);
83 setTimeout(function() {
84 var div
= document
.getElementById('before');
86 shouldBeCloseTo('div.offsetWidth', 12, 1);
87 var div
= document
.getElementById('after');
89 shouldBeCloseTo('div.offsetWidth', 12, 1);
94 onload
= testAnimations
;