���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/luckymerchan/layout/default/node_modules/clipboard/test/actions/ |
import ClipboardActionDefault from '../../src/actions/default'; describe('ClipboardActionDefault', () => { 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('#resolveOptions', () => { it('should set base properties', () => { const selectedText = ClipboardActionDefault({ container: document.body, text: 'foo', }); assert.equal(selectedText, 'foo'); }); }); describe('#set action', () => { it('should throw an error since "action" is invalid', (done) => { try { let clip = ClipboardActionDefault({ text: 'foo', action: 'paste', }); } catch (e) { assert.equal( e.message, 'Invalid "action" value, use either "copy" or "cut"' ); done(); } }); }); describe('#set target', () => { it('should throw an error since "target" do not match any element', (done) => { try { let clip = ClipboardActionDefault({ target: document.querySelector('#foo'), }); } catch (e) { assert.equal(e.message, 'Invalid "target" value, use a valid Element'); done(); } }); }); describe('#selectedText', () => { it('should select text from editable element', () => { const selectedText = ClipboardActionDefault({ container: document.body, target: document.querySelector('#input'), }); assert.equal(selectedText, 'abc'); }); it('should select text from non-editable element', () => { const selectedText = ClipboardActionDefault({ container: document.body, target: document.querySelector('#paragraph'), }); assert.equal(selectedText, 'abc'); }); }); });