| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 Exported function: | 6 Exported function: |
| 7 assertResponsive | 7 assertResponsive |
| 8 | 8 |
| 9 Call signature: | 9 Call signature: |
| 10 assertResponsive({ | 10 assertResponsive({ |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 stateTransitionTests.push({ | 143 stateTransitionTests.push({ |
| 144 applyStateTransition() { | 144 applyStateTransition() { |
| 145 setState(targets, property, after.state); | 145 setState(targets, property, after.state); |
| 146 }, | 146 }, |
| 147 assert() { | 147 assert() { |
| 148 for (var i = 0; i < targets.length; i++) { | 148 for (var i = 0; i < targets.length; i++) { |
| 149 var target = targets[i]; | 149 var target = targets[i]; |
| 150 var expectation = after.expect[i]; | 150 var expectation = after.expect[i]; |
| 151 var actual = getComputedStyle(target)[property]; | 151 var actual = getComputedStyle(target)[property]; |
| 152 test(function() { | 152 test(function() { |
| 153 if (/url\(([^\)]*)\)/g.test(expectation.is) && !/url\(\"([^\)]*)\"
\)/g.test(expectation.is)) { |
| 154 var url = /url\(([^\)]*)\)/g.exec(expectation.is)[1]; |
| 155 expectation.is = 'url(\"' + url + '\")'; |
| 156 } |
| 153 assert_equals(actual, expectation.is); | 157 assert_equals(actual, expectation.is); |
| 154 }, `Animation on property <${property}> from [${from}] to [${to}] wi
th ${JSON.stringify(before.state)} changed to ${JSON.stringify(after.state)} at
(${expectation.at}) is [${expectation.is}]`); | 158 }, `Animation on property <${property}> from [${from}] to [${to}] wi
th ${JSON.stringify(before.state)} changed to ${JSON.stringify(after.state)} at
(${expectation.at}) is [${expectation.is}]`); |
| 155 } | 159 } |
| 156 }, | 160 }, |
| 157 }); | 161 }); |
| 158 }); | 162 }); |
| 159 }); | 163 }); |
| 160 | 164 |
| 161 // Force style recalc to instantiate animations internally. | 165 // Force style recalc to instantiate animations internally. |
| 162 getComputedStyle(document.body).color; | 166 getComputedStyle(document.body).color; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 186 requestAnimationFrame(function() { | 190 requestAnimationFrame(function() { |
| 187 runPendingResponsiveTests(); | 191 runPendingResponsiveTests(); |
| 188 asyncHandle.done() | 192 asyncHandle.done() |
| 189 }); | 193 }); |
| 190 }); | 194 }); |
| 191 | 195 |
| 192 | 196 |
| 193 window.assertResponsive = assertResponsive; | 197 window.assertResponsive = assertResponsive; |
| 194 | 198 |
| 195 })(); | 199 })(); |
| OLD | NEW |