Skip to content

Tarik Billa

  • Web Development
    • html
    • vue.js
    • laravel
    • css
    • javascript
    • jquery
    • node.js
    • php
    • asp.net
  • Programming
    • python
    • java
    • c
    • c++
    • c#
  • git
  • android

jasmine-jquery

How to resolve $q.all promises in Jasmine unit tests?

December 23, 2023 by Tarik

You can try putting $rootScope.$apply() in an afterEach() callback function. Promises resolve on $apply() in Angular. afterEach(function(){ rootScope.$apply(); });

Categories angularjs Tags angularjs, jasmine, jasmine-jquery, karma-runner, unit-testing Leave a comment

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

August 20, 2023 by Tarik

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.

Categories jquery Tags angularjs, angularjs-directive, jasmine, jasmine-jquery, jquery Leave a comment

Tarik Billa

Software Engineer
tarikbilla@gmail.com
+8801884414000
  • Reuse a hash in YAMLApril 17, 2024
  • Dockerfile: how to redirect the output of a RUN command to a variable?April 16, 2024
  • How to cd to a directory with spaces in the directory name?April 16, 2024
  • Maximum MIME type length when storing the type in a databaseApril 16, 2024
  • What is the difference between Unit, Integration, Regression and Acceptance Testing?April 16, 2024
© 2026 Tarik Billa