Test angular directive
06 Mar 2016Let’s define our directive:
After we’ve managed to help jasmine’s spies infiltrate a ‘real’ service that was injected with angular’s dependency-injection mechanism, it’s time to mess up with the DI itself.
Previously, we’ve seen how to inject a jasmine spyObj as a service directly to a controller, using $controller(). This is easy, since we are creating a new controller for each test, so we can inject different spies to it. But what about testing services?
After we’ve set-up the initial tests for our cute controllers and services, let’ get to the real world. In the real world, controllers user services, and services use services, and everything is just swimming in the big browsers jacuzzi…