aboutsummaryrefslogtreecommitdiffstats
path: root/test/servicesSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2010-07-20 17:03:34 -0700
committerMisko Hevery2010-07-20 17:03:34 -0700
commit0f4b068bd66cde63b222b114dbc1c5fec257a890 (patch)
tree3dd93aef23e52c031fca69725b2729f614b734ef /test/servicesSpec.js
parentbebfbeac0a3f25b3d0df00ada5c919adef9dd701 (diff)
downloadangular.js-0f4b068bd66cde63b222b114dbc1c5fec257a890.tar.bz2
fix test
Diffstat (limited to 'test/servicesSpec.js')
-rw-r--r--test/servicesSpec.js38
1 files changed, 21 insertions, 17 deletions
diff --git a/test/servicesSpec.js b/test/servicesSpec.js
index 32e7812a..90f3d12b 100644
--- a/test/servicesSpec.js
+++ b/test/servicesSpec.js
@@ -33,32 +33,36 @@ describe("service", function(){
describe("$log", function(){
it('should use console if present', function(){
- function log(){};
- function warn(){};
- function info(){};
- function error(){};
+ var logger = "";
+ function log(){ logger+= 'log;'; };
+ function warn(){ logger+= 'warn;'; };
+ function info(){ logger+= 'info;'; };
+ function error(){ logger+= '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);
+ scope.$log.log();
+ scope.$log.warn();
+ scope.$log.info();
+ scope.$log.error();
+ expect(logger).toEqual('log;warn;info;error;');
});
it('should use console.log if other not present', function(){
- function log(){};
+ var logger = "";
+ function log(){ logger+= '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);
+ scope.$log.log();
+ scope.$log.warn();
+ scope.$log.info();
+ scope.$log.error();
+ expect(logger).toEqual('log;log;log;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);
+ scope.$log.log();
+ scope.$log.warn();
+ scope.$log.info();
+ scope.$log.error();
});
});