Skip to content

Rename tests #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: Rename
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
};

if (WEB_ANIMATIONS_TESTING) {
testing.Player = scope.Animation;
testing.webAnimations1Animation = scope.Animation;
}

})(webAnimations1, webAnimationsTesting);
2 changes: 1 addition & 1 deletion src/keyframe-effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
};

if (WEB_ANIMATIONS_TESTING) {
testing.webAnimations1Animation = scope.KeyframeEffect;
testing.webAnimations1KeyframeEffect = scope.KeyframeEffect;
}

})(webAnimationsShared, webAnimations1, webAnimationsTesting);
12 changes: 6 additions & 6 deletions target-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,28 @@
'src/group-constructors.js'];

var webAnimations1Test = [
'test/js/animation-node.js',
'test/js/animation-finish-event.js',
'test/js/animation.js',
'test/js/apply-preserving-inline-style.js',
'test/js/box-handler.js',
'test/js/color-handler.js',
'test/js/dimension-handler.js',
'test/js/effect-node.js',
'test/js/effect.js',
'test/js/interpolation.js',
'test/js/matrix-interpolation.js',
'test/js/number-handler.js',
'test/js/player.js',
'test/js/player-finish-event.js',
'test/js/property-interpolation.js',
'test/js/tick.js',
'test/js/timing.js',
'test/js/transform-handler.js'];

var webAnimationsNextTest = webAnimations1Test.concat(
'test/js/animation-constructor.js',
'test/js/effect-callback.js',
'test/js/group-animation-finish-event.js',
'test/js/group-animation.js',
'test/js/group-constructors.js',
'test/js/group-player.js',
'test/js/group-player-finish-event.js',
'test/js/keyframe-effect-constructor.js',
'test/js/timeline.js');

// This object specifies the source and test files for different Web Animation build targets.
Expand Down
80 changes: 0 additions & 80 deletions test/js/animation-constructor.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
suite('player-finish-event', function() {
suite('animation-finish-event', function() {
setup(function() {
this.element = document.createElement('div');
document.documentElement.appendChild(this.element);
this.player = this.element.animate([], 1000);
this.animation = this.element.animate([], 1000);
});
teardown(function() {
if (this.element.parent)
this.element.removeChild(this.target);
});

test('fire when player completes', function(done) {
test('fire when animation completes', function(done) {
var ready = false;
var fired = false;
var player = this.player;
player.onfinish = function(event) {
var animation = this.animation;
animation.onfinish = function(event) {
assert(ready, 'must not be called synchronously');
assert.equal(this, player);
assert.equal(event.target, player);
assert.equal(this, animation);
assert.equal(event.target, animation);
assert.equal(event.currentTime, 1000);
assert.equal(event.timelineTime, 1100);
if (fired)
Expand All @@ -30,27 +30,27 @@ suite('player-finish-event', function() {
ready = true;
});

test('fire when reversed player completes', function(done) {
this.player.onfinish = function(event) {
test('fire when reversed animation completes', function(done) {
this.animation.onfinish = function(event) {
assert.equal(event.currentTime, 0);
assert.equal(event.timelineTime, 1001);
done();
};
tick(0);
tick(500);
this.player.reverse();
this.animation.reverse();
tick(501);
tick(1001);
});

test('fire after player is cancelled', function(done) {
this.player.onfinish = function(event) {
test('fire after animation is cancelled', function(done) {
this.animation.onfinish = function(event) {
assert.equal(event.currentTime, 0);
assert.equal(event.timelineTime, 1, 'event must be fired on next sample');
done();
};
tick(0);
this.player.cancel();
this.animation.cancel();
tick(1);
});

Expand All @@ -63,17 +63,17 @@ suite('player-finish-event', function() {
};
}
var toRemove = createHandler(0);
this.player.addEventListener('finish', createHandler(1));
this.player.addEventListener('finish', createHandler(2));
this.player.addEventListener('finish', toRemove);
this.player.addEventListener('finish', createHandler(3));
this.player.removeEventListener('finish', toRemove);
this.player.onfinish = function() {
this.animation.addEventListener('finish', createHandler(1));
this.animation.addEventListener('finish', createHandler(2));
this.animation.addEventListener('finish', toRemove);
this.animation.addEventListener('finish', createHandler(3));
this.animation.removeEventListener('finish', toRemove);
this.animation.onfinish = function() {
assert.equal(count, 3);
done();
};
tick(0);
this.player.cancel();
this.animation.cancel();
tick(1000);
});
});
Loading