mirror of
https://github.com/wavetermdev/xterm.js.git
synced 2026-08-05 13:43:48 -07:00
Fix tests
This commit is contained in:
@@ -30,10 +30,6 @@ export class ClipboardAddon implements ITerminalAddon {
|
||||
|
||||
const pc = args[0];
|
||||
const pd = args[1];
|
||||
if (pd.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (pc) {
|
||||
case ClipboardSelectionType.SYSTEM:
|
||||
case ClipboardSelectionType.PRIMARY:
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
import { assert } from 'chai';
|
||||
import { openTerminal, launchBrowser, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
||||
import { Browser, BrowserContext, Page } from '@playwright/test';
|
||||
import { beforeEach } from 'mocha';
|
||||
|
||||
const APP = 'http://127.0.0.1:3001/test';
|
||||
|
||||
@@ -62,6 +63,7 @@ describe('ClipboardAddon', () => {
|
||||
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '');
|
||||
});
|
||||
it('empty string', async () => {
|
||||
await writeSync(page, `\x1b]52;c;${testDataEncoded}\x07`);
|
||||
await writeSync(page, `\x1b]52;c;\x07`);
|
||||
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '');
|
||||
});
|
||||
@@ -75,12 +77,12 @@ describe('ClipboardAddon', () => {
|
||||
`);
|
||||
await page.evaluate(() => window.navigator.clipboard.writeText('hello world'));
|
||||
await writeSync(page, `\x1b]52;c;?\x07`);
|
||||
assert.deepEqual(await page.evaluate(`window.data`), [`\x1b]52;c;${testDataEncoded}\x07`]);
|
||||
assert.deepEqual(await page.evaluate('window.data'), [`\x1b]52;c;${testDataEncoded}\x07`]);
|
||||
});
|
||||
it('clear clipboard', async () => {
|
||||
await writeSync(page, `\x1b]52;c;!\x07`);
|
||||
await writeSync(page, `\x1b]52;c;?\x07`);
|
||||
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '\x1b]52;c;\x07');
|
||||
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user