[Pkg-owncloud-commits] [owncloud] 11/90: Add js unit test
David Prévot
taffit at moszumanska.debian.org
Fri Feb 6 21:10:40 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 50705cfaf8d01bd1d6c690217599ed29abc703dc
Author: Robin Appelman <icewind at owncloud.com>
Date: Tue Nov 25 17:16:23 2014 +0100
Add js unit test
---
apps/files/tests/js/filelistSpec.js | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 86ba4d4..3a51fc2 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -97,7 +97,8 @@ describe('OCA.Files.FileList tests', function() {
name: 'One.txt',
mimetype: 'text/plain',
size: 12,
- etag: 'abc'
+ etag: 'abc',
+ permissions: OC.PERMISSION_ALL
}, {
id: 2,
type: 'file',
@@ -105,6 +106,7 @@ describe('OCA.Files.FileList tests', function() {
mimetype: 'image/jpeg',
size: 12049,
etag: 'def',
+ permissions: OC.PERMISSION_ALL
}, {
id: 3,
type: 'file',
@@ -112,13 +114,15 @@ describe('OCA.Files.FileList tests', function() {
mimetype: 'application/pdf',
size: 58009,
etag: '123',
+ permissions: OC.PERMISSION_ALL
}, {
id: 4,
type: 'dir',
name: 'somedir',
mimetype: 'httpd/unix-directory',
size: 250,
- etag: '456'
+ etag: '456',
+ permissions: OC.PERMISSION_ALL
}];
fileList = new OCA.Files.FileList($('#app-content-files'));
@@ -1478,6 +1482,17 @@ describe('OCA.Files.FileList tests', function() {
$('.select-all').click();
expect(fileList.$el.find('.delete-selected').hasClass('hidden')).toEqual(true);
});
+ it('show doesnt show the delete action if one or more files are not deletable', function () {
+ fileList.setFiles(testFiles);
+ $('#permissions').val(OC.PERMISSION_READ | OC.PERMISSION_DELETE);
+ $('.select-all').click();
+ expect(fileList.$el.find('.delete-selected').hasClass('hidden')).toEqual(false);
+ testFiles[0].permissions = OC.PERMISSION_READ;
+ $('.select-all').click();
+ fileList.setFiles(testFiles);
+ $('.select-all').click();
+ expect(fileList.$el.find('.delete-selected').hasClass('hidden')).toEqual(true);
+ });
});
describe('Actions', function() {
beforeEach(function() {
@@ -1494,7 +1509,8 @@ describe('OCA.Files.FileList tests', function() {
mimetype: 'text/plain',
type: 'file',
size: 12,
- etag: 'abc'
+ etag: 'abc',
+ permissions: OC.PERMISSION_ALL
});
expect(files[1]).toEqual({
id: 3,
@@ -1502,7 +1518,8 @@ describe('OCA.Files.FileList tests', function() {
name: 'Three.pdf',
mimetype: 'application/pdf',
size: 58009,
- etag: '123'
+ etag: '123',
+ permissions: OC.PERMISSION_ALL
});
expect(files[2]).toEqual({
id: 4,
@@ -1510,7 +1527,8 @@ describe('OCA.Files.FileList tests', function() {
name: 'somedir',
mimetype: 'httpd/unix-directory',
size: 250,
- etag: '456'
+ etag: '456',
+ permissions: OC.PERMISSION_ALL
});
});
it('Removing a file removes it from the selection', function() {
@@ -1523,7 +1541,8 @@ describe('OCA.Files.FileList tests', function() {
mimetype: 'text/plain',
type: 'file',
size: 12,
- etag: 'abc'
+ etag: 'abc',
+ permissions: OC.PERMISSION_ALL
});
expect(files[1]).toEqual({
id: 4,
@@ -1531,7 +1550,8 @@ describe('OCA.Files.FileList tests', function() {
name: 'somedir',
mimetype: 'httpd/unix-directory',
size: 250,
- etag: '456'
+ etag: '456',
+ permissions: OC.PERMISSION_ALL
});
});
describe('Download', function() {
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list