mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Fails silently in favor of speed
This commit is contained in:
parent
775e4b898d
commit
1f61e16eb5
@ -18,10 +18,6 @@ class Clipboard extends Emitter {
|
|||||||
constructor(selector, options) {
|
constructor(selector, options) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
if (!document.querySelectorAll(selector).length) {
|
|
||||||
throw new Error('No matches were found for the provided selector');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.resolveOptions(options);
|
this.resolveOptions(options);
|
||||||
|
|
||||||
Delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
Delegate.bind(document.body, selector, 'click', (e) => this.initialize(e));
|
||||||
|
@ -17,28 +17,6 @@ describe('Clipboard', () => {
|
|||||||
document.body.innerHTML = '';
|
document.body.innerHTML = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#constructor', () => {
|
|
||||||
it('should throw an error since there was no arguments passed', done => {
|
|
||||||
try {
|
|
||||||
new Clipboard();
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
assert.equal(e.message, 'No matches were found for the provided selector');
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should throw an error since an empty selector has been passed', done => {
|
|
||||||
try {
|
|
||||||
new Clipboard('#abc');
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
assert.equal(e.message, 'No matches were found for the provided selector');
|
|
||||||
done();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('#resolveOptions', function() {
|
describe('#resolveOptions', function() {
|
||||||
it('should set action as a function', () => {
|
it('should set action as a function', () => {
|
||||||
var fn = function() {};
|
var fn = function() {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user