Skip to content

Commit

Permalink
fix 'Illegal invocation error on call 'FileListWrapper.item' method' (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
miherlosev authored and AndreyBelym committed Feb 28, 2019
1 parent 99ebd41 commit 14a96ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/client/sandbox/upload/file-list-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ export default class FileListWrapper {

for (let i = 0; i < fileList.length; i++)
this[i] = FileListWrapper._createFileWrapper(fileList[i]);
}

item (index) {
return this[index];
this.item = index => this[index];
}

static _base64ToBlob (base64Data, mimeType, sliceSize) {
Expand Down
18 changes: 18 additions & 0 deletions test/client/fixtures/sandbox/upload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,4 +725,22 @@ if (window.FileList) {

ok(getProperty(input, 'files') instanceof FileList);
});

test('illegal invocation error on call `FileListWrapper.item` method (GH-1446)', function () {
var input = document.createElement('input');

input.type = 'file';

var inputFiles = getProperty(input, 'files');

try {
var item1 = inputFiles.item(0);

notOk(item1);
}
catch (e) {
ok(false, 'error is raised');
}

});
}

0 comments on commit 14a96ab

Please sign in to comment.