this.fileSummary.add(fileData, true);
this.updateEmptyContent();
}
+
return $tr;
},
FileList.updateEmptyContent();
this.fileSummary.remove({type: fileEl.attr('data-type'), size: fileEl.attr('data-size')}, true);
}
+
+ var lastIndex = this.$fileList.children().length;
+ // if there are less elements visible than one page
+ // but there are still pending elements in the array,
+ // then directly append the next page
+ if (lastIndex < this.files.length && lastIndex < this.pageSize) {
+ this._nextPage(true);
+ }
+
return fileEl;
},
/**
FileList._nextPage(true);
expect($('#fileList tr').length).toEqual(81);
});
+ it('automatically renders next page when there are not enough elements visible', function() {
+ // delete the 15 first elements
+ for (var i = 0; i < 15; i++) {
+ FileList.remove(FileList.files[0].name);
+ }
+ // still makes sure that there are 20 elements visible, if any
+ expect($('#fileList tr').length).toEqual(25);
+ });
});
describe('file previews', function() {
var previewLoadStub;