[Web Animations] Turn Web Animations with CSS integration on
[WebKit-https.git] / LayoutTests / transitions / transition-end-event-multiple-03.html
1 <html>
2 <head>
3   <style>
4     .box {
5       position: relative;
6       left: 0;
7       height: 100px;
8       width: 100px;
9       margin: 10px;
10       background-color: blue;
11       -webkit-transition-property: width, left, background-color, height, top;
12       -webkit-transition-duration: 0.5s;
13     }
14     
15     .box1 {
16       left: 50px;
17     }
18     
19     .box2 {
20       background-color: red;
21       left: 50px;
22     }
23     
24     .box3 {
25       width: 150px;
26       background-color: green;
27       left: 50px;
28       height: 120px;
29       -webkit-transition-duration: 0.6s;
30     }
31
32     .box4 {
33       left: 100px;
34       height: 140px;
35       -webkit-transition-duration: 0.3s;
36     }
37
38     .box5 {
39       /* nothing */
40     }
41
42   </style>
43   <script src="transition-end-event-helpers.js"></script>
44   <script type="text/javascript">
45     
46     var expectedEndEvents = [
47       // [property-name, element-id, elapsed-time, listen]
48       ["background-color", "box2", 0.5, false],
49       ["background-color", "box3", 0.6, false],
50       ["height", "box3", 0.6, false],
51       ["height", "box4", 0.3, false],
52       ["left", "box1", 0.5, false],
53       ["left", "box2", 0.5, false],
54       ["left", "box3", 0.6, false],
55       ["left", "box4", 0.3, false],
56       ["width", "box3", 0.6, false]
57     ];
58     
59     function transitionElement(index)
60     {
61       var boxes = document.body.getElementsByClassName('box');
62       boxes[index-1].className = "box box" + index;
63     }
64
65     function setupTest()
66     {
67       var boxes = document.body.getElementsByClassName('box');
68       for (var i = 0; i < boxes.length; ++i) {
69         boxes[i].addEventListener("webkitTransitionEnd", recordTransitionEndEvent, false);
70       }
71
72       window.setTimeout(function() { transitionElement(1); }, 100);
73       window.setTimeout(function() { transitionElement(2); }, 150);
74       window.setTimeout(function() { transitionElement(3); }, 200);
75       window.setTimeout(function() { transitionElement(4); }, 50);
76       window.setTimeout(function() { transitionElement(5); }, 150);
77     }
78     
79     runTransitionTest(expectedEndEvents, setupTest);
80   </script>
81 </head>
82 <body>
83
84 <p>Initiating transitions on various properties of all boxes, with different start times on the transitions.</p>
85
86 <div id="container">
87   <div id="box1" class="box"></div>
88   <div id="box2" class="box"></div>
89   <div id="box3" class="box"></div>
90   <div id="box4" class="box"></div>
91   <div id="box5" class="box"></div>
92 </div>
93
94 <div id="result"></div>
95
96 </body>
97 </html>