зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1338069 - Don't use 'window' object when using getComputedStyle in tests. r=birtles
MozReview-Commit-ID: KWUNCIaF183 --HG-- extra : rebase_source : 93d7ba66d996d2b7fa835da272b509937a71f454
This commit is contained in:
Родитель
7ab8b4bb1f
Коммит
0d0fa5f03f
|
@ -33,7 +33,7 @@ promise_test(function(t) {
|
|||
|
||||
// Now cancel the animation and flush styles
|
||||
div.style.animation = '';
|
||||
window.getComputedStyle(div).animation;
|
||||
getComputedStyle(div).animation;
|
||||
|
||||
return retPromise;
|
||||
}, 'finished promise is rejected when an animation is cancelled by resetting ' +
|
||||
|
@ -63,7 +63,7 @@ promise_test(function(t) {
|
|||
|
||||
// Now update the animation and flush styles
|
||||
div.style.animation = 'def 100s';
|
||||
window.getComputedStyle(div).animation;
|
||||
getComputedStyle(div).animation;
|
||||
|
||||
return retPromise;
|
||||
}, 'finished promise is rejected when an animation is cancelled by changing ' +
|
||||
|
|
|
@ -17,7 +17,7 @@ function getMarginLeft(cs) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s paused';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(getMarginLeft(cs), 0,
|
||||
|
@ -32,7 +32,7 @@ promise_test(function(t) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s paused';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(getMarginLeft(cs), 0,
|
||||
|
@ -51,7 +51,7 @@ promise_test(function(t) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s paused';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(getMarginLeft(cs), 0,
|
||||
|
@ -82,7 +82,7 @@ promise_test(function(t) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(getMarginLeft(cs), 0,
|
||||
|
@ -105,7 +105,7 @@ promise_test(function(t) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s paused';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(getMarginLeft(cs), 0,
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(animation.playState, 'pending');
|
||||
|
@ -22,7 +22,7 @@ promise_test(function(t) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s paused';
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(animation.playState, 'pending');
|
||||
|
@ -34,7 +34,7 @@ promise_test(function(t) {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s';
|
||||
var animation = div.getAnimations()[0];
|
||||
animation.pause();
|
||||
|
@ -47,7 +47,7 @@ promise_test(function(t) {
|
|||
|
||||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
div.style.animation = 'anim 1000s paused';
|
||||
var animation = div.getAnimations()[0];
|
||||
div.style.animationPlayState = 'running';
|
||||
|
|
|
@ -43,7 +43,7 @@ promise_test(function(t) {
|
|||
|
||||
// Now cancel the animation and flush styles
|
||||
div.style.animation = '';
|
||||
window.getComputedStyle(div).animation;
|
||||
getComputedStyle(div).animation;
|
||||
|
||||
return retPromise;
|
||||
}, 'ready promise is rejected when an animation is cancelled by resetting'
|
||||
|
@ -72,7 +72,7 @@ promise_test(function(t) {
|
|||
|
||||
// Now update the animation and flush styles
|
||||
div.style.animation = 'def 100s';
|
||||
window.getComputedStyle(div).animation;
|
||||
getComputedStyle(div).animation;
|
||||
|
||||
return retPromise;
|
||||
}, 'ready promise is rejected when an animation is cancelled by updating'
|
||||
|
|
|
@ -83,7 +83,7 @@ promise_test(function(t) {
|
|||
// Add an animation
|
||||
div.style.backgroundColor = 'red';
|
||||
div.style.animation = 'anim1 100s';
|
||||
window.getComputedStyle(div).backgroundColor;
|
||||
getComputedStyle(div).backgroundColor;
|
||||
|
||||
// Wait until a frame after the animation starts, then add a transition
|
||||
var animations = div.getAnimations();
|
||||
|
|
|
@ -11,7 +11,7 @@ function getMarginLeft(cs) {
|
|||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
|
||||
div.style.marginLeft = '0px';
|
||||
cs.marginLeft; // Flush style to set up transition start point
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.transform = 'translate(0px)';
|
||||
window.getComputedStyle(div).transform;
|
||||
getComputedStyle(div).transform;
|
||||
div.style.transition = 'transform 100s';
|
||||
div.style.transform = 'translate(10px)';
|
||||
window.getComputedStyle(div).transform;
|
||||
getComputedStyle(div).transform;
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
var originalReadyPromise = animation.ready;
|
||||
|
@ -32,10 +32,10 @@ async_test(function(t) {
|
|||
|
||||
// Set up pending transition
|
||||
div.style.transform = 'translate(0px)';
|
||||
window.getComputedStyle(div).transform;
|
||||
getComputedStyle(div).transform;
|
||||
div.style.transition = 'transform 100s';
|
||||
div.style.transform = 'translate(10px)';
|
||||
window.getComputedStyle(div).transform;
|
||||
getComputedStyle(div).transform;
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(animation.playState, 'pending', 'Animation is initially pending');
|
||||
|
@ -54,7 +54,7 @@ async_test(function(t) {
|
|||
|
||||
// Now remove transform from transition-property and flush styles
|
||||
div.style.transitionProperty = 'none';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
|
||||
}, 'ready promise is rejected when a transition is cancelled by updating'
|
||||
+ ' transition-property');
|
||||
|
@ -64,10 +64,10 @@ async_test(function(t) {
|
|||
|
||||
// Set up pending transition
|
||||
div.style.marginLeft = '0px';
|
||||
window.getComputedStyle(div).marginLeft;
|
||||
getComputedStyle(div).marginLeft;
|
||||
div.style.transition = 'margin-left 100s';
|
||||
div.style.marginLeft = '100px';
|
||||
window.getComputedStyle(div).marginLeft;
|
||||
getComputedStyle(div).marginLeft;
|
||||
|
||||
var animation = div.getAnimations()[0];
|
||||
assert_equals(animation.playState, 'pending', 'Animation is initially pending');
|
||||
|
@ -86,7 +86,7 @@ async_test(function(t) {
|
|||
|
||||
// Now update the transition to animate to something not-interpolable
|
||||
div.style.marginLeft = 'auto';
|
||||
window.getComputedStyle(div).marginLeft;
|
||||
getComputedStyle(div).marginLeft;
|
||||
|
||||
}, 'ready promise is rejected when a transition is cancelled by changing'
|
||||
+ ' the transition property to something not interpolable');
|
||||
|
|
|
@ -10,7 +10,7 @@ test(function(t) {
|
|||
|
||||
// Add a transition
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.left = '100px';
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ test(function(t) {
|
|||
var div = addDiv(t);
|
||||
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'left 100s';
|
||||
div.style.left = '100px';
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ async_test(function(t) {
|
|||
// Add a couple of transitions
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.left = '100px';
|
||||
|
@ -66,11 +66,11 @@ async_test(function(t) {
|
|||
|
||||
// Add a very short transition
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).left;
|
||||
getComputedStyle(div).left;
|
||||
|
||||
div.style.transition = 'all 0.01s';
|
||||
div.style.left = '100px';
|
||||
window.getComputedStyle(div).left;
|
||||
getComputedStyle(div).left;
|
||||
}, 'getAnimations for CSS Transitions that have finished');
|
||||
|
||||
test(function(t) {
|
||||
|
@ -78,7 +78,7 @@ test(function(t) {
|
|||
|
||||
// Try to transition non-animatable property animation-duration
|
||||
div.style.animationDuration = '10s';
|
||||
window.getComputedStyle(div).animationDuration;
|
||||
getComputedStyle(div).animationDuration;
|
||||
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.animationDuration = '100s';
|
||||
|
@ -92,7 +92,7 @@ test(function(t) {
|
|||
var div = addDiv(t);
|
||||
|
||||
div.style.setProperty('-vendor-unsupported', '0px', '');
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.setProperty('-vendor-unsupported', '100px', '');
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ test(function(t) {
|
|||
var div = addDiv(t);
|
||||
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'left 100s';
|
||||
div.style.left = '100px';
|
||||
|
||||
|
@ -50,7 +50,7 @@ test(function(t) {
|
|||
var div = addDiv(t);
|
||||
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'left 100s steps(2,end)';
|
||||
div.style.left = '100px';
|
||||
|
||||
|
@ -72,7 +72,7 @@ test(function(t) {
|
|||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.left = '0px';
|
||||
window.getComputedStyle(div).transitionProperty;
|
||||
getComputedStyle(div).transitionProperty;
|
||||
div.style.transition = 'left 100s';
|
||||
div.style.left = 'var(--var-100px)';
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ promise_test(function(t) {
|
|||
transition.effect = null;
|
||||
assert_equals(transition.transitionProperty, 'left');
|
||||
assert_equals(transition.playState, 'finished');
|
||||
assert_equals(window.getComputedStyle(div).left, '100px');
|
||||
assert_equals(getComputedStyle(div).left, '100px');
|
||||
return watcher.wait_for('transitionend');
|
||||
});
|
||||
}, 'Test for removing a transition effect');
|
||||
|
@ -44,8 +44,8 @@ promise_test(function(t) {
|
|||
100 * MS_PER_SEC);
|
||||
assert_equals(transition.transitionProperty, 'left');
|
||||
assert_equals(transition.playState, 'running');
|
||||
assert_equals(window.getComputedStyle(div).left, '100px');
|
||||
assert_equals(window.getComputedStyle(div).marginLeft, '50px');
|
||||
assert_equals(getComputedStyle(div).left, '100px');
|
||||
assert_equals(getComputedStyle(div).marginLeft, '50px');
|
||||
});
|
||||
}, 'Test for replacing the transition effect by a new keyframe effect');
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ async_test(function(t) {
|
|||
var testToRunOnLoad = t.step_func(function() {
|
||||
// Remove display:none
|
||||
hiddenIFrame.style.display = 'block';
|
||||
window.getComputedStyle(hiddenIFrame).display;
|
||||
getComputedStyle(hiddenIFrame).display;
|
||||
|
||||
window.requestAnimationFrame(t.step_func(function() {
|
||||
assert_true(hiddenIFrame.contentDocument.timeline.currentTime > 0,
|
||||
|
@ -112,7 +112,7 @@ async_test(function(t) {
|
|||
|
||||
// Re-introduce display:none
|
||||
hiddenIFrame.style.display = 'none';
|
||||
window.getComputedStyle(hiddenIFrame).display;
|
||||
getComputedStyle(hiddenIFrame).display;
|
||||
|
||||
window.requestAnimationFrame(t.step_func(function() {
|
||||
assert_true(
|
||||
|
|
|
@ -37,7 +37,7 @@ function waitForPaints() {
|
|||
|
||||
promise_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
var cs = window.getComputedStyle(div);
|
||||
var cs = getComputedStyle(div);
|
||||
|
||||
// Test that empty animations actually start.
|
||||
//
|
||||
|
|
|
@ -252,7 +252,7 @@ function waitForAllAnimations(animations) {
|
|||
* we actually get a transition instead of that being the initial value.
|
||||
*/
|
||||
function flushComputedStyle(elem) {
|
||||
var cs = window.getComputedStyle(elem);
|
||||
var cs = getComputedStyle(elem);
|
||||
cs.marginLeft;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче