aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/tests/js
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2017-09-29 01:36:10 +0200
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2017-10-19 01:46:13 +0200
commitf392e78d5b525abbb04057b91c0adfba212c00c4 (patch)
treebd01ed1951dd3d6d9dd59ab3aa51040bc1dc6b9d /apps/files/tests/js
parent6b8713e8b6f45f79ec7cffd150c7f0136d7fb5b9 (diff)
downloadnextcloud-server-f392e78d5b525abbb04057b91c0adfba212c00c4.tar.gz
nextcloud-server-f392e78d5b525abbb04057b91c0adfba212c00c4.zip
Move checkboxes to their own column
The selection column is not only a visual column, but also a real column of the file list table. Unlike other columns whose width is reduced in space constrained screens the selection column must stay the same so the tapping area is large enough to be easily usable The selection column does not appear in the search results table, so its contents have to be explicitly aligned with those of the main table based on whether the main table has a selection column or not (using the "has-selection" CSS class in the same way as the "has-favorite" CSS class was being used when there was a column for favorite actions). In the tests the ":visible" selector can no longer be used. That selector matches elements with a width or height that is greater than zero, but the dimensions calculated in the unit tests are not reliable; the width of the link was zero before these changes, and now moving the checkbox to its own column causes the height of the link to become zero too, so it no longer matches the ":visible" selector even if it is not hidden. As hidding and showing the link is based on its "display" CSS property its value is the one checked now. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps/files/tests/js')
-rw-r--r--apps/files/tests/js/filelistSpec.js22
1 files changed, 14 insertions, 8 deletions
diff --git a/apps/files/tests/js/filelistSpec.js b/apps/files/tests/js/filelistSpec.js
index 8530e330d49..1f8d38c59ce 100644
--- a/apps/files/tests/js/filelistSpec.js
+++ b/apps/files/tests/js/filelistSpec.js
@@ -712,8 +712,14 @@ describe('OCA.Files.FileList tests', function() {
fileList.add(testFiles[i], {silent: true});
}
+ $tr = fileList.findFileEl('One.txt');
+ expect($tr.find('a.name').css('display')).not.toEqual('none');
+
// trigger rename prompt
fileList.rename('One.txt');
+
+ expect($tr.find('a.name').css('display')).toEqual('none');
+
$input = fileList.$fileList.find('input.filename');
$input.val('Two.jpg');
@@ -735,12 +741,12 @@ describe('OCA.Files.FileList tests', function() {
$tr = fileList.findFileEl('One.txt');
expect($tr.length).toEqual(1);
expect($tr.find('a .nametext').text().trim()).toEqual('One.txt');
- expect($tr.find('a.name').is(':visible')).toEqual(true);
+ expect($tr.find('a.name').css('display')).not.toEqual('none');
$tr = fileList.findFileEl('Two.jpg');
expect($tr.length).toEqual(1);
expect($tr.find('a .nametext').text().trim()).toEqual('Two.jpg');
- expect($tr.find('a.name').is(':visible')).toEqual(true);
+ expect($tr.find('a.name').css('display')).not.toEqual('none');
// input and form are gone
expect(fileList.$fileList.find('input.filename').length).toEqual(0);
@@ -1741,7 +1747,7 @@ describe('OCA.Files.FileList tests', function() {
it('Selects a file when clicking its checkbox', function() {
var $tr = fileList.findFileEl('One.txt');
expect($tr.find('input:checkbox').prop('checked')).toEqual(false);
- $tr.find('td.filename input:checkbox').click();
+ $tr.find('td.selection input:checkbox').click();
expect($tr.find('input:checkbox').prop('checked')).toEqual(true);
});
@@ -1779,7 +1785,7 @@ describe('OCA.Files.FileList tests', function() {
var $tr = fileList.findFileEl('One.txt');
var $tr2 = fileList.findFileEl('Three.pdf');
var e;
- $tr.find('td.filename input:checkbox').click();
+ $tr.find('td.selection input:checkbox').click();
e = new $.Event('click');
e.shiftKey = true;
$tr2.find('td.filename .name').trigger(e);
@@ -1797,7 +1803,7 @@ describe('OCA.Files.FileList tests', function() {
var $tr = fileList.findFileEl('One.txt');
var $tr2 = fileList.findFileEl('Three.pdf');
var e;
- $tr2.find('td.filename input:checkbox').click();
+ $tr2.find('td.selection input:checkbox').click();
e = new $.Event('click');
e.shiftKey = true;
$tr.find('td.filename .name').trigger(e);
@@ -1813,13 +1819,13 @@ describe('OCA.Files.FileList tests', function() {
});
it('Selecting all files will automatically check "select all" checkbox', function() {
expect($('.select-all').prop('checked')).toEqual(false);
- $('#fileList tr td.filename input:checkbox').click();
+ $('#fileList tr td.selection input:checkbox').click();
expect($('.select-all').prop('checked')).toEqual(true);
});
it('Selecting all files on the first visible page will not automatically check "select all" checkbox', function() {
fileList.setFiles(generateFiles(0, 41));
expect($('.select-all').prop('checked')).toEqual(false);
- $('#fileList tr td.filename input:checkbox').click();
+ $('#fileList tr td.selection input:checkbox').click();
expect($('.select-all').prop('checked')).toEqual(false);
});
it('Selecting all files also selects hidden files when invisible', function() {
@@ -1831,7 +1837,7 @@ describe('OCA.Files.FileList tests', function() {
size: 150
}));
$('.select-all').click();
- expect($tr.find('td.filename input:checkbox').prop('checked')).toEqual(true);
+ expect($tr.find('td.selection input:checkbox').prop('checked')).toEqual(true);
expect(_.pluck(fileList.getSelectedFiles(), 'name')).toContain('.hidden');
});
it('Clicking "select all" will select/deselect all files', function() {