2011-07-17 08:05:43 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
2011-02-15 06:12:45 +00:00
|
|
|
describe('$exceptionHandler', function() {
|
|
|
|
|
var scope;
|
|
|
|
|
|
|
|
|
|
beforeEach(function(){
|
|
|
|
|
scope = angular.scope();
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
afterEach(function(){
|
|
|
|
|
dealoc(scope);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should log errors', function(){
|
2011-03-23 16:33:29 +00:00
|
|
|
var scope = createScope({$exceptionHandler: $exceptionHandlerFactory},
|
|
|
|
|
{$log: $logMock}),
|
2011-02-15 06:12:45 +00:00
|
|
|
$log = scope.$service('$log'),
|
|
|
|
|
$exceptionHandler = scope.$service('$exceptionHandler');
|
|
|
|
|
|
2011-03-23 16:33:29 +00:00
|
|
|
$log.error.rethrow = false;
|
2011-02-15 06:12:45 +00:00
|
|
|
$exceptionHandler('myError');
|
|
|
|
|
expect($log.error.logs.shift()).toEqual(['myError']);
|
|
|
|
|
});
|
|
|
|
|
});
|