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> |
| 37 var expected_failures = { |
| 38 }; |
| 39 </script> |
| 40 <script src="../bootstrap.js"></script> |
| 41 <script> |
| 42 'use strict'; |
| 43 |
| 44 var target = document.querySelector('#target'); |
| 45 |
| 46 // Ensure the target cannot be monkey patched with a different style object. |
| 47 // This simulates Safari's behaviour in other browsers. |
| 48 try { |
| 49 var originalStyle = target.style; |
| 50 Object.defineProperty(target, 'style', { |
| 51 get: function () {return originalStyle;}, |
| 52 configurable: false, |
| 53 }); |
| 54 } catch (_) {} |
| 55 |
| 56 |
| 57 document.timeline.play(new Animation(target, {left: '100px', composite: 'add'},
{duration: 1, iterations: 2, direction: 'alternate'})); |
| 58 |
| 59 at(0.5, function() { |
| 60 assert_in_array(target.style.getPropertyValue('left'), ['', null]); |
| 61 }); |
| 62 |
| 63 testharness_timeline.schedule(function() { |
| 64 target.style.setProperty('left' , '50px'); |
| 65 assert_styles(target, {left: '150px'}, 'getComputedStyle() should return corre
ct value after setting inline style.'); |
| 66 }, 1000); |
| 67 |
| 68 at(1.5, function() { |
| 69 assert_equals(target.style.getPropertyValue('left'), '50px'); |
| 70 }); |
| 71 |
| 72 testharness_timeline.schedule(function() { |
| 73 target.style.setProperty('left', '100px'); |
| 74 target.style.setProperty('background-color', 'green'); |
| 75 }, 2500); |
| 76 |
| 77 at(3, function() { |
| 78 assert_equals(target.style.getPropertyValue('left'), '100px'); |
| 79 assert_equals(target.style.getPropertyValue('background-color'), 'green'); |
| 80 }); |
| 81 |
| 82 </script> |
OLD | NEW |