jeudi 3 mars 2016

Testing angular's $viewContentLoaded in watch

Can someone guide me how to test angular $viewContentLoaded. I have a $watch on this in my controller.

My relevant controller code:

$scope.$watch('$viewContentLoaded', function() {
            $scope.variableOne= true;
        });

Here is my relevant jasmine spec:

describe('Testing $viewContentLoaded', function() {
           it('should be true', inject(function ($controller,$scope) {
               $controller('MainCtrl');

              // what to do to invoke $viewContentLoaded ???

              $scope.$digest();
              expect($scope.variableOne).toBe(true);
           }));
        });

Plunkr code

Any help with this will be appreciated!

Aucun commentaire:

Enregistrer un commentaire