From 41e437aff609ff8b8dd161e15f432b0181e37092 Mon Sep 17 00:00:00 2001 From: Tim Wienk Date: Wed, 15 Sep 2010 11:31:44 +0200 Subject: [PATCH] Spec for Elements.prototype.erase. --- 1.3client/Element/Element.js | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/1.3client/Element/Element.js b/1.3client/Element/Element.js index 2737ca8e..a10f9776 100644 --- a/1.3client/Element/Element.js +++ b/1.3client/Element/Element.js @@ -125,4 +125,27 @@ describe('Element traversal', function(){ expect(anchor.getParent('div > span')).toBe(span); }); -}); \ No newline at end of file +}); + +describe('Elements.prototype.erase', function(){ + + var element = new Element('div', { + html: '

' + }); + + var original = element.getChildren(); + var altered = element.getChildren().erase(original[1]); + + it('should decrease the length of the collection', function(){ + expect(altered.length).toEqual(2); + }); + + it('should remove an element from the collection', function(){ + expect(altered[1]).toEqual(original[2]); + }); + + it('should remove the last element from the collection', function(){ + expect(altered[2]).toEqual(undefined); + }); + +}); -- 2.11.4.GIT