SmartIT_Extensions/BMC/smart-it-full/test/app/asset/list-ci-nav-directive.spec.js

41 lines
1.4 KiB
JavaScript

/*** Created by npatil2 .*/
describe('Directives: listCiNav', function () {
var scope, compile, $httpBackend;
beforeEach(module('myitsmApp'));
beforeEach(inject(function ($injector, $compile, $rootScope) {
$httpBackend = $injector.get('$httpBackend');
$httpBackend.whenGET('scripts/app/i18n/resources-locale_en-US.json').respond(200);
$httpBackend.whenGET('views/asset/list-ci-nav.html').respond(200);
$httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200);
$httpBackend.whenGET('/smartit/rest/serverstates').respond(200);
$httpBackend.whenGET('views/dashboard/index.html').respond(200);
scope = $rootScope.$new();
compile = $compile;
}));
function createDirective(model) {
var elem, compiledElem;
elem = '<list-ci-nav model="model"></list-ci-nav>';
compiledElem = compile(elem)(scope);
scope.$digest();
return compiledElem;
}
it('should compile listCiNav directive', function () {
var ele = createDirective(), divElem = ele[0];
expect(divElem).toBeDefined();
});
it('should defined directive element ', function () {
var ele = createDirective(), divElem = ele.scope();
divElem.model = 'foo test';
divElem.$apply();
expect(divElem.model).toBeTruthy();
});
});