Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-10-30 16:37:19 +0300
committerVincent Petry <pvince81@owncloud.com>2015-10-30 16:58:53 +0300
commit80cf4e84e32f09838e9f9e362568f02642ef7658 (patch)
tree3bcb07d844f1002b8027aa37f79db5f16ccf1643 /apps/files/tests/js/fileactionsSpec.js
parent73d9699be9d2a343b0573dc6a5bcc65f5f9c7303 (diff)
Fix file action download spinner
Diffstat (limited to 'apps/files/tests/js/fileactionsSpec.js')
-rw-r--r--apps/files/tests/js/fileactionsSpec.js43
1 files changed, 42 insertions, 1 deletions
diff --git a/apps/files/tests/js/fileactionsSpec.js b/apps/files/tests/js/fileactionsSpec.js
index 6a57c56c3af..d29164c5136 100644
--- a/apps/files/tests/js/fileactionsSpec.js
+++ b/apps/files/tests/js/fileactionsSpec.js
@@ -227,7 +227,7 @@ describe('OCA.Files.FileActions tests', function() {
name: 'Test',
type: OCA.Files.FileActions.TYPE_INLINE,
mime: 'all',
- icon: OC.imagePath('core', 'actions/test'),
+ icon: OC.imagePath('core', 'actions/test'),
permissions: OC.PERMISSION_READ,
actionHandler: actionStub
});
@@ -556,4 +556,45 @@ describe('OCA.Files.FileActions tests', function() {
expect(handler.notCalled).toEqual(true);
});
});
+ describe('default actions', function() {
+ describe('download', function() {
+ it('redirects to URL and sets busy state to list', function() {
+ var handleDownloadStub = sinon.stub(OCA.Files.Files, 'handleDownload');
+ var busyStub = sinon.stub(fileList, 'showFileBusyState');
+ var fileData = {
+ id: 18,
+ type: 'file',
+ name: 'testName.txt',
+ mimetype: 'text/plain',
+ size: '1234',
+ etag: 'a01234c',
+ mtime: '123456',
+ permissions: OC.PERMISSION_READ | OC.PERMISSION_UPDATE
+ };
+
+ // note: FileActions.display() is called implicitly
+ fileList.add(fileData);
+
+ var model = fileList.getModelForFile('testName.txt');
+
+ fileActions.registerDefaultActions();
+ fileActions.triggerAction('Download', model, fileList);
+
+ expect(busyStub.calledOnce).toEqual(true);
+ expect(busyStub.calledWith('testName.txt', true)).toEqual(true);
+ expect(handleDownloadStub.calledOnce).toEqual(true);
+ expect(handleDownloadStub.getCall(0).args[0]).toEqual(
+ OC.webroot + '/index.php/apps/files/ajax/download.php?dir=%2Fsubdir&files=testName.txt'
+ );
+ busyStub.reset();
+ handleDownloadStub.yield();
+
+ expect(busyStub.calledOnce).toEqual(true);
+ expect(busyStub.calledWith('testName.txt', false)).toEqual(true);
+
+ busyStub.restore();
+ handleDownloadStub.restore();
+ });
+ });
+ });
});