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:
@ -6,7 +6,7 @@ class ClipboardAction {
|
|||||||
* Initializes selection from either `text` or `target` property.
|
* Initializes selection from either `text` or `target` property.
|
||||||
* @param {Object} options
|
* @param {Object} options
|
||||||
*/
|
*/
|
||||||
constructor(options) {
|
constructor(options = {}) {
|
||||||
this.action = options.action;
|
this.action = options.action;
|
||||||
this.emitter = options.emitter;
|
this.emitter = options.emitter;
|
||||||
this.target = options.target;
|
this.target = options.target;
|
||||||
|
@ -35,9 +35,7 @@ describe('ClipboardAction', () => {
|
|||||||
|
|
||||||
it('should throw an error since neither "text" nor "target" were passed', done => {
|
it('should throw an error since neither "text" nor "target" were passed', done => {
|
||||||
try {
|
try {
|
||||||
new ClipboardAction({
|
new ClipboardAction();
|
||||||
action: undefined
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
assert.equal(e.message, 'Missing required attributes, use either "target" or "text"');
|
assert.equal(e.message, 'Missing required attributes, use either "target" or "text"');
|
||||||
|
Reference in New Issue
Block a user