diff options
| author | Vojta Jina | 2011-07-12 02:18:17 +0200 | 
|---|---|---|
| committer | Vojta Jina | 2011-09-08 23:00:59 +0200 | 
| commit | 22cb600280cecabf719ba1878719c907aa01ba18 (patch) | |
| tree | 3c2247033a6d722e3b4eea0720ab466589ea247e /test/widgetsSpec.js | |
| parent | 5ba227c7cd3ddfcd3bffc3fd15daf8d6ec9b8713 (diff) | |
| download | angular.js-22cb600280cecabf719ba1878719c907aa01ba18.tar.bz2 | |
fix($route): update $route to reflect $location changes
* update $route to reflect new $location
* add some more unit tests to $route
* fix some other failing unit tests
* redirect overrides the url now
Breaks $route custom redirect fn has only 3 params now
Diffstat (limited to 'test/widgetsSpec.js')
| -rw-r--r-- | test/widgetsSpec.js | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index dd23ed77..6d6e47c6 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -1117,7 +1117,7 @@ describe("widget", function(){      it('should do nothing when no routes are defined', function() { -      $location.updateHash('/unknown'); +      $location.path('/unknown');        rootScope.$digest();        expect(rootScope.$element.text()).toEqual('');      }); @@ -1129,14 +1129,14 @@ describe("widget", function(){        expect(rootScope.$element.text()).toEqual(''); -      $location.updateHash('/foo'); +      $location.path('/foo');        $browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>');        rootScope.$digest();        rootScope.$digest();        $browser.xhr.flush();        expect(rootScope.$element.text()).toEqual('4'); -      $location.updateHash('/bar'); +      $location.path('/bar');        $browser.xhr.expectGET('myUrl2').respond('angular is da best');        rootScope.$digest();        rootScope.$digest(); @@ -1147,14 +1147,14 @@ describe("widget", function(){      it('should remove all content when location changes to an unknown route', function() {        $route.when('/foo', {controller: angular.noop, template: 'myUrl1'}); -      $location.updateHash('/foo'); +      $location.path('/foo');        $browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>');        rootScope.$digest();        rootScope.$digest();        $browser.xhr.flush();        expect(rootScope.$element.text()).toEqual('4'); -      $location.updateHash('/unknown'); +      $location.path('/unknown');        rootScope.$digest();        rootScope.$digest();        expect(rootScope.$element.text()).toEqual(''); @@ -1164,7 +1164,7 @@ describe("widget", function(){        $route.when('/foo', {controller: angular.noop, template: 'myUrl1'});        rootScope.parentVar = 'parent'; -      $location.updateHash('/foo'); +      $location.path('/foo');        $browser.xhr.expectGET('myUrl1').respond('<div>{{parentVar}}</div>');        rootScope.$digest();        rootScope.$digest(); @@ -1183,7 +1183,7 @@ describe("widget", function(){        var myApp = angular.scope();        var $browser = myApp.$service('$browser');        $browser.xhr.expectGET('includePartial.html').respond('view: <ng:view></ng:view>'); -      $browser.url('http://server/#/foo'); +      myApp.$service('$location').path('/foo');        var $route = myApp.$service('$route');        $route.when('/foo', {controller: angular.noop, template: 'viewPartial.html'}); @@ -1220,7 +1220,7 @@ describe("widget", function(){          this.log.push('child');        }; -      $location.updateHash('/foo'); +      $location.path('/foo');        $browser.xhr.expectGET('viewPartial.html').            respond('<div ng:init="log.push(\'init\')">' +                      '<div ng:controller="ChildCtrl"></div>' + @@ -1230,12 +1230,12 @@ describe("widget", function(){        expect(rootScope.log).toEqual(['parent', 'init', 'child']); -      $location.updateHash(''); +      $location.path('/');        rootScope.$apply();        expect(rootScope.log).toEqual(['parent', 'init', 'child']);        rootScope.log = []; -      $location.updateHash('/foo'); +      $location.path('/foo');        rootScope.$apply();        $browser.defer.flush();  | 
