now I'm using only non-legacy

This commit is contained in:
Francisco Dans 2015-08-05 12:49:02 +02:00
parent 288321b383
commit 5be36ca15a

View File

@ -2,12 +2,13 @@ var torque = require('../lib/torque');
var sinon = require('sinon'); var sinon = require('sinon');
require('phantomjs-polyfill'); require('phantomjs-polyfill');
asyncTest('time moves', function(assert) { test('time moves', function(assert) {
var done = assert.async();
var animator = new torque.Animator(function(){}, {steps: 500, animationDuration: 10}); var animator = new torque.Animator(function(){}, {steps: 500, animationDuration: 10});
animator.start(); animator.start();
setTimeout(function(){ setTimeout(function(){
assert.notEqual(animator._time, 0); assert.notEqual(animator._time, 0);
QUnit.start(); done();
}, 100) }, 100)
animator.pause(); animator.pause();
}); });
@ -58,25 +59,27 @@ test("altering steps should rescale", function(assert){
assert.ok(animator.rescale.calledOnce); assert.ok(animator.rescale.calledOnce);
}); });
asyncTest("tick should set time to zero if steps are bigger than range", function(assert){ test("tick should set time to zero if steps are bigger than range", function(assert){
var done = assert.async();
var animator = new torque.Animator(function(){}, {steps: 500, animationDuration: 10}); var animator = new torque.Animator(function(){}, {steps: 500, animationDuration: 10});
animator.start(); animator.start();
setTimeout(function(){ setTimeout(function(){
animator._time = 0; animator._time = 0;
animator.step(800); animator.step(800);
assert.ok(animator.step() < 800); assert.ok(animator.step() < 800);
QUnit.start(); done();
}, 200); }, 200);
animator.pause(); animator.pause();
}); });
asyncTest("tick should pause animation on end if loop is disabled", function(assert){ test("tick should pause animation on end if loop is disabled", function(assert){
var done = assert.async();
var animator = new torque.Animator(function(){}, {steps: 500, animationDuration: 10}); var animator = new torque.Animator(function(){}, {steps: 500, animationDuration: 10});
animator.options.loop = false; animator.options.loop = false;
animator.toggle(); animator.toggle();
animator.step(600); animator.step(600);
setTimeout(function(){ setTimeout(function(){
assert.equal(animator._time,animator.options.animationDuration); assert.equal(animator._time,animator.options.animationDuration);
QUnit.start(); done();
}, 200); }, 200);
}); });