33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
describe('Test display ticket dates directive', function() {
|
|
var scope, compile, $httpBackend;
|
|
|
|
beforeEach(module('myitsmApp', 'templates'));
|
|
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 getCompiledElement(ticket){
|
|
var element = angular.element('<display-ticket-dates ticket="ticket"></display-ticket-dates>');
|
|
var compiledElement = compile(element)(scope);
|
|
scope.$digest();
|
|
return compiledElement;
|
|
}
|
|
|
|
it('should compile', function(){
|
|
scope.ticket = new ReleaseVO();
|
|
scope.ticket.type = EntityVO.TYPE_RELEASE;
|
|
var directiveElem = getCompiledElement(scope.ticket);
|
|
var divElem = directiveElem[0];
|
|
expect(divElem).toBeDefined();
|
|
expect(directiveElem.find('.ticket-date-col').length).not.toBeLessThan(1);
|
|
});
|
|
|
|
}); |