The Test

In the test itself, we:

  1. Put the mock task data to on the scope to be passed into our component in the next step.
  2. Create the directive using its HTML form, the way it would be used in real code.
  3. Tell Angular to evaluate the template HTML based on the $scope we constructed.
  4. Manually trigger Angular's digest cycle, which causes any angular expressions (\{\{ }} blocks) in the directive's template HTML to be evaluated.
  5. Verify that the expected markup was generated by the directive.