diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-24 14:57:23 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-09-24 14:57:23 +0200 |
commit | d7a923671fa4b10f74dc615b583f6d4f5935d45b (patch) | |
tree | 65331c8392505e13cdb777baa3475fa5ba0732e7 /core/js/tests | |
parent | bf4c144c6fb1455e01da2dc0b116957fc02b39a9 (diff) | |
parent | 0db9b28f3fa6bfdc236218c84a507da47cd29e43 (diff) | |
download | nextcloud-server-d7a923671fa4b10f74dc615b583f6d4f5935d45b.tar.gz nextcloud-server-d7a923671fa4b10f74dc615b583f6d4f5935d45b.zip |
Merge pull request #19305 from owncloud/share-hasusershares
Fix ShareItemModel.hasUserShares to only check shares of current item
Diffstat (limited to 'core/js/tests')
-rw-r--r-- | core/js/tests/specs/shareitemmodelSpec.js | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js index a2f3d6fa0ad..b4403e28475 100644 --- a/core/js/tests/specs/shareitemmodelSpec.js +++ b/core/js/tests/specs/shareitemmodelSpec.js @@ -304,6 +304,63 @@ describe('OC.Share.ShareItemModel', function() { expect(share.expiration).toEqual('2015-10-12 00:00:00'); }); }); + describe('hasUserShares', function() { + it('returns false when no user shares exist', function() { + loadItemStub.yields({ + reshare: {}, + shares: [] + }); + + model.fetch(); + + expect(model.hasUserShares()).toEqual(false); + }); + it('returns true when user shares exist on the current item', function() { + loadItemStub.yields({ + reshare: {}, + shares: [{ + id: 1, + share_type: OC.Share.SHARE_TYPE_USER, + share_with: 'user1', + item_source: '123' + }] + }); + + model.fetch(); + + expect(model.hasUserShares()).toEqual(true); + }); + it('returns true when group shares exist on the current item', function() { + loadItemStub.yields({ + reshare: {}, + shares: [{ + id: 1, + share_type: OC.Share.SHARE_TYPE_GROUP, + share_with: 'group1', + item_source: '123' + }] + }); + + model.fetch(); + + expect(model.hasUserShares()).toEqual(true); + }); + it('returns false when share exist on parent item', function() { + loadItemStub.yields({ + reshare: {}, + shares: [{ + id: 1, + share_type: OC.Share.SHARE_TYPE_GROUP, + share_with: 'group1', + item_source: '111' + }] + }); + + model.fetch(); + + expect(model.hasUserShares()).toEqual(false); + }); + }); describe('Util', function() { it('parseTime should properly parse strings', function() { |