From 70e401ef100614295fc808e32f0142f07c315461 Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Thu, 15 Apr 2010 14:17:33 -0700 Subject: added $route service --- test/ScopeSpec.js | 10 ++++++++++ test/angular-mocks.js | 23 +++++++++++++++++++++++ test/servicesSpec.js | 38 ++++++++++++++++++++++++++++++++++++++ test/testabilityPatch.js | 27 ++++++++++++++++++++++----- 4 files changed, 93 insertions(+), 5 deletions(-) (limited to 'test') diff --git a/test/ScopeSpec.js b/test/ScopeSpec.js index 0665968b..23638b27 100644 --- a/test/ScopeSpec.js +++ b/test/ScopeSpec.js @@ -82,6 +82,16 @@ describe('scope/model', function(){ expect(element.hasClass('ng-exception')).toBeTruthy(); }); + it('should report error on $excetionHandler', function(){ + var element = jqLite('
'); + var scope = createScope(); + scope.$exceptionHandler = function(e){ + this.error = e; + }; + scope.$tryEval('throw "myError"'); + expect(scope.error).toEqual("myError"); + }); + // $onEval it("should eval using priority", function(){ diff --git a/test/angular-mocks.js b/test/angular-mocks.js index 88552aad..3e272313 100644 --- a/test/angular-mocks.js +++ b/test/angular-mocks.js @@ -1,3 +1,26 @@ +/** + * The MIT License + * + * Copyright (c) 2010 Adam Abrons and Misko Hevery http://getangular.com + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ function MockBrowser() { var self = this, expectations = {}, requests = []; diff --git a/test/servicesSpec.js b/test/servicesSpec.js index 618d9a15..715a232e 100644 --- a/test/servicesSpec.js +++ b/test/servicesSpec.js @@ -99,3 +99,41 @@ describe("service $invalidWidgets", function(){ expect(scope.$invalidWidgets.length).toEqual(0); }); }); + +describe("service $route", function(){ + it('should route and fire change event', function(){ + var log = ''; + function BookChapter() { + this.log = '