OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2013 Google Inc. All Rights Reserved. | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 --> | |
16 | |
17 <!doctype html> | |
18 <style> | |
19 #target { | |
20 background-color: lightsteelblue; | |
21 width: 50px; | |
22 height: 50px; | |
23 position: absolute; | |
24 left: 0px; | |
25 } | |
26 | |
27 #spacer { | |
28 height: 100px; | |
29 } | |
30 </style> | |
31 | |
32 | |
33 <div id="target"></div> | |
34 <div id="spacer"></div> | |
35 | |
36 <script src="../bootstrap.js"></script> | |
37 <script> | |
38 'use strict'; | |
39 | |
40 var target = document.querySelector('#target'); | |
41 | |
42 document.timeline.play(new Animation(target, {left: '100px', composite: 'add'},
{duration: 1 * 1000, iterations: 2, direction: 'alternate'})); | |
43 | |
44 at(0.5 * 1000, function() { | |
45 assert_equals(target.style.length, 0); | |
46 assert_in_array(target.style.getPropertyValue('left'), ['', null]); | |
47 }); | |
48 | |
49 testharness_timeline.schedule(function() { | |
50 target.style.setProperty('left' , '50px'); | |
51 assert_styles(target, {left: '150px'}, 'getComputedStyle() should return corre
ct value after setting inline style.'); | |
52 }, 1000); | |
53 | |
54 at(1.5 * 1000, function() { | |
55 assert_equals(target.style.length, 1); | |
56 assert_equals(target.style.getPropertyValue('left'), '50px'); | |
57 }); | |
58 | |
59 testharness_timeline.schedule(function() { | |
60 target.style.setProperty('left' , '100px'); | |
61 target.style.setProperty('background-color' , 'green'); | |
62 }, 2500); | |
63 | |
64 at(3 * 1000, function() { | |
65 assert_equals(target.style.length, 2); | |
66 assert_equals(target.style.getPropertyValue('left'), '100px'); | |
67 assert_equals(target.style.getPropertyValue('background-color'), 'green'); | |
68 }); | |
69 | |
70 </script> | |
OLD | NEW |