mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1104435 part 8 - Add tests for AnimationPlayer.ready; r=heycam
This commit is contained in:
parent
0ccfb345fc
commit
2667ce66c5
@ -0,0 +1,80 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<div id="log"></div>
|
||||
<style>
|
||||
@keyframes abc {
|
||||
to { transform: translate(10px) }
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'abc 100s';
|
||||
var player = div.getAnimationPlayers()[0];
|
||||
|
||||
var originalReadyPromise = player.ready;
|
||||
player.ready.then(function() {
|
||||
assert_equals(player.ready, originalReadyPromise,
|
||||
'Ready promise is the same object when playing completes');
|
||||
player.pause();
|
||||
// TODO: When we implement deferred pausing (bug 1109390), change this to
|
||||
// assert_not_equals and wait on the new promise before continuing.
|
||||
assert_equals(player.ready, originalReadyPromise,
|
||||
'Ready promise does not change when pausing (for now)');
|
||||
player.play();
|
||||
assert_not_equals(player.ready, originalReadyPromise,
|
||||
'Ready promise object identity differs after calling'
|
||||
+ ' play()');
|
||||
t.done();
|
||||
});
|
||||
}, 'A new ready promise is created each time play() is called'
|
||||
+ ' the animation property');
|
||||
|
||||
test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'abc 100s paused';
|
||||
var player = div.getAnimationPlayers()[0];
|
||||
|
||||
var originalReadyPromise = player.ready;
|
||||
div.style.animationPlayState = 'running';
|
||||
// FIXME: Flush style when fetching ready promise
|
||||
window.getComputedStyle(div).animationPlayState;
|
||||
assert_not_equals(player.ready, originalReadyPromise,
|
||||
'After updating animation-play-state a new ready promise'
|
||||
+ ' object is created');
|
||||
}, 'A new ready promise is created when setting animation-play-state: running');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'abc 100s';
|
||||
var player = div.getAnimationPlayers()[0];
|
||||
|
||||
player.ready.then(function() {
|
||||
var promiseBeforeCallingPlay = player.ready;
|
||||
player.play();
|
||||
assert_equals(player.ready, promiseBeforeCallingPlay,
|
||||
'Ready promise has same object identity after redundant call'
|
||||
+ ' to play()');
|
||||
t.done();
|
||||
});
|
||||
}, 'Redundant calls to play() do not generate new ready promise objects');
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.animation = 'abc 100s';
|
||||
var player = div.getAnimationPlayers()[0];
|
||||
|
||||
player.ready.then(function(resolvedPlayer) {
|
||||
assert_equals(resolvedPlayer, player,
|
||||
'Object identity of player passed to Promise callback'
|
||||
+ ' matches the player object owning the Promise');
|
||||
t.done();
|
||||
});
|
||||
}, 'The ready promise is fulfilled with its AnimationPlayer');
|
||||
|
||||
</script>
|
@ -0,0 +1,38 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
async_test(function(t) {
|
||||
var div = addDiv(t);
|
||||
div.style.transform = 'translate(0px)';
|
||||
window.getComputedStyle(div).transform;
|
||||
div.style.transition = 'transform 100s';
|
||||
div.style.transform = 'translate(10px)';
|
||||
window.getComputedStyle(div).transform;
|
||||
|
||||
var player = div.getAnimationPlayers()[0];
|
||||
var originalReadyPromise = player.ready;
|
||||
|
||||
player.ready.then(t.step_func(function() {
|
||||
assert_equals(player.ready, originalReadyPromise,
|
||||
'Ready promise is the same object when playing completes');
|
||||
player.pause();
|
||||
// TODO: When we implement deferred pausing, change this to
|
||||
// assert_not_equals and wait on the new promise before continuing.
|
||||
assert_equals(player.ready, originalReadyPromise,
|
||||
'Ready promise does not change when pausing (for now)');
|
||||
player.play();
|
||||
assert_not_equals(player.ready, originalReadyPromise,
|
||||
'Ready promise object identity differs after calling'
|
||||
+ ' play()');
|
||||
t.done();
|
||||
}));
|
||||
}, 'A new ready promise is created each time play() is called'
|
||||
+ ' the animation property');
|
||||
|
||||
</script>
|
@ -8,11 +8,13 @@ skip-if = buildapp == 'mulet'
|
||||
[css-animations/test_animation-effect-name.html]
|
||||
[css-animations/test_animation-pausing.html]
|
||||
[css-animations/test_animation-player-playstate.html]
|
||||
[css-animations/test_animation-player-ready.html]
|
||||
[css-animations/test_animation-target.html]
|
||||
[css-animations/test_element-get-animation-players.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
[css-transitions/test_animation-effect-name.html]
|
||||
[css-transitions/test_animation-pausing.html]
|
||||
[css-transitions/test_animation-player-ready.html]
|
||||
[css-transitions/test_animation-target.html]
|
||||
[css-transitions/test_element-get-animation-players.html]
|
||||
skip-if = buildapp == 'mulet'
|
||||
|
Loading…
Reference in New Issue
Block a user