diff options
author | Misko Hevery | 2010-02-26 13:08:28 -0800 |
---|---|---|
committer | Misko Hevery | 2010-02-26 13:08:28 -0800 |
commit | 6431efef8cb6d0c77bf107b09b64b6f013b75965 (patch) | |
tree | 166d703a5ff1015d282d41ce529c0f091fb503ba /test/BinderTest.js | |
parent | b628de9758c313b106d22468f4b49bd223698fd5 (diff) | |
download | angular.js-6431efef8cb6d0c77bf107b09b64b6f013b75965.tar.bz2 |
corrected repeater not removing when hash(instead of array) shrinks.
Diffstat (limited to 'test/BinderTest.js')
-rw-r--r-- | test/BinderTest.js | 17 |
1 files changed, 17 insertions, 0 deletions
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('<div ng-repeat="i in items">{{i}}</div>'); + 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('<div>{{error.throw()}}</div>'); var doc = a.node.find('div'); |