aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorIgor Minar2011-01-24 15:30:28 -0800
committerIgor Minar2011-01-25 20:49:25 -0800
commit9368ea38141b8fda1524fdc34c38ecee16ee2afe (patch)
tree958e25b0f6bb68765e9bb97cba1259964107598e /test
parenta6a4c18ecd9df54f554bca1fd596905acd83585a (diff)
downloadangular.js-9368ea38141b8fda1524fdc34c38ecee16ee2afe.tar.bz2
Scope should retrieve $log and $exceptionHandler via $service
- fix $log and $exceptionHandler retrieval - remove reference to non-existent `error` handler - update tests
Diffstat (limited to 'test')
-rw-r--r--test/ScopeSpec.js18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js
index ee7c1c47..8984f605 100644
--- a/test/ScopeSpec.js
+++ b/test/ScopeSpec.js
@@ -163,13 +163,13 @@ describe('scope/model', function(){
});
it('should report error on $excetionHandler', function(){
- var element = jqLite('<div></div>');
- var scope = createScope();
- scope.$exceptionHandler = function(e){
- this.error = e;
- };
+ var errors = [],
+ errorLogs = [],
+ scope = createScope(null, {}, {$exceptionHandler: function(e) {errors.push(e)},
+ $log: {error: function(e) {errorLogs.push(e)}}});
scope.$tryEval(function(){throw "myError";});
- expect(scope.error).toEqual("myError");
+ expect(errors).toEqual(["myError"]);
+ expect(errorLogs).toEqual(["myError"]);
});
});
@@ -215,8 +215,8 @@ describe('scope/model', function(){
});
describe('$new', function(){
- it('should $new should create new child scope and $become controller', function(){
- var parent = createScope(null, {exampleService: function(){return 'Example Service';}});
+ it('should create new child scope and $become controller', function(){
+ var parent = createScope(null, angularService, {exampleService: 'Example Service'});
var child = parent.$new(temp.InjectController, 10);
expect(child.localService).toEqual('Example Service');
expect(child.extra).toEqual(10);
@@ -229,7 +229,7 @@ describe('scope/model', function(){
describe('$become', function(){
it('should inject properties on controller defined in $inject', function(){
- var parent = createScope(null, {exampleService: function(){return 'Example Service';}});
+ var parent = createScope(null, angularService, {exampleService: 'Example Service'});
var child = createScope(parent);
child.$become(temp.InjectController, 10);
expect(child.localService).toEqual('Example Service');