Skip to content

Commit

Permalink
align tests and animate method
Browse files Browse the repository at this point in the history
  • Loading branch information
basecode committed Aug 28, 2012
1 parent 16b3c8b commit a936e06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/runner/display_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ define([
animation = new Animation(clock, duration, properties, options);
}

animation.play(this);
animation.addSubject(this).play();
return this;
}
};
Expand Down
26 changes: 13 additions & 13 deletions test/animation/animation-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ require([
var anim = createAnimation();
var listener = jasmine.createSpy('listener');
anim.on('play', listener);
anim.play({}, 'prop');
anim.play();

expect(listener).toHaveBeenCalled();
});
it('should play', function() {
var anim = createAnimation();
anim.play({}, 'prop');
anim.play();
expect(anim.isPlaying).toBeTruthy();
});
});
Expand All @@ -110,14 +110,14 @@ require([
var anim = createAnimation();
var listener = jasmine.createSpy('listener');
anim.on('pause', listener);
anim.play({}, 'prop');
anim.play();
anim.pause();

expect(listener).toHaveBeenCalled();
});
it('should stop', function() {
var anim = createAnimation();
anim.play({}, 'prop');
anim.play();
anim.pause();
expect(anim.isPlaying).toBeFalsy();
});
Expand All @@ -129,7 +129,7 @@ require([
var result = 0;
anim.on('beforebegin', function(){ result += 1; });
anim.on('play', function(){ result *= 2; } );
anim.play({}, 'prop');
anim.play();
expect(result).toBe(2);
});
});
Expand Down Expand Up @@ -199,15 +199,15 @@ require([
var anim = createAnimation('50ms', {
foo: 1000,
bar: -777,
far: .053
far: 0.053
});
anim.setSubjects(subject, 'prop');
anim.play();
async(function(next) {
anim.on('end', function() {
expect(subject.foo).toBe(1000);
expect(subject.bar).toBe(-777);
expect(subject.far).toBeCloseTo(.053);
expect(subject.far).toBeCloseTo(0.053);
next();
});
});
Expand Down Expand Up @@ -252,7 +252,7 @@ require([
next();
});
});
})
});
});

describe('Path - morphing', function() {
Expand All @@ -261,18 +261,18 @@ require([
return segments.map(function(seg){
return [].slice.call(seg).map(function(arg){
return isNaN(arg) ? arg : arg.toFixed(5);
})
});
});
}

describe('morphTo', function() {

var source = new Path().moveTo(01, 01).lineTo(100, 50).arcTo(10, 10, 0, 0, 0, 20, 20),
var source = new Path().moveTo(1, 1).lineTo(100, 50).arcTo(10, 10, 0, 0, 0, 20, 20),
sourceClone = source.clone(),
target = new Path().moveTo(20, 20).lineTo(200, 11).arcTo(22, 33, 0, 0, 0, 30, 30);

source.attr({strokeColor: 'red', opacity: .5});
target.attr({strokeColor: 'blue', opacity: .5});
source.attr({strokeColor: 'red', opacity: 0.5});
target.attr({strokeColor: 'blue', opacity: 0.5});

it('Should morph a source to the target segments', function() {

Expand All @@ -290,7 +290,7 @@ require([
sensibleCopyOfSegments(target._segments)
);
expect(+source.attr('strokeColor')).toBe(+color('blue'));
expect(source.attr('opacity')).toBe(.5);
expect(source.attr('opacity')).toBe(0.5);
next();
}
});
Expand Down

0 comments on commit a936e06

Please sign in to comment.