Unlimited Plugins, WordPress themes, videos & courses! Unlimited asset downloads! From $16.50/m
  • Overview
  • Transcript

1.2 Testing Angular Directives

In this lesson, we’re going to add unit tests for one of the directives in a simple JavaScript app using Sinon, Jasmine and Karma.

Code Snippet

In this snippet, we first create a test element that has our directive applied. In this case it’s a <textarea> with an id attribute, and is associated with a scope. We then use Jasmine’s expect method in conjunction with the toEqual matcher to test that the id attribute in the $scope matches that of the test element.

Related Links

1.Testing Angular Directives
2 lessons, 11:17

Free Lesson

Testing Angular Directives