cut.js 888 B

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