mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Default options for ClipboardAction too
This commit is contained in:
parent
902c730a4d
commit
d66aab1124
@ -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;
|
||||
|
@ -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"');
|
||||
|
Loading…
Reference in New Issue
Block a user