mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
feature($exceptionHandler): $exceptionHandler now supports var_args
This commit is contained in:
3
test/angular-mocksSpec.js
vendored
3
test/angular-mocksSpec.js
vendored
@@ -307,6 +307,9 @@ describe('ngMock', function() {
|
||||
var $exceptionHandler = $exceptionHandlerProvider.$get();
|
||||
$exceptionHandler('MyError');
|
||||
expect($exceptionHandler.errors).toEqual(['MyError']);
|
||||
|
||||
$exceptionHandler('MyError', 'comment');
|
||||
expect($exceptionHandler.errors[1]).toEqual(['MyError', 'comment']);
|
||||
}));
|
||||
|
||||
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
'use strict';
|
||||
|
||||
describe('$exceptionHandler', function() {
|
||||
it('should log errors with single argument', function() {
|
||||
module(function($provide){
|
||||
$provide.service('$exceptionHandler', $ExceptionHandlerProvider);
|
||||
});
|
||||
inject(function($log, $exceptionHandler) {
|
||||
$exceptionHandler('myError');
|
||||
expect($log.error.logs.shift()).toEqual(['myError']);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('should log errors', function() {
|
||||
module(function($provide){
|
||||
$provide.service('$exceptionHandler', $ExceptionHandlerProvider);
|
||||
it('should log errors with multiple arguments', function() {
|
||||
module(function($provide){
|
||||
$provide.service('$exceptionHandler', $ExceptionHandlerProvider);
|
||||
});
|
||||
inject(function($log, $exceptionHandler) {
|
||||
$exceptionHandler('myError', 'comment');
|
||||
expect($log.error.logs.shift()).toEqual(['myError', 'comment']);
|
||||
});
|
||||
});
|
||||
inject(function($log, $exceptionHandler) {
|
||||
$exceptionHandler('myError');
|
||||
expect($log.error.logs.shift()).toEqual(['myError']);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user