Browse files

Specs for #2081 - Element.fade visibility

  • Loading branch information...
1 parent 87b7ae3 commit d243f5c7d82f62667ff3fab58611d8b0a45dc03d @arian arian committed with cpojer Sep 21, 2011
Showing with 48 additions and 1 deletion.
  1. +46 −0 1.4client/Fx/Fx.Tween.js
  2. +2 −1 Configuration.js
View
46 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();
+
+ });
+
+ });
+
+});
View
3 Configuration.js
@@ -108,7 +108,8 @@ Configuration.sets = {
path: '1.4client/',
files: [
'Element/Element',
- 'Element/Element.Event'
+ 'Element/Element.Event',
+ 'Fx/Fx.Tween'
]
},

0 comments on commit d243f5c

Please sign in to comment.