aboutsummaryrefslogtreecommitdiffstats
path: root/test/widgetsSpec.js
diff options
context:
space:
mode:
authorIgor Minar2012-01-05 23:03:45 -0800
committerIgor Minar2012-01-06 12:19:39 -0800
commitcd9a7b9608707c34bec2316ee8c789a617d22a7b (patch)
tree407b7260e8159fe0c9aeaf301e067a7f9a5b1149 /test/widgetsSpec.js
parent1dccaaaaa27a4db91d5271438688bc96e199e561 (diff)
downloadangular.js-cd9a7b9608707c34bec2316ee8c789a617d22a7b.tar.bz2
fix(ng:repeat): support repeating over array with null
typeof null == 'object', but it doesn't behave like an object because its properties can't be dereferenced, so we need to special-case it. Closes #702
Diffstat (limited to 'test/widgetsSpec.js')
-rw-r--r--test/widgetsSpec.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js
index d2867d09..3b53c7d2 100644
--- a/test/widgetsSpec.js
+++ b/test/widgetsSpec.js
@@ -429,6 +429,14 @@ describe('widget', function() {
expect(element.text()).toBe('a|b|||c||d|');
}));
+ it('should iterate over all kinds of types', inject(function($rootScope, $compile) {
+ var element = $compile('<ul><li ng:repeat="item in array">{{item}}|</li></ul>')($rootScope);
+ $rootScope.array = ['a', 1, null, undefined, {}];
+ $rootScope.$digest();
+
+ expect(element.text()).toMatch(/a\|1\|\|\|\{\s*\}\|/);
+ }));
+
describe('stability', function() {
var a, b, c, d, lis, element;