diff --git a/src/clipboard-action.js b/src/clipboard-action.js index 21b05a8..3a4e9e4 100644 --- a/src/clipboard-action.js +++ b/src/clipboard-action.js @@ -6,7 +6,7 @@ class ClipboardAction { * Initializes selection from either `text` or `target` property. * @param {Object} options */ - constructor(options) { + constructor(options = {}) { this.action = options.action; this.emitter = options.emitter; this.target = options.target; diff --git a/test/clipboard-action.js b/test/clipboard-action.js index d19a97e..b8f3d74 100644 --- a/test/clipboard-action.js +++ b/test/clipboard-action.js @@ -35,9 +35,7 @@ describe('ClipboardAction', () => { it('should throw an error since neither "text" nor "target" were passed', done => { try { - new ClipboardAction({ - action: undefined - }); + new ClipboardAction(); } catch(e) { assert.equal(e.message, 'Missing required attributes, use either "target" or "text"');