UNPKG

exmg-copy-to-clipboard

Version:

Helper element to create a copy to clipboard button

45 lines (37 loc) 1.26 kB
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes"> <title>exmg-copy-to-clipboard test</title> <script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script> <script src="../node_modules/wct-browser-legacy/browser.js"></script> <script type="module" src="../exmg-copy-to-clipboard.js"></script> </head> <body> <test-fixture id="BasicTestFixture"> <template> <exmg-copy-to-clipboard value="copied content 1"> <button>Copy to clipboard</button> </exmg-copy-to-clipboard> </template> </test-fixture> <script type="module"> var copyEl; suite('exmg-copy-to-clipboard', () => { setup(() => { copyEl = fixture('BasicTestFixture'); }); test('check copy success event', (done) => { copyEl.addEventListener('copy-successful', () => { done(); }); flush(() => { var button = copyEl.querySelector('button'); button.click(); }); }); }); </script> </body> </html>