I spent an hour or so this morning figuring out how to unit test an Angular directive that uses a controller and a template loaded from a file (as opposed to inline). There’s a useful example in the ng-directive-testing repository but I thought a quick summary would be useful (as much to remind me the next time I have to do it as anything). Also the examples there test by interacting with DOM elements rather than directly with the directive’s scope.
I’ve been working on an Angular JS project for the past few weeks. It’s not the first time I’ve used Angular but it is the first time I’ve used the generator-angular package for Yeoman. Having the ability to quickly generate skeletons for new components is really nice but there’s one thing that rubs me up the wrong way – the way the genenerated code is organized on the file system.