How would I test a $scope.watch (AngularJS) change in Jasmine?

后端 未结 1 1207
既然无缘
既然无缘 2021-02-06 22:10

I\'ve just recently started writing something with AngularJS and I\'m not sure how to go about writing a test for this particular thing. I\'m building a \"Help Request\" mode th

相关标签:
1条回答
  • 2021-02-06 22:32

    In your unit tests you need to manually call $scope.$digest() or $scope.$apply() to trigger $scope.$watch().

    Normally in your code you wouldn't have to do this, since directives like ng-click do $rootScope.$apply for you behind the scenes.

    0 讨论(0)
提交回复
热议问题