mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-23 05:25:47 +00:00
fix:exceptionHandler mock: should not specify dependencies
also added a test for this mock service
This commit is contained in:
parent
25a77c58c1
commit
30bd04feaa
2 changed files with 11 additions and 2 deletions
4
src/angular-mocks.js
vendored
4
src/angular-mocks.js
vendored
|
|
@ -246,8 +246,8 @@ angular.service('$browser', function(){
|
||||||
*
|
*
|
||||||
* See {@link angular.mock} for more info on angular mocks.
|
* See {@link angular.mock} for more info on angular mocks.
|
||||||
*/
|
*/
|
||||||
angular.service('$exceptionHandler', function(e) {
|
angular.service('$exceptionHandler', function() {
|
||||||
return function(e) {throw e;};
|
return function(e) { throw e;};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
9
test/angular-mocksSpec.js
vendored
9
test/angular-mocksSpec.js
vendored
|
|
@ -216,4 +216,13 @@ describe('mocks', function(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('$exceptionHandler', function() {
|
||||||
|
it('should rethrow exceptions', function() {
|
||||||
|
var rootScope = angular.scope(),
|
||||||
|
exHandler = rootScope.$service('$exceptionHandler');
|
||||||
|
|
||||||
|
expect(function() { exHandler('myException') }).toThrow('myException');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue