mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
Adds destroy method for ClipboardAction too #24
This commit is contained in:
parent
0c24503214
commit
8dc4e2e132
|
@ -195,6 +195,13 @@ class ClipboardAction {
|
||||||
get target() {
|
get target() {
|
||||||
return this._target;
|
return this._target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy lifecycle.
|
||||||
|
*/
|
||||||
|
destroy() {
|
||||||
|
this.removeFake();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ClipboardAction;
|
export default ClipboardAction;
|
||||||
|
|
|
@ -225,4 +225,18 @@ describe('ClipboardAction', () => {
|
||||||
assert.equal(selectedText, '');
|
assert.equal(selectedText, '');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#destroy', () => {
|
||||||
|
it('should destroy an existing fake element', () => {
|
||||||
|
let clip = new ClipboardAction({
|
||||||
|
emitter: new Emitter(),
|
||||||
|
text: 'blah'
|
||||||
|
});
|
||||||
|
|
||||||
|
clip.selectFake();
|
||||||
|
clip.destroy();
|
||||||
|
|
||||||
|
assert.equal(clip.fakeElem, null);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user