| 1 |
import ClipboardActionCut from '../../src/actions/cut'; |
| 2 |
|
| 3 |
describe('ClipboardActionCut', () => { |
| 4 |
before(() => { |
| 5 |
global.input = document.createElement('input'); |
| 6 |
global.input.setAttribute('id', 'input'); |
| 7 |
global.input.setAttribute('value', 'abc'); |
| 8 |
document.body.appendChild(global.input); |
| 9 |
|
| 10 |
global.paragraph = document.createElement('p'); |
| 11 |
global.paragraph.setAttribute('id', 'paragraph'); |
| 12 |
global.paragraph.textContent = 'abc'; |
| 13 |
document.body.appendChild(global.paragraph); |
| 14 |
}); |
| 15 |
|
| 16 |
after(() => { |
| 17 |
document.body.innerHTML = ''; |
| 18 |
}); |
| 19 |
|
| 20 |
describe('#selectText', () => { |
| 21 |
it('should select its value', () => { |
| 22 |
const selectedText = ClipboardActionCut( |
| 23 |
document.querySelector('#input'), |
| 24 |
{ |
| 25 |
container: document.body, |
| 26 |
} |
| 27 |
); |
| 28 |
|
| 29 |
assert.equal(selectedText, document.querySelector('#input').value); |
| 30 |
}); |
| 31 |
}); |
| 32 |
}); |