Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit bb94817

Browse files
committed
test(ng:view): spec cleanup
- remove optional controller definition from specs - remove extranious digest calls
1 parent 163c799 commit bb94817

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

test/widgetsSpec.js

+5-11
Original file line numberDiff line numberDiff line change
@@ -429,56 +429,50 @@ describe("widget", function() {
429429

430430

431431
it('should load content via xhr when route changes', function() {
432-
$route.when('/foo', {controller: angular.noop, template: 'myUrl1'});
433-
$route.when('/bar', {controller: angular.noop, template: 'myUrl2'});
432+
$route.when('/foo', {template: 'myUrl1'});
433+
$route.when('/bar', {template: 'myUrl2'});
434434

435435
expect(rootScope.$element.text()).toEqual('');
436436

437437
$location.path('/foo');
438438
$browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>');
439439
rootScope.$digest();
440-
rootScope.$digest();
441440
$browser.xhr.flush();
442441
expect(rootScope.$element.text()).toEqual('4');
443442

444443
$location.path('/bar');
445444
$browser.xhr.expectGET('myUrl2').respond('angular is da best');
446445
rootScope.$digest();
447-
rootScope.$digest();
448446
$browser.xhr.flush();
449447
expect(rootScope.$element.text()).toEqual('angular is da best');
450448
});
451449

452450
it('should remove all content when location changes to an unknown route', function() {
453-
$route.when('/foo', {controller: angular.noop, template: 'myUrl1'});
451+
$route.when('/foo', {template: 'myUrl1'});
454452

455453
$location.path('/foo');
456454
$browser.xhr.expectGET('myUrl1').respond('<div>{{1+3}}</div>');
457455
rootScope.$digest();
458-
rootScope.$digest();
459456
$browser.xhr.flush();
460457
expect(rootScope.$element.text()).toEqual('4');
461458

462459
$location.path('/unknown');
463460
rootScope.$digest();
464-
rootScope.$digest();
465461
expect(rootScope.$element.text()).toEqual('');
466462
});
467463

468464
it('should chain scopes and propagate evals to the child scope', function() {
469-
$route.when('/foo', {controller: angular.noop, template: 'myUrl1'});
465+
$route.when('/foo', {template: 'myUrl1'});
470466
rootScope.parentVar = 'parent';
471467

472468
$location.path('/foo');
473469
$browser.xhr.expectGET('myUrl1').respond('<div>{{parentVar}}</div>');
474470
rootScope.$digest();
475-
rootScope.$digest();
476471
$browser.xhr.flush();
477472
expect(rootScope.$element.text()).toEqual('parent');
478473

479474
rootScope.parentVar = 'new parent';
480475
rootScope.$digest();
481-
rootScope.$digest();
482476
expect(rootScope.$element.text()).toEqual('new parent');
483477
});
484478

@@ -510,7 +504,7 @@ describe("widget", function() {
510504

511505
it('should initialize view template after the view controller was initialized even when ' +
512506
'templates were cached', function() {
513-
//this is a test for a regression that was introduced by making the ng:view cache sync
507+
// this is a test for a regression that was introduced by making the ng:view cache sync
514508

515509
$route.when('/foo', {controller: ParentCtrl, template: 'viewPartial.html'});
516510

0 commit comments

Comments
 (0)