From bb948176aaf6748c0d27772797b4c1490612b917 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 26 Oct 2011 11:38:04 -0700 Subject: test(ng:view): spec cleanup - remove optional controller definition from specs - remove extranious digest calls --- test/widgetsSpec.js | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/test/widgetsSpec.js b/test/widgetsSpec.js index 90555325..adbdf94e 100644 --- a/test/widgetsSpec.js +++ b/test/widgetsSpec.js @@ -429,56 +429,50 @@ describe("widget", function() { it('should load content via xhr when route changes', function() { - $route.when('/foo', {controller: angular.noop, template: 'myUrl1'}); - $route.when('/bar', {controller: angular.noop, template: 'myUrl2'}); + $route.when('/foo', {template: 'myUrl1'}); + $route.when('/bar', {template: 'myUrl2'}); expect(rootScope.$element.text()).toEqual(''); $location.path('/foo'); $browser.xhr.expectGET('myUrl1').respond('
{{1+3}}
'); rootScope.$digest(); - rootScope.$digest(); $browser.xhr.flush(); expect(rootScope.$element.text()).toEqual('4'); $location.path('/bar'); $browser.xhr.expectGET('myUrl2').respond('angular is da best'); rootScope.$digest(); - rootScope.$digest(); $browser.xhr.flush(); expect(rootScope.$element.text()).toEqual('angular is da best'); }); it('should remove all content when location changes to an unknown route', function() { - $route.when('/foo', {controller: angular.noop, template: 'myUrl1'}); + $route.when('/foo', {template: 'myUrl1'}); $location.path('/foo'); $browser.xhr.expectGET('myUrl1').respond('
{{1+3}}
'); rootScope.$digest(); - rootScope.$digest(); $browser.xhr.flush(); expect(rootScope.$element.text()).toEqual('4'); $location.path('/unknown'); rootScope.$digest(); - rootScope.$digest(); expect(rootScope.$element.text()).toEqual(''); }); it('should chain scopes and propagate evals to the child scope', function() { - $route.when('/foo', {controller: angular.noop, template: 'myUrl1'}); + $route.when('/foo', {template: 'myUrl1'}); rootScope.parentVar = 'parent'; $location.path('/foo'); $browser.xhr.expectGET('myUrl1').respond('
{{parentVar}}
'); rootScope.$digest(); - rootScope.$digest(); $browser.xhr.flush(); expect(rootScope.$element.text()).toEqual('parent'); rootScope.parentVar = 'new parent'; rootScope.$digest(); - rootScope.$digest(); expect(rootScope.$element.text()).toEqual('new parent'); }); @@ -510,7 +504,7 @@ describe("widget", function() { it('should initialize view template after the view controller was initialized even when ' + 'templates were cached', function() { - //this is a test for a regression that was introduced by making the ng:view cache sync + // this is a test for a regression that was introduced by making the ng:view cache sync $route.when('/foo', {controller: ParentCtrl, template: 'viewPartial.html'}); -- cgit v1.2.3