diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-06-05 10:59:54 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-06-05 10:59:54 +0200 |
commit | e0c4e960d9d1289c28dfbffde2fb9c1d30987f56 (patch) | |
tree | 5e0e4256ca05a1302040781637154b1bfd4d15b0 /apps/files_sharing/tests/js | |
parent | f1bf06f8cfdcedf83c781ca704a1573dab07dabc (diff) | |
parent | 816db7aef1e2b67cc636d099f1571ae30f8a21a1 (diff) | |
download | nextcloud-server-e0c4e960d9d1289c28dfbffde2fb9c1d30987f56.tar.gz nextcloud-server-e0c4e960d9d1289c28dfbffde2fb9c1d30987f56.zip |
Merge pull request #8861 from owncloud/share-overview-linklist
Added Shared with link sidebar section in files app
Diffstat (limited to 'apps/files_sharing/tests/js')
-rw-r--r-- | apps/files_sharing/tests/js/sharedfilelistSpec.js | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/js/sharedfilelistSpec.js b/apps/files_sharing/tests/js/sharedfilelistSpec.js index f53e79e277f..0f6d0a0ba49 100644 --- a/apps/files_sharing/tests/js/sharedfilelistSpec.js +++ b/apps/files_sharing/tests/js/sharedfilelistSpec.js @@ -417,4 +417,95 @@ describe('OCA.Sharing.FileList tests', function() { expect($tr.find('.nametext').text().trim()).toEqual('local name.txt'); }); }); + describe('loading file list for link shares', function() { + var ocsResponse; + + beforeEach(function() { + fileList = new OCA.Sharing.FileList( + $('#app-content-container'), { + linksOnly: true + } + ); + + fileList.reload(); + + ocsResponse = { + ocs: { + meta: { + status: 'ok', + statuscode: 100, + message: null + }, + data: [{ + id: 7, + item_type: 'file', + item_source: 49, + file_source: 49, + path: '/local path/local name.txt', + permissions: 1, + stime: 11111, + share_type: OC.Share.SHARE_TYPE_LINK, + share_with: null, + token: 'abc', + mimetype: 'text/plain', + uid_owner: 'user1', + displayname_owner: 'User One' + }] + } + }; + }); + it('render only link shares', function() { + /* jshint camelcase: false */ + var request; + ocsResponse.ocs.data.push({ + // non-link share + id: 8, + item_type: 'file', + item_source: 49, + file_source: 49, + path: '/local path/local name.txt', + permissions: 27, + stime: 11111, + share_type: OC.Share.SHARE_TYPE_USER, + share_with: 'user2', + share_with_displayname: 'User Two', + mimetype: 'text/plain', + uid_owner: 'user1', + displayname_owner: 'User One' + }); + expect(fakeServer.requests.length).toEqual(1); + request = fakeServer.requests[0]; + expect(request.url).toEqual( + OC.linkToOCS('apps/files_sharing/api/v1') + + 'shares?format=json&shared_with_me=false' + ); + + fakeServer.requests[0].respond( + 200, + { 'Content-Type': 'application/json' }, + JSON.stringify(ocsResponse) + ); + + // only renders the link share entry + var $rows = fileList.$el.find('tbody tr'); + var $tr = $rows.eq(0); + expect($rows.length).toEqual(1); + expect($tr.attr('data-id')).toEqual('49'); + expect($tr.attr('data-type')).toEqual('file'); + expect($tr.attr('data-file')).toEqual('local name.txt'); + expect($tr.attr('data-path')).toEqual('/local path'); + expect($tr.attr('data-size')).not.toBeDefined(); + expect($tr.attr('data-permissions')).toEqual('31'); // read and delete + expect($tr.attr('data-mime')).toEqual('text/plain'); + expect($tr.attr('data-mtime')).toEqual('11111000'); + expect($tr.attr('data-share-owner')).not.toBeDefined(); + expect($tr.attr('data-share-id')).toEqual('7'); + expect($tr.find('a.name').attr('href')).toEqual( + OC.webroot + + '/index.php/apps/files/ajax/download.php' + + '?dir=%2Flocal%20path&files=local%20name.txt'); + + expect($tr.find('.nametext').text().trim()).toEqual('local name.txt'); + }); + }); }); |