diff options
Diffstat (limited to 'core/js/tests/specs/sharedialogviewSpec.js')
-rw-r--r-- | core/js/tests/specs/sharedialogviewSpec.js | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js index efe50c415c8..8d5a2ae434d 100644 --- a/core/js/tests/specs/sharedialogviewSpec.js +++ b/core/js/tests/specs/sharedialogviewSpec.js @@ -89,7 +89,7 @@ describe('OC.Share.ShareDialogView', function() { // triggers rendering shareModel.set({ shares: [], - linkShare: {isLinkShare: false} + linkShares: [] }); autocompleteStub = sinon.stub($.fn, 'autocomplete').callsFake(function() { @@ -130,8 +130,10 @@ describe('OC.Share.ShareDialogView', function() { it('update password on focus out', function() { $('#allowShareWithLink').val('yes'); - dialog.model.set('linkShare', { - isLinkShare: true + dialog.model.set({ + linkShares: [{ + id: 123 + }] }); dialog.render(); @@ -143,20 +145,20 @@ describe('OC.Share.ShareDialogView', function() { expect(saveLinkShareStub.calledOnce).toEqual(true); expect(saveLinkShareStub.firstCall.args[0]).toEqual({ + cid: 123, password: 'foo' }); }); it('update password on enter', function() { $('#allowShareWithLink').val('yes'); - dialog.model.set('linkShare', { - isLinkShare: true + dialog.model.set({ + linkShares: [{ + id: 123 + }] }); dialog.render(); - // Toggle linkshare - dialog.$el.find('.linkCheckbox').click(); - // Enable password and enter password dialog.$el.find('[name=showPassword]').click(); dialog.$el.find('.linkPassText').focus(); @@ -165,47 +167,48 @@ describe('OC.Share.ShareDialogView', function() { expect(saveLinkShareStub.calledOnce).toEqual(true); expect(saveLinkShareStub.firstCall.args[0]).toEqual({ + cid: 123, password: 'foo' }); }); - it('shows share with link checkbox when allowed', function() { + it('shows add share with link button when allowed', function() { $('#allowShareWithLink').val('yes'); dialog.render(); - expect(dialog.$el.find('.linkCheckbox').length).toEqual(1); + expect(dialog.$el.find('.new-share').length).toEqual(1); }); - it('does not show share with link checkbox when not allowed', function() { + it('does not show add share with link button when not allowed', function() { $('#allowShareWithLink').val('no'); dialog.render(); - expect(dialog.$el.find('.linkCheckbox').length).toEqual(0); + expect(dialog.$el.find('.new-share').length).toEqual(0); expect(dialog.$el.find('.shareWithField').length).toEqual(1); }); it('shows populated link share when a link share exists', function() { // this is how the OC.Share class does it... var link = parent.location.protocol + '//' + location.host + - OC.generateUrl('/s/') + 'tehtoken'; - shareModel.set('linkShare', { - isLinkShare: true, - token: 'tehtoken', - link: link, - expiration: '', - permissions: OC.PERMISSION_READ, - stime: 1403884258, + OC.generateUrl('/s/') + 'thetoken'; + shareModel.set({ + linkShares: [{ + id: 123, + url: link + }] }); dialog.render(); - expect(dialog.$el.find('.linkCheckbox').prop('checked')).toEqual(true); + expect(dialog.$el.find('.share-menu .icon-more').length).toEqual(1); expect(dialog.$el.find('.linkText').val()).toEqual(link); }); it('autofocus link text when clicked', function() { $('#allowShareWithLink').val('yes'); - dialog.model.set('linkShare', { - isLinkShare: true + dialog.model.set({ + linkShares: [{ + id: 123 + }] }); dialog.render(); |