diff options
| author | Igor Minar | 2012-11-23 22:43:30 +0100 |
|---|---|---|
| committer | Igor Minar | 2012-11-26 20:36:53 +0100 |
| commit | 1b17dfa693c36607ea86c7129a8612f7771c2f22 (patch) | |
| tree | 7889c3c35598a93ca715c1c3d8dc22ee129bece9 /test/ng | |
| parent | e6d9bea4f3b2eb28851298d3dc3a30d46062d58a (diff) | |
| download | angular.js-1b17dfa693c36607ea86c7129a8612f7771c2f22.tar.bz2 | |
fix(ngRepeat): support mostly-stable repeating for primitives
I'm reverting changes that were originally done to ngRepeat to fix #933,
because these are now not necessary after the previous changes to keep
ngModel always synced with the DOM.
Diffstat (limited to 'test/ng')
| -rw-r--r-- | test/ng/directive/ngRepeatSpec.js | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index 5442ff39..a45cd972 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -431,5 +431,23 @@ describe('ngRepeat', function() { expect(newElements[1]).toEqual(lis[1]); expect(newElements[2]).toEqual(lis[0]); }); + + + it('should reuse elements even when model is composed of primitives', function() { + // rebuilding repeater from scratch can be expensive, we should try to avoid it even for + // model that is composed of primitives. + + scope.items = ['hello', 'cau', 'ahoj']; + scope.$digest(); + lis = element.find('li'); + + scope.items = ['ahoj', 'hello', 'cau']; + scope.$digest(); + var newLis = element.find('li'); + expect(newLis.length).toEqual(3); + expect(newLis[0]).toEqual(lis[2]); + expect(newLis[1]).toEqual(lis[0]); + expect(newLis[2]).toEqual(lis[1]); + }); }); }); |
