|
|
@ -97,6 +97,27 @@ describe('optionsDropdown Directive', function() { |
|
|
|
expect(saveAsLink.hasClass('inactive')).to.be.ok; |
|
|
|
expect(saveAsLink.hasClass('inactive')).to.be.ok; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
context('share option', function() { |
|
|
|
|
|
|
|
beforeEach(function() { |
|
|
|
|
|
|
|
optionsDropdownHtml = '<div options-dropdown><a class="publicize-or-star-link" href ng-click="showShareModal($event)" ng-class="{\'inactive\': (cannot(\'query\', \'publicize\') && cannot(\'query\', \'star\'))}"></a></div>'; |
|
|
|
|
|
|
|
var query = new Query({ |
|
|
|
|
|
|
|
id: 1 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
scope.query = query; |
|
|
|
|
|
|
|
AuthorisationService.initModelAuth('query', { |
|
|
|
|
|
|
|
create: '/queries' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
element = angular.element(optionsDropdownHtml); |
|
|
|
|
|
|
|
compile(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should check with AuthorisationService when called', function() { |
|
|
|
|
|
|
|
var shareLink = element.find('.publicize-or-star-link').first(); |
|
|
|
|
|
|
|
sinon.spy(AuthorisationService, "can"); |
|
|
|
|
|
|
|
shareLink.click(); |
|
|
|
|
|
|
|
expect(AuthorisationService.can).to.have.been.called; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}) |
|
|
|
it('should not open save as modal', function() { |
|
|
|
it('should not open save as modal', function() { |
|
|
|
var saveAsLink = element.find('a').first(); |
|
|
|
var saveAsLink = element.find('a').first(); |
|
|
|
saveAsLink.click(); |
|
|
|
saveAsLink.click(); |
|
|
|