Fix tests
This commit is contained in:
@@ -30,10 +30,6 @@ export class ClipboardAddon implements ITerminalAddon {
|
|||||||
|
|
||||||
const pc = args[0];
|
const pc = args[0];
|
||||||
const pd = args[1];
|
const pd = args[1];
|
||||||
if (pd.length === 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (pc) {
|
switch (pc) {
|
||||||
case ClipboardSelectionType.SYSTEM:
|
case ClipboardSelectionType.SYSTEM:
|
||||||
case ClipboardSelectionType.PRIMARY:
|
case ClipboardSelectionType.PRIMARY:
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
import { openTerminal, launchBrowser, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
import { openTerminal, launchBrowser, writeSync, getBrowserType } from '../../../out-test/api/TestUtils';
|
||||||
import { Browser, BrowserContext, Page } from '@playwright/test';
|
import { Browser, BrowserContext, Page } from '@playwright/test';
|
||||||
|
import { beforeEach } from 'mocha';
|
||||||
|
|
||||||
const APP = 'http://127.0.0.1:3001/test';
|
const APP = 'http://127.0.0.1:3001/test';
|
||||||
|
|
||||||
@@ -62,6 +63,7 @@ describe('ClipboardAddon', () => {
|
|||||||
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '');
|
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '');
|
||||||
});
|
});
|
||||||
it('empty string', async () => {
|
it('empty string', async () => {
|
||||||
|
await writeSync(page, `\x1b]52;c;${testDataEncoded}\x07`);
|
||||||
await writeSync(page, `\x1b]52;c;\x07`);
|
await writeSync(page, `\x1b]52;c;\x07`);
|
||||||
assert.deepEqual(await page.evaluate(() => window.navigator.clipboard.readText()), '');
|
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 page.evaluate(() => window.navigator.clipboard.writeText('hello world'));
|
||||||
await writeSync(page, `\x1b]52;c;?\x07`);
|
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 () => {
|
it('clear clipboard', async () => {
|
||||||
await writeSync(page, `\x1b]52;c;!\x07`);
|
await writeSync(page, `\x1b]52;c;!\x07`);
|
||||||
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