ember-native-dom-helpers
ember-native-dom-helpers copied to clipboard
Options object not included in the event object for the change event for file selector.
trafficstars
When I send in the options through the trigger event for the 'change' event on the file input selector, buildFileEvent gets called and the function does not include the options with the event object returned.
function buildFileEvent(type, element, files = []) {
let event = buildBasicEvent(type);
if (files.length > 0) {
Object.defineProperty(files, 'item', {
value(index) {
return typeof index === 'number' ? this[index] : null;
}
});
Object.defineProperty(element, 'files', {
value: files
});
}
Object.defineProperty(event, 'target', {
value: element
});
return event;
}
If you are able to, I'd recommend stop using the triggerEvent from this addon and instead use the one in @ember/test-helpers (note: It required ember-cli-qunit 4.3 or greater). The helpers in this addon have been copied there and perfected, so this one will soon be deprecated.