Permalink
Browse files

Merge pull request #24 from ibolmo/fix-2100-ie-erase

Added Specs for Element.erase.
  • Loading branch information...
2 parents f1c8643 + 0f2f037 commit 4fcb6c31c0dc7cb68b270b19e533167ef9e33860 @cpojer cpojer committed Nov 29, 2011
Showing with 41 additions and 0 deletions.
  1. +41 −0 1.4client/Element/Element.js
@@ -172,4 +172,45 @@ describe('Element', function(){
});
+ describe('Element.erase', function(){
+
+ var elements, subject, image, textarea;
+
+ beforeEach(function(){
+ elements = [
+ subject = new Element('div'),
+ image = new Element('img'),
+ textarea = new Element('div', {html: '<textarea id="t1">hello</textarea>'}).getFirst()
+ ].invoke('inject', document.body);
+ });
+
+ afterEach(function(){
+ elements.invoke('destroy');
+ });
+
+ it('should erase the class of an Element', function(){
+ subject.set('class', 'test');
+ subject.erase('class');
+ expect(subject.get('class')).toEqual(null);
+ });
+
+ it('should erase the id of an Element', function(){
+ subject.set('id', 'test');
+ subject.erase('id');
+ expect(subject.get('id')).toEqual(null);
+ });
+
+ it('should erase the random attribute of an Element', function(){
+ subject.set('random', 'test');
+ subject.erase('random');
+ expect(subject.get('random')).toEqual(null);
+ });
+
+ it('should erase the value attribute of a textarea', function(){
+ textarea.erase('value');
+ expect(textarea.get('value')).toEqual('');
+ });
+
+ });
+
});

0 comments on commit 4fcb6c3

Please sign in to comment.