test(scope): infinite digest test should pass on all browsers

Different browsers print function body differently, and best of all IE doesn't have
function.name property.
This commit is contained in:
Igor Minar 2011-10-31 12:46:00 -07:00
parent 84873e7f4e
commit c0b557a96c

View file

@ -237,15 +237,12 @@ describe('Scope', function() {
root.$watch(function() {return root.b;}, function(self){self.a++;});
root.a = root.b = 0;
expect(function() {
try {
root.$digest();
}).toThrow('100 $digest() iterations reached. Aborting!\n'+
'Watchers fired in the last 5 iterations: ' +
'[["fn: watcherA","fn: function () {return root.b;}"],'+
'["fn: watcherA","fn: function () {return root.b;}"],'+
'["fn: watcherA","fn: function () {return root.b;}"],'+
'["fn: watcherA","fn: function () {return root.b;}"],'+
'["fn: watcherA","fn: function () {return root.b;}"]]');
throw Error('Should have thrown exception');
} catch(e) {
expect(e.message.match(/"fn: (watcherA|function)/g).length).toBe(10);
}
});