mirror of
https://github.com/zenorocha/clipboard.js.git
synced 2023-08-10 21:12:48 +03:00
36 lines
854 B
JavaScript
36 lines
854 B
JavaScript
import select from 'select';
|
|
import command from '../../src/common/command';
|
|
|
|
describe('command', () => {
|
|
before(() => {
|
|
global.input = document.createElement('input');
|
|
global.input.setAttribute('id', 'input');
|
|
global.input.setAttribute('value', 'abc');
|
|
document.body.appendChild(global.input);
|
|
});
|
|
|
|
after(() => {
|
|
document.body.innerHTML = '';
|
|
});
|
|
|
|
it('should execute cut command', (done) => {
|
|
// Set document direction
|
|
document.documentElement.setAttribute('dir', 'rtl');
|
|
|
|
select(document.querySelector('#input'));
|
|
|
|
assert.isTrue(command('cut'));
|
|
done();
|
|
});
|
|
|
|
it('should execute copy command', (done) => {
|
|
// Set document direction
|
|
document.documentElement.setAttribute('dir', 'rtl');
|
|
|
|
select(document.querySelector('#input'));
|
|
|
|
assert.isTrue(command('copy'));
|
|
done();
|
|
});
|
|
});
|