diff --git a/src/clipboard-action.js b/src/clipboard-action.js index db3eb58..97452f8 100644 --- a/src/clipboard-action.js +++ b/src/clipboard-action.js @@ -32,18 +32,12 @@ class ClipboardAction { * on the existence of `text` and `target` properties. */ initSelection() { - if (this.text && this.target) { - throw new Error('Multiple attributes declared, use either "target" or "text"'); - } - else if (this.text) { + if (this.text) { this.selectFake(); } else if (this.target) { this.selectTarget(); } - else { - throw new Error('Missing required attributes, use either "target" or "text"'); - } } /** diff --git a/test/clipboard-action.js b/test/clipboard-action.js index 4797abb..e746bee 100644 --- a/test/clipboard-action.js +++ b/test/clipboard-action.js @@ -35,29 +35,6 @@ describe('ClipboardAction', () => { }); describe('#initSelection', () => { - it('should throw an error since both "text" and "target" were passed', done => { - try { - new ClipboardAction({ - text: 'foo', - target: document.querySelector('#input') - }); - } - catch(e) { - assert.equal(e.message, 'Multiple attributes declared, use either "target" or "text"'); - done(); - } - }); - - it('should throw an error since neither "text" nor "target" were passed', done => { - try { - new ClipboardAction(); - } - catch(e) { - assert.equal(e.message, 'Missing required attributes, use either "target" or "text"'); - done(); - } - }); - it('should set the position right style property', done => { // Set document direction document.documentElement.setAttribute('dir', 'rtl');