mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00

* Isolate cut, copy and core helper functions. * Update tests to accommodate new proposal * Add/update tests * Add tests to static copy/cut methods * Update condition syntax based on PR reviews * Migrate clipboard-action-default to functional approach. Update tests. Add tests * Improve folder structure. Clean up code. * Add types. Fix tsd check env. Improve in-code doc comments * Improve in-code doc comments
33 lines
888 B
JavaScript
33 lines
888 B
JavaScript
import ClipboardActionCut from '../../src/actions/cut';
|
|
|
|
describe('ClipboardActionCut', () => {
|
|
before(() => {
|
|
global.input = document.createElement('input');
|
|
global.input.setAttribute('id', 'input');
|
|
global.input.setAttribute('value', 'abc');
|
|
document.body.appendChild(global.input);
|
|
|
|
global.paragraph = document.createElement('p');
|
|
global.paragraph.setAttribute('id', 'paragraph');
|
|
global.paragraph.textContent = 'abc';
|
|
document.body.appendChild(global.paragraph);
|
|
});
|
|
|
|
after(() => {
|
|
document.body.innerHTML = '';
|
|
});
|
|
|
|
describe('#selectText', () => {
|
|
it('should select its value', () => {
|
|
const selectedText = ClipboardActionCut(
|
|
document.querySelector('#input'),
|
|
{
|
|
container: document.body,
|
|
}
|
|
);
|
|
|
|
assert.equal(selectedText, document.querySelector('#input').value);
|
|
});
|
|
});
|
|
});
|