mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-13 09:13:12 +00:00
add $exceptionHandler service
This commit is contained in:
parent
a161a99ff8
commit
8ddee9bb25
2 changed files with 15 additions and 0 deletions
|
|
@ -75,6 +75,12 @@ angularService("$log", function($window){
|
||||||
};
|
};
|
||||||
}, {inject:['$window']});
|
}, {inject:['$window']});
|
||||||
|
|
||||||
|
angularService('$exceptionHandler', function($log){
|
||||||
|
return function(e) {
|
||||||
|
$log.error(e);
|
||||||
|
};
|
||||||
|
}, {inject:['$log']});
|
||||||
|
|
||||||
angularService("$hover", function(browser, document) {
|
angularService("$hover", function(browser, document) {
|
||||||
var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body);;
|
var tooltip, self = this, error, width = 300, arrowWidth = 10, body = jqLite(document[0].body);;
|
||||||
browser.hover(function(element, show){
|
browser.hover(function(element, show){
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,15 @@ describe("service", function(){
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("$exceptionHandler", function(){
|
||||||
|
it('should log errors', function(){
|
||||||
|
var error = '';
|
||||||
|
$log.error = function(m) { error += m; };
|
||||||
|
scope.$exceptionHandler('myError');
|
||||||
|
expect(error).toEqual('myError');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("$location", function(){
|
describe("$location", function(){
|
||||||
it("should inject $location", function(){
|
it("should inject $location", function(){
|
||||||
scope.$location.parse('http://host:123/p/a/t/h.html?query=value#path?key=value');
|
scope.$location.parse('http://host:123/p/a/t/h.html?query=value#path?key=value');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue