samedi 27 décembre 2014

How to unit test ui-route in angular js?

I have a simple directive that builds this kind of html:


Feeds Snapshots

I want to unit test it (karma+jasmine) as follows:


I just want to check if i put a state of feeds, the button is 'active', How should i procced:


var scope,compile;



beforeEach(module('feedsSnapshotsApp'));
beforeEach(module('directives'));

beforeEach(inject(function ($rootScope,$compile) {
scope = $rootScope.$new();
compile = $compile;
...
scope.state = 'feeds' //?
it('should check if state is active',function(){
//What is the check that i can do here?
})

Aucun commentaire:

Enregistrer un commentaire