I've been writing unit tests for angular controllers and services for a while now, but been putting off the daunting task of testing directives.
I currently have an isolated scope directive, with an external controller that handles a flag which determines if the directive is rendered or not, via an ng-if on the directive's root element. The directive is for a "flash messages" style notifications system. I can't figure out how to set up the test correctly to default the flag to be true.
There's a simple jsFiddle here:
Removing the "ng-if" from the directive template causes the test to pass. The test still fails if you change the template to use 'ng-if="true"'.