How can I unit test templates that accompany components?

Viewed 125

I understand that we're supposed to test component controllers using $componentController, but how can we test the templates that accompany the component? It has been very straightforward with directives, and I assume it'd be as easy with components. I could not find an answer in the docs, nor elsewhere. Here's an example.

Having a component with template like this:

<div ng-click="vm.doSomething();">
  Click me
</div>

I'd like to programmatically trigger the click in a test, and verify that whatever vm.doSomething() - a method of our component's controller - was supposed to do, it did it correctly. How can I do that?

0 Answers
Related