diff options
| author | Misko Hevery | 2010-05-19 13:24:20 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-05-19 13:24:37 -0700 |
| commit | 80e12276f423a0dcb486b1191857db96a0ba0a93 (patch) | |
| tree | 8ae60aa72f804db3e89b02b2b2538e63d67fa58d /test/servicesSpec.js | |
| parent | 31b35b141f52e6f5d3805d6ca4f2702aee05d61d (diff) | |
| download | angular.js-80e12276f423a0dcb486b1191857db96a0ba0a93.tar.bz2 | |
added $log to console connection
Diffstat (limited to 'test/servicesSpec.js')
| -rw-r--r-- | test/servicesSpec.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 60b465d2..45993490 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -31,6 +31,37 @@ describe("service", function(){ scope.$document.addStyleSheet('css/angular.css'); }); + describe("$log", function(){ + it('should use console if present', function(){ + function log(){}; + function warn(){}; + function info(){}; + function error(){}; + var scope = createScope(null, angularService, {$window: {console:{log:log, warn:warn, info:info, error:error}}}); + expect(scope.$log.log).toEqual(log); + expect(scope.$log.warn).toEqual(warn); + expect(scope.$log.info).toEqual(info); + expect(scope.$log.error).toEqual(error); + }); + + it('should use console.log if other not present', function(){ + function log(){}; + var scope = createScope(null, angularService, {$window: {console:{log:log}}}); + expect(scope.$log.log).toEqual(log); + expect(scope.$log.warn).toEqual(log); + expect(scope.$log.info).toEqual(log); + expect(scope.$log.error).toEqual(log); + }); + + it('should use noop if no console', function(){ + var scope = createScope(null, angularService, {$window: {}}); + expect(scope.$log.log).toEqual(noop); + expect(scope.$log.warn).toEqual(noop); + expect(scope.$log.info).toEqual(noop); + expect(scope.$log.error).toEqual(noop); + }); + }); + describe("$location", function(){ it("should inject $location", function(){ scope.$location.parse('http://host:123/p/a/t/h.html?query=value#path?key=value'); |
