Merge VS Code 1.23.1 (#1520)

This commit is contained in:
Matt Irvine
2018-06-05 11:24:51 -07:00
committed by GitHub
parent e3baf5c443
commit 0c58f09e59
3651 changed files with 74249 additions and 48599 deletions

View File

@@ -3,26 +3,28 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SpectronApplication } from '../../spectron/application';
import { Commands } from '../workbench/workbench';
import { Code } from '../../vscode/code';
const SEARCH_INPUT = '.settings-search-input input';
export class KeybindingsEditor {
constructor(private spectron: SpectronApplication) { }
constructor(private code: Code, private commands: Commands) { }
async updateKeybinding(command: string, keys: string[], ariaLabel: string): Promise<any> {
await this.spectron.runCommand('workbench.action.openGlobalKeybindings');
await this.spectron.client.waitForActiveElement(SEARCH_INPUT);
await this.spectron.client.setValue(SEARCH_INPUT, command);
async updateKeybinding(command: string, keybinding: string, ariaLabel: string): Promise<any> {
await this.commands.runCommand('workbench.action.openGlobalKeybindings');
await this.code.waitForActiveElement(SEARCH_INPUT);
await this.code.waitForSetValue(SEARCH_INPUT, command);
await this.spectron.client.waitAndClick('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item');
await this.spectron.client.waitForElement('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item.focused.selected');
await this.code.waitAndClick('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item');
await this.code.waitForElement('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item.focused.selected');
await this.spectron.client.waitAndClick('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item .action-item .icon.add');
await this.spectron.client.waitForElement('.defineKeybindingWidget .monaco-inputbox.synthetic-focus');
await this.code.waitAndClick('div[aria-label="Keybindings"] .monaco-list-row.keybinding-item .action-item .icon.add');
await this.code.waitForElement('.defineKeybindingWidget .monaco-inputbox.synthetic-focus');
await this.spectron.client.keys([...keys, 'NULL', 'Enter', 'NULL']);
await this.spectron.client.waitForElement(`div[aria-label="Keybindings"] div[aria-label="Keybinding is ${ariaLabel}."]`);
await this.code.dispatchKeybinding(keybinding);
await this.code.dispatchKeybinding('enter');
await this.code.waitForElement(`div[aria-label="Keybindings"] div[aria-label="Keybinding is ${ariaLabel}."]`);
}
}

View File

@@ -3,45 +3,34 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as assert from 'assert';
import { SpectronApplication } from '../../spectron/application';
import { Application } from '../../application';
import { ActivityBarPosition } from '../activitybar/activityBar';
export function setup() {
describe('Preferences', () => {
before(function () {
this.app.suiteName = 'Preferences';
});
it('turns off editor line numbers and verifies the live change', async function () {
const app = this.app as SpectronApplication;
const app = this.app as Application;
await app.workbench.explorer.openFile('app.js');
let lineNumbers = await app.client.waitForElements('.line-numbers');
await app.screenCapturer.capture('app.js has line numbers');
assert.ok(!!lineNumbers.length, 'Line numbers are not present in the editor before disabling them.');
await app.code.waitForElements('.line-numbers', false, elements => !!elements.length);
await app.workbench.settingsEditor.addUserSetting('editor.lineNumbers', '"off"');
await app.workbench.selectTab('app.js');
lineNumbers = await app.client.waitForElements('.line-numbers', result => !result || result.length === 0);
await app.screenCapturer.capture('line numbers hidden');
assert.ok(!lineNumbers.length, 'Line numbers are still present in the editor after disabling them.');
await app.workbench.editors.selectTab('app.js');
await app.code.waitForElements('.line-numbers', false, result => !result || result.length === 0);
});
it(`changes 'workbench.action.toggleSidebarPosition' command key binding and verifies it`, async function () {
const app = this.app as SpectronApplication;
assert.ok(await app.workbench.activitybar.getActivityBar(ActivityBarPosition.LEFT), 'Activity bar should be positioned on the left.');
const app = this.app as Application;
await app.workbench.activitybar.waitForActivityBar(ActivityBarPosition.LEFT);
await app.workbench.keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', ['Control', 'u'], 'Control+U');
await app.workbench.keybindingsEditor.updateKeybinding('workbench.action.toggleSidebarPosition', 'ctrl+u', 'Control+U');
await app.client.keys(['Control', 'u', 'NULL']);
assert.ok(await app.workbench.activitybar.getActivityBar(ActivityBarPosition.RIGHT), 'Activity bar was not moved to right after toggling its position.');
await app.code.dispatchKeybinding('ctrl+u');
await app.workbench.activitybar.waitForActivityBar(ActivityBarPosition.RIGHT);
});
after(async function () {
const app = this.app as SpectronApplication;
const app = this.app as Application;
await app.workbench.settingsEditor.clearUserSettings();
});
});

View File

@@ -5,7 +5,10 @@
import * as fs from 'fs';
import * as path from 'path';
import { SpectronApplication } from '../../spectron/application';
import { Commands } from '../workbench/workbench';
import { Editor } from '../editor/editor';
import { Editors } from '../editor/editors';
import { Code } from '../../vscode/code';
export enum ActivityBarPosition {
LEFT = 0,
@@ -13,33 +16,28 @@ export enum ActivityBarPosition {
}
const SEARCH_INPUT = '.settings-search-input input';
const EDITOR = '.editable-preferences-editor-container .monaco-editor textarea';
export class SettingsEditor {
constructor(private spectron: SpectronApplication) { }
constructor(private code: Code, private userDataPath: string, private commands: Commands, private editors: Editors, private editor: Editor) { }
async addUserSetting(setting: string, value: string): Promise<void> {
await this.spectron.runCommand('workbench.action.openGlobalSettings');
await this.spectron.client.waitAndClick(SEARCH_INPUT);
await this.spectron.client.waitForActiveElement(SEARCH_INPUT);
await this.commands.runCommand('workbench.action.openGlobalSettings');
await this.code.waitAndClick(SEARCH_INPUT);
await this.code.waitForActiveElement(SEARCH_INPUT);
await this.spectron.client.keys(['ArrowDown', 'NULL']);
await this.spectron.client.waitForActiveElement(EDITOR);
await this.editor.waitForEditorFocus('settings.json', 1, '.editable-preferences-editor-container');
await this.spectron.client.keys(['ArrowRight', 'NULL']);
await this.spectron.screenCapturer.capture('user settings is open and focused');
await this.spectron.workbench.editor.waitForTypeInEditor('settings.json', `"${setting}": ${value}`, '.editable-preferences-editor-container');
await this.spectron.workbench.saveOpenedFile();
await this.spectron.screenCapturer.capture('user settings has changed');
await this.code.dispatchKeybinding('right');
await this.editor.waitForTypeInEditor('settings.json', `"${setting}": ${value}`, '.editable-preferences-editor-container');
await this.editors.saveOpenedFile();
}
async clearUserSettings(): Promise<void> {
const settingsPath = path.join(this.spectron.userDataPath, 'User', 'settings.json');
const settingsPath = path.join(this.userDataPath, 'User', 'settings.json');
await new Promise((c, e) => fs.writeFile(settingsPath, '{}', 'utf8', err => err ? e(err) : c()));
await this.spectron.workbench.editor.waitForEditorContents('settings.json', c => c.length === 0, '.editable-preferences-editor-container');
await this.commands.runCommand('workbench.action.openGlobalSettings');
await this.editor.waitForEditorContents('settings.json', c => c === '{}', '.editable-preferences-editor-container');
}
}