Mocking Controller Instantiation In AngularJS Unit Test

Being able to mock is what unit testing is all about this paradigm plays an especially important role in AngularJS unit testing. We mock our application's environment. We mock data using constants. We mock services using functions. All in order to test how a certain portion of an application should preform in production. As AngularJS is built upon modularity of code, our unit tests should be no different. How then do we then mock controllers? First off I think it's important to note why I am asking this question in the first place. You might be thinking to yourself well...

Unit testing in AngularJS - Mocking Services and Promises

In Angular everything seems to have a steep learning curve and unit testing an Angular app definitely doesn't escape this paradigm. When I started with TDD and Angular I felt that I was spending twice (maybe more) as much time figuring out just how to test and maybe even more just getting my tests set up correctly. But as Ben Nadel put it in his blog there are ups and downs in the angular learning process - his graph is definitely my experience with Angular. However as I have progressed in learning Angular and unit testing as well, now I...

Ui-Router State Transition Animations & Bootstrap

I was given what I thought was a nearly impossible task by my product owner - create an animation when changing states. I began using ngAnimate and came up with what I thought was a pretty cool solution to his problem - wrong. "This isn't what I had in mind he told me. As I change between panels of a collapse widget I want to change the state and update the URL as well." Me - "Oh boy..." So how else can I animate state transitions using an accordion like approach or in bootstrap terminology - the collapse widget? Back...

Building Reusable Bower Components from Angular Modules

So you have built a generic module and now you wanna use it in another project, but like any good developer out there you hate the idea of copying the code and pasting it into your new project. Welcome to the world of the bower component. For any developer out there who has been indoctrinated into the bower components knows their efficiency in making a working environment's dependencies easily shareable. But what if we wanna make our own component, well its actually super simple and through the use of bower link we can even edit our component in the project...