Disable sorting when multiselect is enabled in file list

This commit is contained in:
Vincent Petry 2015-09-29 13:24:33 +02:00
parent 4eb299a308
commit d52361b09b
3 changed files with 25 additions and 0 deletions

View File

@ -190,6 +190,9 @@ table th .sort-indicator {
.multiselect .sort-indicator {
visibility: hidden;
}
.multiselect .sort, .multiselect .sort span {
cursor: default;
}
table th:hover .sort-indicator.hidden,
table th:focus .sort-indicator.hidden {
visibility: visible;

View File

@ -623,6 +623,9 @@
* Event handler when clicking on a table header
*/
_onClickHeader: function(e) {
if (this.$table.hasClass('multiselect')) {
return;
}
var $target = $(e.target);
var sort;
if (!$target.is('a')) {

View File

@ -2156,6 +2156,25 @@ describe('OCA.Files.FileList tests', function() {
expect(fileList.files.length).toEqual(5);
expect(fileList.$fileList.find('tr').length).toEqual(5);
});
it('does not sort when clicking on header whenever multiselect is enabled', function() {
var sortStub = sinon.stub(OCA.Files.FileList.prototype, 'setSort');
fileList.setFiles(testFiles);
fileList.findFileEl('One.txt').find('input:checkbox:first').click();
fileList.$el.find('.column-size .columntitle').click();
expect(sortStub.notCalled).toEqual(true);
// can sort again after deselecting
fileList.findFileEl('One.txt').find('input:checkbox:first').click();
fileList.$el.find('.column-size .columntitle').click();
expect(sortStub.calledOnce).toEqual(true);
sortStub.restore();
});
});
describe('create file', function() {
var deferredCreate;