/*** Created by npatil2.*/ describe('Test slaReachTime directive', function () { 'use strict'; var compile, scope, element, $httpBackend, directiveElem, divElem; beforeEach(module('myitsmApp')); beforeEach(function () { inject(function ($compile, $rootScope, $injector, googleMapService) { $httpBackend = $injector.get('$httpBackend'); var getLocale = function () { return readJSON('scripts/app/i18n/resources-locale_en.json'); }; $httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale()); $httpBackend.whenGET('/smartit/rest/serverstates').respond(200); $httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200); $httpBackend.whenGET('views/ticket/partials/sla-reach-time.html').respond(200); compile = $compile; scope = $rootScope.$new(); }); }); function getCompiledElement(address) { element = angular.element(''); var compiledElement = compile(element)(scope); scope.$digest(); return compiledElement; } it('should compile', function () { this.address = 'asset.site.address.address'; directiveElem = getCompiledElement(this.address); divElem = directiveElem[0]; expect(divElem).toBeDefined(); expect(directiveElem.find(element.length)).not.toBeLessThan(1); }); });