diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-02-12 14:50:23 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-04-28 14:55:00 +0200 |
commit | 9c2fbea6a4396a29ce8c966c9ea7646aa8fc9be5 (patch) | |
tree | 5ec4d52ab001b7078397bc676d8fdac6a3bfdde9 /apps/files/tests/js/filesSpec.js | |
parent | 9f62059efa869ff677130f06bf1b46be49950515 (diff) | |
download | nextcloud-server-9c2fbea6a4396a29ce8c966c9ea7646aa8fc9be5.tar.gz nextcloud-server-9c2fbea6a4396a29ce8c966c9ea7646aa8fc9be5.zip |
Fix file selection for infinite scrolling
- moved file selection code to FileList
- fix selection summary when all files are selected
- nextPage now auto-selects files if "select all" checkbox is checked
- fixed trashbin to use the same selection logic as FileList
Diffstat (limited to 'apps/files/tests/js/filesSpec.js')
-rw-r--r-- | apps/files/tests/js/filesSpec.js | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/apps/files/tests/js/filesSpec.js b/apps/files/tests/js/filesSpec.js index 018c8ef0f3c..7f8848619f5 100644 --- a/apps/files/tests/js/filesSpec.js +++ b/apps/files/tests/js/filesSpec.js @@ -19,7 +19,7 @@ * */ -/* global Files */ +/* global OC, Files */ describe('Files tests', function() { describe('File name validation', function() { it('Validates correct file names', function() { @@ -82,4 +82,30 @@ describe('Files tests', function() { } }); }); + describe('getDownloadUrl', function() { + var curDirStub; + beforeEach(function() { + curDirStub = sinon.stub(FileList, 'getCurrentDirectory'); + }); + afterEach(function() { + curDirStub.restore(); + }); + it('returns the ajax download URL when only filename specified', function() { + curDirStub.returns('/subdir'); + var url = Files.getDownloadUrl('test file.txt'); + expect(url).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=test%20file.txt'); + }); + it('returns the ajax download URL when filename and dir specified', function() { + var url = Files.getDownloadUrl('test file.txt', '/subdir'); + expect(url).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=test%20file.txt'); + }); + it('returns the ajax download URL when filename and root dir specific', function() { + var url = Files.getDownloadUrl('test file.txt', '/'); + expect(url).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2F&files=test%20file.txt'); + }); + it('returns the ajax download URL when multiple files specified', function() { + var url = Files.getDownloadUrl(['test file.txt', 'abc.txt'], '/subdir'); + expect(url).toEqual(OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=%5B%22test%20file.txt%22%2C%22abc.txt%22%5D'); + }); + }); }); |