Merge from vscode c873727e8bac95e7cbf5b154a9e6ae0986f2ce18 (#6446)

This commit is contained in:
Anthony Dresser
2019-07-19 19:21:54 -07:00
committed by GitHub
parent 5c63f7bdb5
commit b21435743d
63 changed files with 2049 additions and 1000 deletions

View File

@@ -12,33 +12,39 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
import { INotificationService } from 'vs/platform/notification/common/notification';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
class TestKeyboardMapperFactory extends BrowserKeyboardMapperFactoryBase {
constructor(notificationService: INotificationService, storageService: IStorageService, commandService: ICommandService) {
super(notificationService, storageService, commandService);
let keymapInfos: IKeymapInfo[] = KeyboardLayoutContribution.INSTANCE.layoutInfos;
const keymapInfos: IKeymapInfo[] = KeyboardLayoutContribution.INSTANCE.layoutInfos;
this._keymapInfos.push(...keymapInfos.map(info => (new KeymapInfo(info.layout, info.secondaryLayouts, info.mapping, info.isUserKeyboardLayout))));
this._mru = this._keymapInfos;
this._initialized = true;
this.onKeyboardLayoutChanged();
const usLayout = this.getUSStandardLayout();
if (usLayout) {
this.setActiveKeyMapping(usLayout.mapping);
}
}
}
suite('keyboard layout loader', () => {
let instantiationService: TestInstantiationService = new TestInstantiationService();
let notitifcationService = instantiationService.stub(INotificationService, {});
let storageService = instantiationService.stub(IStorageService, {});
let notitifcationService = instantiationService.stub(INotificationService, new TestNotificationService());
let storageService = instantiationService.stub(IStorageService, new TestStorageService());
let commandService = instantiationService.stub(ICommandService, {});
let instance = new TestKeyboardMapperFactory(notitifcationService, storageService, commandService);
test.skip('load default US keyboard layout', () => {
test('load default US keyboard layout', () => {
assert.notEqual(instance.activeKeyboardLayout, null);
assert.equal(instance.activeKeyboardLayout!.isUSStandard, true);
});
test.skip('isKeyMappingActive', () => {
test('isKeyMappingActive', () => {
assert.equal(instance.isKeyMappingActive({
KeyA: {
value: 'a',