From 6431efef8cb6d0c77bf107b09b64b6f013b75965 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Fri, 26 Feb 2010 13:08:28 -0800 Subject: corrected repeater not removing when hash(instead of array) shrinks. --- test/BinderTest.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test') diff --git a/test/BinderTest.js b/test/BinderTest.js index d565ee30..9ddf38ab 100644 --- a/test/BinderTest.js +++ b/test/BinderTest.js @@ -503,6 +503,23 @@ BinderTest.prototype.testRepeaterAdd = function(){ assertEquals(doc.scope().get('items')[0].x, 'ABC'); }; +BinderTest.prototype.testItShouldRemoveExtraChildrenWhenIteratingOverHash = function(){ + var c = compile('
{{i}}
'); + var items = {}; + c.scope.set("items", items); + + c.binder.updateView(); + expect(c.node.find("div").size()).toEqual(0); + + items.name = "misko"; + c.binder.updateView(); + expect(c.node.find("div").size()).toEqual(1); + + delete items.name; + c.binder.updateView(); + expect(c.node.find("div").size()).toEqual(0); +}; + BinderTest.prototype.testIfTextBindingThrowsErrorDecorateTheSpan = function(){ var a = compile('
{{error.throw()}}
'); var doc = a.node.find('div'); -- cgit v1.2.3