added some tween unit tests. all tween methods now return this

This commit is contained in:
Eric Rowell
2013-06-04 22:39:11 -07:00
parent 05bc2e9d1f
commit 8a5ad235bd
2 changed files with 38 additions and 4 deletions

View File

@@ -25,6 +25,19 @@ Test.Modules.TWEEN = {
test(++finishCount <= 1, 'finishCount should not exceed 1');
}
var tweens = 0;
var attrs = 0;
for (var key in Kinetic.Tween.tweens) {
tweens++;
}
for (var key in Kinetic.Tween.attrs) {
attrs++;
}
test(tweens === 0, 'should be no tweens');
test(attrs === 0, 'should be no attrs');
var tween = new Kinetic.Tween({
node: circle,
duration: 0.2,
@@ -33,5 +46,20 @@ Test.Modules.TWEEN = {
onFinish: onFinish
}).play();
var tweens = 0;
var attrs = 0;
for (var key in Kinetic.Tween.tweens) {
tweens++;
}
for (var key in Kinetic.Tween.attrs[circle._id][tween._id]) {
attrs++;
}
test(tweens === 1, 'should one tween');
test(attrs === 2, 'should two attrs');
test(Kinetic.Tween.attrs[circle._id][tween._id].x !== undefined, 'x should not be undefined');
test(Kinetic.Tween.attrs[circle._id][tween._id].y !== undefined, 'y should not be undefined');
}
};