diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-12-14 10:44:47 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-12-14 10:44:47 +0100 |
commit | 4d9e12b8bcc09a3b75a847523876ad961cab1de3 (patch) | |
tree | 61d390e53a64e3cc313665f46a1e9f360fd9227a /apps/files/tests | |
parent | 74de12c698e01514c8fe42727d98aeaa8956eeee (diff) | |
download | nextcloud-server-4d9e12b8bcc09a3b75a847523876ad961cab1de3.tar.gz nextcloud-server-4d9e12b8bcc09a3b75a847523876ad961cab1de3.zip |
Fix mount type root detection
Since Webdav doesn't contain that information, we need to rely on the
parent folder's mount type to find out whether a child item is a
shared/external root or not.
Fixed the mount type detection logic and added unit test.
Also added a fix that ignores detection if no parent folder exists (ex:
shared file list, favorites, etc)
Diffstat (limited to 'apps/files/tests')
-rw-r--r-- | apps/files/tests/js/filelistSpec.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js index 9f7ad50bc60..3542a5cee8f 100644 --- a/apps/files/tests/js/filelistSpec.js +++ b/apps/files/tests/js/filelistSpec.js @@ -2534,4 +2534,34 @@ describe('OCA.Files.FileList tests', function() { expect(newFileMenuStub.notCalled).toEqual(true); }); }); + describe('mount type detection', function() { + function testMountType(dirInfoId, dirInfoMountType, inputMountType, expectedMountType) { + var $tr; + fileList.dirInfo.id = dirInfoId; + fileList.dirInfo.mountType = dirInfoMountType; + $tr = fileList.add({ + type: 'dir', + mimetype: 'httpd/unix-directory', + name: 'test dir', + mountType: inputMountType + }); + + expect($tr.attr('data-mounttype')).toEqual(expectedMountType); + } + + it('leaves mount type as is if no parent exists', function() { + testMountType(null, null, 'external', 'external'); + testMountType(null, null, 'shared', 'shared'); + }); + it('detects share root if parent exists', function() { + testMountType(123, null, 'shared', 'shared-root'); + testMountType(123, 'shared', 'shared', 'shared'); + testMountType(123, 'shared-root', 'shared', 'shared'); + }); + it('detects external storage root if parent exists', function() { + testMountType(123, null, 'external', 'external-root'); + testMountType(123, 'external', 'external', 'external'); + testMountType(123, 'external-root', 'external', 'external'); + }); + }); }); |