JavaScript community news log


Daily JavaScript community news and chat

A RubyFlow-inspired community news site for JavaScript and related technologies.

Anyone can post news to be seen by the community (and maybe selected for JavaScript Weekly!)

Unit Testing Angular Components with $componentController

Angular 1.5+’s components are great, but testing them properly requires some changes to they way you were used to testing before.

Directives were always a bit clunky to test in Angular. You would either have to deal with recreating their DOM elements, or exposing the controller outside of the directive in order to test it directly. Since components are essentially wrappers around directives, you might expect the same dance.

But, along the introduction of components we also got the handy $componentController service.

Post a comment

You can use basic HTML markup (e.g. <a>) or Markdown.

As you are not logged in, you will be
directed via GitHub to signup or sign in