diff --git a/addon/components/ember-filestack-picker/component.js b/addon/components/ember-filestack-picker/component.js index ecf6b68..8f962cc 100644 --- a/addon/components/ember-filestack-picker/component.js +++ b/addon/components/ember-filestack-picker/component.js @@ -49,7 +49,7 @@ export default Ember.Component.extend({ openFilepicker: on('didInsertElement', function () { scheduleOnce('afterRender', this, function () { this.get('filestack.promise').then((filestack) => { - let options = this.get('options'); + let options = this.get('options') || {}; options['onClose'] = options['onClose'] || this.getCallClose(); filestack.pick(options).then((data) => { this.send('handleSelection', data); diff --git a/package.json b/package.json index 264777f..f6d3505 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ember-filestack", - "version": "0.0.4", + "version": "0.0.5", "description": "Ember Addon for https://filestack.com support", "keywords": [ "ember-addon" diff --git a/tests/integration/components/ember-filestack-picker/component-test.js b/tests/integration/components/ember-filestack-picker/component-test.js index 938be21..168b0c0 100644 --- a/tests/integration/components/ember-filestack-picker/component-test.js +++ b/tests/integration/components/ember-filestack-picker/component-test.js @@ -19,6 +19,19 @@ test('it renders', function (assert) { }); }); +test('it renders with undefined options', function (assert) { + this.set('options', undefined); + + this.render(hbs`{{ember-filestack-picker options=options}}`); + + return wait().then(function () { + assert.equal(window.$('.fsp-picker').length, 1, 'pick modal is open'); + + // close any open pickers + window.$('.fsp-picker__close-button').click(); + }); +}); + test('it calls onClose', function (assert) { this.set('options', {fromSources: 'local_file_system'}); this.set('onClose', () => {