I have seen that in order to simulate user action on the DOM generated by a directive, there are two approaches, both trigering an event:

[How to trigger ng-change in directive test in AngularJS](https://stackoverflow.com/questions/17626604/how-to-trigger-ng-change-in-directive-test-in-angularjs)

The first approach uses jquery and the second one a function called **browserTrigger** defined in **angular-scenario.js**. The second one is supposed to be better as jquery would have a bug on event triggering (which I believe, I am not arguing :) ).

Using the angular-scenario means e2e testing for me. but I have seen [egghead video](http://egghead.io/lessons/angularjs-unit-testing-directive-scope) and he seems to do unit testing. How is this possible ?

I guess he just copied the function ?

I think I am going to test directives as e2e tests, it makes more sense as unit test is more fore pure functions.

---

Well, I just found that browserTrigger is something internal not supposed to be used directly : <https://github.com/angular/angular.js/issues/5178>

---

Thanks!