mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Fixes tests
This commit is contained in:
@ -14,6 +14,10 @@ class Clipboard extends Emitter {
|
|||||||
constructor(selector) {
|
constructor(selector) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
if (!document.querySelectorAll(selector).length) {
|
||||||
|
throw new Error('No matches were found for the provided selector');
|
||||||
|
}
|
||||||
|
|
||||||
delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ describe('ClipboardAction', () => {
|
|||||||
describe('#constructor', () => {
|
describe('#constructor', () => {
|
||||||
it('should throw an error since "data-action" is invalid', (done) => {
|
it('should throw an error since "data-action" is invalid', (done) => {
|
||||||
try {
|
try {
|
||||||
new Clipboard({
|
new ClipboardAction({
|
||||||
action: 'paste'
|
action: 'paste'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user