describe('Directive acl', () => { let scope; let element; let compile; let $timeout; beforeEach(ngModule('vnCore')); compile = (hasPermissions, _element) => { inject(($compile, $rootScope, aclService, _$timeout_) => { spyOn(aclService, 'aclPermission').and.returnValue(hasPermissions); scope = $rootScope.$new(); $timeout = _$timeout_; element = angular.element(_element); $compile(element)(scope); scope.$digest(); }); }; it('should not disable the input element as the user has permision', () => { let html = `
`; compile(true, html); let input = element.find('input'); expect(input).toBeDefined(); expect(input.attr('disabled')).toBeFalsy(); }); it('should delete the element as the user does not have permission and there is no action', () => { let html = `