Clear file selection when list is repopulated
When calling FileList.setFiles() the current selection needs to be cleared.
This commit is contained in:
parent
81ecbbb061
commit
074d3a8f07
|
@ -512,6 +512,8 @@
|
||||||
|
|
||||||
this.fileSummary.calculate(filesArray);
|
this.fileSummary.calculate(filesArray);
|
||||||
|
|
||||||
|
this._selectedFiles = {};
|
||||||
|
this._selectionSummary.clear();
|
||||||
this.updateSelectionSummary();
|
this.updateSelectionSummary();
|
||||||
$(window).scrollTop(0);
|
$(window).scrollTop(0);
|
||||||
|
|
||||||
|
|
|
@ -1368,7 +1368,8 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
},
|
},
|
||||||
JSON.stringify(data)
|
JSON.stringify(data)
|
||||||
]);
|
]
|
||||||
|
);
|
||||||
fileList.changeDirectory('/');
|
fileList.changeDirectory('/');
|
||||||
fakeServer.respond();
|
fakeServer.respond();
|
||||||
expect($('.select-all').prop('checked')).toEqual(false);
|
expect($('.select-all').prop('checked')).toEqual(false);
|
||||||
|
@ -1386,6 +1387,37 @@ describe('OCA.Files.FileList tests', function() {
|
||||||
|
|
||||||
expect(selectedFiles.length).toEqual(41);
|
expect(selectedFiles.length).toEqual(41);
|
||||||
});
|
});
|
||||||
|
describe('clearing the selection', function() {
|
||||||
|
it('clears selected files selected individually calling setFiles()', function() {
|
||||||
|
var selectedFiles;
|
||||||
|
|
||||||
|
fileList.setFiles(generateFiles(0, 41));
|
||||||
|
fileList.$fileList.find('tr:eq(5) input:checkbox:first').click();
|
||||||
|
fileList.$fileList.find('tr:eq(7) input:checkbox:first').click();
|
||||||
|
|
||||||
|
selectedFiles = _.pluck(fileList.getSelectedFiles(), 'name');
|
||||||
|
expect(selectedFiles.length).toEqual(2);
|
||||||
|
|
||||||
|
fileList.setFiles(generateFiles(0, 2));
|
||||||
|
|
||||||
|
selectedFiles = _.pluck(fileList.getSelectedFiles(), 'name');
|
||||||
|
expect(selectedFiles.length).toEqual(0);
|
||||||
|
});
|
||||||
|
it('clears selected files selected with select all when calling setFiles()', function() {
|
||||||
|
var selectedFiles;
|
||||||
|
|
||||||
|
fileList.setFiles(generateFiles(0, 41));
|
||||||
|
$('.select-all').click();
|
||||||
|
|
||||||
|
selectedFiles = _.pluck(fileList.getSelectedFiles(), 'name');
|
||||||
|
expect(selectedFiles.length).toEqual(42);
|
||||||
|
|
||||||
|
fileList.setFiles(generateFiles(0, 2));
|
||||||
|
|
||||||
|
selectedFiles = _.pluck(fileList.getSelectedFiles(), 'name');
|
||||||
|
expect(selectedFiles.length).toEqual(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
describe('Selection overlay', function() {
|
describe('Selection overlay', function() {
|
||||||
it('show delete action according to directory permissions', function() {
|
it('show delete action according to directory permissions', function() {
|
||||||
fileList.setFiles(testFiles);
|
fileList.setFiles(testFiles);
|
||||||
|
|
Loading…
Reference in New Issue