Skip to content

Commit

Permalink
Specs for mootools#2081 - Element.fade visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Arian authored and cpojer committed Sep 21, 2011
1 parent 87b7ae3 commit d243f5c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
46 changes: 46 additions & 0 deletions 1.4client/Fx/Fx.Tween.js
@@ -0,0 +1,46 @@
/*
---
name: Fx Specs
description: n/a
requires: [Core/Fx.Tween]
provides: [Fx.Tween.Specs]
...
*/
describe('Fx.Tween', function(){

beforeEach(function(){
this.clock = sinon.useFakeTimers();
});

afterEach(function(){
this.clock.reset();
this.clock.restore();
});

describe('Element.fade', function(){

it('Should set the visibility style', function(){

var element = new Element('div', {styles: {'visibility': 'visible'}}).inject(document.body);

expect(element.getStyles('opacity', 'visibility')).toEqual({opacity: 1, visibility: 'visible'});

element.fade(0.5);
this.clock.tick(600);
expect(element.getStyles('opacity', 'visibility')).toEqual({opacity: 0.5, visibility: 'visible'});

element.fade(0);
this.clock.tick(600);
expect(element.getStyles('opacity', 'visibility')).toEqual({opacity: 0, visibility: 'hidden'});

element.fade(1);
this.clock.tick(600);
expect(element.getStyles('opacity', 'visibility')).toEqual({opacity: 1, visibility: 'visible'});

element.destroy();

});

});

});
3 changes: 2 additions & 1 deletion Configuration.js
Expand Up @@ -108,7 +108,8 @@ Configuration.sets = {
path: '1.4client/',
files: [
'Element/Element',
'Element/Element.Event'
'Element/Element.Event',
'Fx/Fx.Tween'
]
},

Expand Down

0 comments on commit d243f5c

Please sign in to comment.