SmartIT_Extensions/BMC/smart-it-full/test/app/change/calendar-directive.spec.js

39 lines
1.3 KiB
JavaScript

describe('Test calendar directive', function () {
var compile, scope, $httpBackend;
beforeEach(module('myitsmApp','templates'));
beforeEach(function(){
inject(function($compile, $rootScope, $injector, $state){
$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/rest/v2/metadata?type=change').respond(200);
spyOn($state, 'go');
compile = $compile;
scope = $rootScope.$new();
scope.context = {
scheduledStartDate: null,
scheduledEndDate: null
}
});
});
function getCompiledElement(){
var element = angular.element('<calendar></calendar>');
var compiledElement = compile(element)(scope);
scope.$digest();
return compiledElement;
}
it('should compile', function(){
var directiveElem = getCompiledElement();
var divElem = directiveElem[0];
expect(divElem).toBeDefined();
});
});