/**** Created by nilpatil */ describe('Test change-wizard directive', function () { var scope, compile, $httpBackend; beforeEach(module('myitsmApp', 'templates')); beforeEach(module('adminModule')); beforeEach(function () { inject(function ($compile, $rootScope, $injector, $controller) { $httpBackend = $injector.get('$httpBackend'); var getLocale = function () { return readJSON('scripts/app/i18n/resources-locale_en.json'); }; $httpBackend.whenGET('/smartit/rest/serverstates').respond(200); $httpBackend.whenGET('/smartit/rest/sessionstatus?getLicenseKey=true').respond(200); $httpBackend.whenGET(/^scripts\/app\/i18n\/resources-locale_en.*$/).respond(getLocale()); $httpBackend.whenGET('/smartit/rest/v2/metadata?type=global').respond(200, []); $httpBackend.whenGET('/smartit/rest/v2/metadata?type=change').respond(200, []); $httpBackend.whenGET('/smartit/rest/v2/metadata?type=asset').respond(200, []); $httpBackend.whenGET('/smartit/rest/v2/customization/screenlayout?screen=createChangeScreen').respond(200, []); $httpBackend.whenGET('/smartit/rest/v2/customization/application/search?name=Galileo&phase=2&screen=createChangeScreen').respond(200, []); $httpBackend.whenGET('/smartit/rest/v2/preference/details/search?clientType=UC&preferenceGroup=CIFilter').respond(200, []); $httpBackend.whenGET('/smartit/restapi/person/supportgroupperson').respond('[{"items": []}]'); scope = $rootScope.$new(); scope.draftTicket = { type: EntityVO.TYPE_CHANGE, scheduledStartDatePicker: { open: false }, scheduledEndDatePicker: { open: false }, actualStartDatePicker: { open: false }, actualEndDatePicker: { open: false }, targetDatePicker: { open: false }, customFields: {}, needsReloadingRiskQuestions: true, accessMappings: {} }; scope.screenLayout = {panels: []}; scope.data = {searches: []}; $controller('CreateChangeV2Controller', { '$scope': scope }); scope.draftTicket = { type: EntityVO.TYPE_CHANGE, scheduledStartDatePicker: { open: false }, scheduledEndDatePicker: { open: false }, actualStartDatePicker: { open: false }, actualEndDatePicker: { open: false }, targetDatePicker: { open: false }, customFields: {}, needsReloadingRiskQuestions: true, accessMappings: {} }; scope.screenLayout = {panels: []}; scope.data = {searches: []}; compile = $compile; }); }); function getCompiledElement() { var element = angular.element(''), compiledElement = compile(element)(scope); scope.$digest(); return compiledElement; } it('should compile change-wizard directive', function () { var directiveElem = getCompiledElement(), divElem = directiveElem[0]; expect(divElem).toBeDefined(); }); });