123 lines
3.8 KiB
JavaScript
123 lines
3.8 KiB
JavaScript
/**
|
|
* Created by abhatkha on 5/8/17.
|
|
*/
|
|
//This is test suite for baseVO
|
|
|
|
describe("Test Directive previewSingleTaskTemplate", function () {
|
|
|
|
var compile, scope, directiveElem, $httpBackend;
|
|
beforeEach(module('myitsmApp', 'templates'));
|
|
|
|
beforeEach(module('templateModule'));
|
|
beforeEach(function () {
|
|
|
|
inject(function ($compile, $rootScope, $injector) {
|
|
|
|
$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());
|
|
compile = $compile;
|
|
scope = $rootScope.$new();
|
|
|
|
$httpBackend.whenGET("/smartit/rest/v2/metadata?type=task").respond(new MetadataVO());
|
|
});
|
|
|
|
|
|
});
|
|
|
|
function getCompiledElement() {
|
|
var element = angular.element('<preview-single-task-template template="incidentTemplateObj"></preview-single-task-template>');
|
|
var compiledElement = compile(element)(scope);
|
|
scope.$digest();
|
|
return compiledElement;
|
|
}
|
|
|
|
it('should have div element', function () {
|
|
|
|
directiveElem = getCompiledElement();
|
|
var divElement = directiveElem.find('div');
|
|
expect(divElement).toBeDefined();
|
|
});
|
|
|
|
});
|
|
|
|
|
|
describe("Test Directive previewTaskGroupTemplate", function () {
|
|
|
|
|
|
var compile, scope, directiveElem, $httpBackend;
|
|
beforeEach(module('myitsmApp', 'templates'));
|
|
|
|
beforeEach(module('templateModule'));
|
|
beforeEach(function () {
|
|
|
|
inject(function ($compile, $rootScope, $injector) {
|
|
|
|
$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());
|
|
compile = $compile;
|
|
scope = $rootScope.$new();
|
|
});
|
|
|
|
|
|
});
|
|
|
|
function getCompiledElement1() {
|
|
var element = angular.element('<preview-task-group-template template="incidentTemplateObj" state="" type=""></preview-task-group-template>');
|
|
var compiledElement = compile(element)(scope);
|
|
scope.$digest();
|
|
return compiledElement;
|
|
}
|
|
|
|
it('should have div element', function () {
|
|
|
|
directiveElem = getCompiledElement1();
|
|
var divElement = directiveElem.find('div');
|
|
expect(divElement).toBeDefined();
|
|
});
|
|
|
|
});
|
|
|
|
|
|
describe("Test Directive previewTicketTemplate", function () {
|
|
|
|
|
|
var compile, scope, directiveElem, $httpBackend;
|
|
beforeEach(module('myitsmApp', 'templates'));
|
|
|
|
beforeEach(module('templateModule'));
|
|
beforeEach(function () {
|
|
|
|
inject(function ($compile, $rootScope, $injector) {
|
|
|
|
$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/v2/metadata?type=global').respond(200);
|
|
$httpBackend.whenGET('/smartit/restapi/person/supportgroupperson').respond(200);
|
|
compile = $compile;
|
|
scope = $rootScope.$new();
|
|
});
|
|
});
|
|
|
|
function getCompiledElement2() {
|
|
var element = angular.element('<preview-ticket-template template="incidentTemplateObj"></preview-ticket-template>');
|
|
var compiledElement = compile(element)(scope);
|
|
scope.$digest();
|
|
return compiledElement;
|
|
}
|
|
|
|
it('should have div element', function () {
|
|
|
|
directiveElem = getCompiledElement2();
|
|
var divElement = directiveElem.find('div');
|
|
expect(divElement).toBeDefined();
|
|
});
|
|
}); |