Adds destroy method for ClipboardAction too #24

This commit is contained in:
Zeno Rocha 2015-10-03 19:05:12 -07:00
parent 0c24503214
commit 8dc4e2e132
2 changed files with 21 additions and 0 deletions

View File

@ -195,6 +195,13 @@ class ClipboardAction {
get target() {
return this._target;
}
/**
* Destroy lifecycle.
*/
destroy() {
this.removeFake();
}
}
export default ClipboardAction;

View File

@ -225,4 +225,18 @@ describe('ClipboardAction', () => {
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);
});
});
});