Skip to content
Browse files

Fixes #2160.

Adds coverage for Fx.Morph unit: %.
  • Loading branch information...
1 parent 2043a10 commit 25a996a3cab8f392b64380693c9c7ee1280e3899 @ibolmo committed Jan 29, 2012
Showing with 41 additions and 1 deletion.
  1. +39 −0 Specs/1.4client/Fx/Fx.Morph.js
  2. +2 −1 Specs/Configuration.js
View
39 Specs/1.4client/Fx/Fx.Morph.js
@@ -0,0 +1,39 @@
+
+describe('Fx.Morph', function(){
+
+ beforeEach(function(){
+ this.clock = sinon.useFakeTimers();
+
+ this.div = new Element('div', {'class': 'pos-abs-left'});
+ this.style = new Element('style', {html: [
+ '.pos-abs-left {',
+ 'position: absolute;',
+ 'width: 200px;',
+ 'height: 200px;',
+ 'left: 10%;',
+ 'background: red',
+ '}'
+ ].join('')});
+ [this.style, this.div].invoke('inject', document.body);
+ });
+
+ afterEach(function(){
+ this.clock.reset();
+ this.clock.restore();
+ [this.div, this.style].invoke('destroy');
+ });
+
+ it('should morph between % units', function(){
+ this.div.set('morph', {unit : '%'});
+
+ var spy = spyOn(this.div, 'setStyle').andCallThrough();
+
+ this.div.morph({'left': 50});
+
+ this.clock.tick(1000);
+ expect(this.div.setStyle).toHaveBeenCalledWith('left', ['10%']);
+ expect(this.div.setStyle).toHaveBeenCalledWith('left', ['50%']);
+
+ });
+
+});
View
3 Specs/Configuration.js
@@ -110,7 +110,8 @@ Configuration.sets = {
'Element/Element',
'Element/Element.Event',
'Element/Element.Delegation',
- 'Fx/Fx.Tween'
+ 'Fx/Fx.Tween',
+ 'Fx/Fx.Morph'
]
},

0 comments on commit 25a996a

Please sign in to comment.
Something went wrong with that request. Please try again.