mirror of
https://github.com/Microsoft/vscode
synced 2024-09-13 13:46:13 +00:00
fix #137590
This commit is contained in:
parent
6729fbbc86
commit
4e303fcc52
|
@ -72,7 +72,7 @@ class PlaywrightDriver implements IDriver {
|
||||||
await timeout(100);
|
await timeout(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keybinding.startsWith('Alt') || keybinding.startsWith('Control')) {
|
if (keybinding.startsWith('Alt') || keybinding.startsWith('Control') || keybinding.startsWith('Backspace')) {
|
||||||
await this._page.keyboard.press(keybinding);
|
await this._page.keyboard.press(keybinding);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,10 +64,13 @@ export class Terminal {
|
||||||
}
|
}
|
||||||
|
|
||||||
async runCommandWithValue(commandId: TerminalCommandIdWithValue, value?: string, altKey?: boolean): Promise<void> {
|
async runCommandWithValue(commandId: TerminalCommandIdWithValue, value?: string, altKey?: boolean): Promise<void> {
|
||||||
const shouldKeepOpen = !!value || commandId === TerminalCommandIdWithValue.SelectDefaultProfile || commandId === TerminalCommandIdWithValue.NewWithProfile;
|
const shouldKeepOpen = !!value || commandId === TerminalCommandIdWithValue.SelectDefaultProfile || commandId === TerminalCommandIdWithValue.NewWithProfile || commandId === TerminalCommandIdWithValue.Rename;
|
||||||
await this.quickaccess.runCommand(commandId, shouldKeepOpen);
|
await this.quickaccess.runCommand(commandId, shouldKeepOpen);
|
||||||
if (value) {
|
if (value) {
|
||||||
await this.code.waitForSetValue(QuickInput.QUICK_INPUT_INPUT, value);
|
await this.code.waitForSetValue(QuickInput.QUICK_INPUT_INPUT, value);
|
||||||
|
} else if (commandId === TerminalCommandIdWithValue.Rename) {
|
||||||
|
// Reset
|
||||||
|
await this.code.dispatchKeybinding('Backspace');
|
||||||
}
|
}
|
||||||
await this.code.dispatchKeybinding(altKey ? 'Alt+Enter' : 'enter');
|
await this.code.dispatchKeybinding(altKey ? 'Alt+Enter' : 'enter');
|
||||||
await this.quickinput.waitForQuickInputClosed();
|
await this.quickinput.waitForQuickInputClosed();
|
||||||
|
@ -108,6 +111,10 @@ export class Terminal {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getSingleTabName(): Promise<string> {
|
||||||
|
return await (await this.code.waitForElement(Selector.SingleTab, singleTab => !!singleTab && singleTab?.textContent.length > 1)).textContent;
|
||||||
|
}
|
||||||
|
|
||||||
private async assertTabExpected(selector?: string, listIndex?: number, nameRegex?: RegExp, icon?: string, color?: string): Promise<void> {
|
private async assertTabExpected(selector?: string, listIndex?: number, nameRegex?: RegExp, icon?: string, color?: string): Promise<void> {
|
||||||
if (listIndex) {
|
if (listIndex) {
|
||||||
if (nameRegex) {
|
if (nameRegex) {
|
||||||
|
|
|
@ -67,6 +67,15 @@ export function setup(opts: ParsedArgs) {
|
||||||
await terminal.assertSingleTab({ name });
|
await terminal.assertSingleTab({ name });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should reset the tab name to the default value when no name is provided', async () => {
|
||||||
|
await terminal.runCommand(TerminalCommandId.Show);
|
||||||
|
const defaultName = await terminal.getSingleTabName();
|
||||||
|
const name = 'my terminal name';
|
||||||
|
await terminal.runCommandWithValue(TerminalCommandIdWithValue.Rename, name);
|
||||||
|
await terminal.runCommandWithValue(TerminalCommandIdWithValue.Rename, undefined);
|
||||||
|
await terminal.assertSingleTab({ name: defaultName });
|
||||||
|
});
|
||||||
|
|
||||||
it('should rename the tab in the tabs list', async () => {
|
it('should rename the tab in the tabs list', async () => {
|
||||||
await terminal.runCommand(TerminalCommandId.Show);
|
await terminal.runCommand(TerminalCommandId.Show);
|
||||||
await terminal.runCommand(TerminalCommandId.Split);
|
await terminal.runCommand(TerminalCommandId.Split);
|
||||||
|
|
Loading…
Reference in a new issue