Skip to content

Commit 775102b

Browse files
committed
Implement tests
1 parent 99e31ae commit 775102b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

extensions/vscode-api-tests/src/singlefolder-tests/terminal.test.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { deepStrictEqual, doesNotThrow, equal, ok, strictEqual, throws } from 'assert';
6+
import { deepStrictEqual, doesNotThrow, equal, notEqual, ok, strictEqual, throws } from 'assert';
77
import { commands, ConfigurationTarget, Disposable, env, EnvironmentVariableCollection, EnvironmentVariableMutator, EnvironmentVariableMutatorOptions, EnvironmentVariableMutatorType, EnvironmentVariableScope, EventEmitter, ExtensionContext, extensions, ExtensionTerminalOptions, Pseudoterminal, Terminal, TerminalDimensions, TerminalExitReason, TerminalOptions, TerminalState, UIKind, Uri, window, workspace } from 'vscode';
88
import { assertNoRpc, poll } from '../utils';
99

@@ -349,21 +349,25 @@ import { assertNoRpc, poll } from '../utils';
349349

350350
suite('selection', () => {
351351
test('should be undefined immediately after creation', async () => {
352-
const terminal = window.createTerminal({ name: 'bg', hideFromUser: true });
352+
const terminal = window.createTerminal({ name: 'selection test' });
353+
terminal.show();
353354
equal(terminal.selection, undefined);
354355
terminal.dispose();
355356
});
356357
test('should be defined after selecting all content', async () => {
357-
const terminal = window.createTerminal({ name: 'bg', hideFromUser: true });
358+
const terminal = window.createTerminal({ name: 'selection test' });
359+
terminal.show();
358360
await commands.executeCommand('workbench.action.terminal.selectAll');
359-
// TODO: Need to poll?
361+
await poll<void>(() => Promise.resolve(), () => terminal.selection !== undefined, 'selection should be defined');
360362
terminal.dispose();
361363
});
362364
test('should be undefined after clearing a selection', async () => {
363-
const terminal = window.createTerminal({ name: 'bg', hideFromUser: true });
365+
const terminal = window.createTerminal({ name: 'selection test' });
366+
terminal.show();
364367
await commands.executeCommand('workbench.action.terminal.selectAll');
365-
// TODO: Need to poll?
368+
await poll<void>(() => Promise.resolve(), () => terminal.selection !== undefined, 'selection should be defined');
366369
await commands.executeCommand('workbench.action.terminal.clearSelection');
370+
await poll<void>(() => Promise.resolve(), () => terminal.selection === undefined, 'selection should not be defined');
367371
terminal.dispose();
368372
});
369373
});

0 commit comments

Comments
 (0)