diff options
| author | Rory Douglas | 2013-05-27 10:59:19 -0700 |
|---|---|---|
| committer | Igor Minar | 2013-07-24 14:16:26 -0700 |
| commit | 47a2a9829f0a847bbee61cd142c43000d73ea98b (patch) | |
| tree | 2c653f37275e297099d70549567152f7d7c4d802 /test/ng/directive/ngRepeatSpec.js | |
| parent | a13c01a8e48ea4a0d59394eb94f1b12c50cfef61 (diff) | |
| download | angular.js-47a2a9829f0a847bbee61cd142c43000d73ea98b.tar.bz2 | |
fix(ngRepeat): handle iteration over identical obj values
Modifies default trackByIdFn to factor both key and value into hashKey
for non-array primitive (i.e. index not provided) values
Closes #2787
Closes #2806
Diffstat (limited to 'test/ng/directive/ngRepeatSpec.js')
| -rw-r--r-- | test/ng/directive/ngRepeatSpec.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ng/directive/ngRepeatSpec.js b/test/ng/directive/ngRepeatSpec.js index 6506e060..0d1833c8 100644 --- a/test/ng/directive/ngRepeatSpec.js +++ b/test/ng/directive/ngRepeatSpec.js @@ -89,6 +89,15 @@ describe('ngRepeat', function() { expect(element.text()).toEqual('misko:swe|shyam:set|'); }); + it('should iterate over an object/map with identical values', function() { + element = $compile( + '<ul>' + + '<li ng-repeat="(key, value) in items">{{key}}:{{value}}|</li>' + + '</ul>')(scope); + scope.items = {age:20, wealth:20, prodname: "Bingo", dogname: "Bingo", codename: "20"}; + scope.$digest(); + expect(element.text()).toEqual('age:20|codename:20|dogname:Bingo|prodname:Bingo|wealth:20|'); + }); describe('track by', function() { it('should track using expression function', function() { |
