|
3 | 3 | * Licensed under the MIT License. See License.txt in the project root for license information. |
4 | 4 | *--------------------------------------------------------------------------------------------*/ |
5 | 5 |
|
6 | | -import { deepStrictEqual, doesNotThrow, equal, ok, strictEqual, throws } from 'assert'; |
| 6 | +import { deepStrictEqual, doesNotThrow, equal, notEqual, ok, strictEqual, throws } from 'assert'; |
7 | 7 | 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'; |
8 | 8 | import { assertNoRpc, poll } from '../utils'; |
9 | 9 |
|
@@ -349,21 +349,25 @@ import { assertNoRpc, poll } from '../utils'; |
349 | 349 |
|
350 | 350 | suite('selection', () => { |
351 | 351 | 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(); |
353 | 354 | equal(terminal.selection, undefined); |
354 | 355 | terminal.dispose(); |
355 | 356 | }); |
356 | 357 | 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(); |
358 | 360 | 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'); |
360 | 362 | terminal.dispose(); |
361 | 363 | }); |
362 | 364 | 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(); |
364 | 367 | 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'); |
366 | 369 | await commands.executeCommand('workbench.action.terminal.clearSelection'); |
| 370 | + await poll<void>(() => Promise.resolve(), () => terminal.selection === undefined, 'selection should not be defined'); |
367 | 371 | terminal.dispose(); |
368 | 372 | }); |
369 | 373 | }); |
|
0 commit comments