当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript TestInstantiationService.createInstance方法代码示例

本文整理汇总了TypeScript中vs/platform/instantiation/test/common/instantiationServiceMock.TestInstantiationService.createInstance方法的典型用法代码示例。如果您正苦于以下问题:TypeScript TestInstantiationService.createInstance方法的具体用法?TypeScript TestInstantiationService.createInstance怎么用?TypeScript TestInstantiationService.createInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在vs/platform/instantiation/test/common/instantiationServiceMock.TestInstantiationService的用法示例。


在下文中一共展示了TestInstantiationService.createInstance方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: test

	test('filter by cmd key', () => {
		testObject = instantiationService.createInstance(KeybindingsEditorModel, OperatingSystem.Macintosh);

		const command = 'a' + uuid.generateUuid();
		const expected = aResolvedKeybindingItem({ command, firstPart: { keyCode: KeyCode.Escape, modifiers: { metaKey: true } }, when: 'whenContext1 && whenContext2', isDefault: false });
		prepareKeybindingService(expected);

		return testObject.resolve().then(() => {
			const actual = testObject.fetch('cmd').filter(element => element.keybindingItem.command === command);
			assert.equal(1, actual.length);
			assert.deepEqual(actual[0].keybindingMatches.firstPart, { metaKey: true });
			assert.deepEqual(actual[0].keybindingMatches.chordPart, {});
		});
	});
开发者ID:elibarzilay,项目名称:vscode,代码行数:14,代码来源:keybindingsEditorModel.test.ts

示例2: setup

	setup(() => {
		storageData = {};
		instantiationService.stub(IStorageService, {
			get: (a, b, c) => a === 'experiments.experiment1' ? JSON.stringify(storageData) : c,
			store: (a, b, c) => {
				if (a === 'experiments.experiment1') {
					storageData = JSON.parse(b);
				}
			}
		});
		instantiationService.stub(INotificationService, new TestNotificationService());
		experimentService = instantiationService.createInstance(TestExperimentService);
		experimentService.onExperimentEnabled = onExperimentEnabledEvent.event;
		instantiationService.stub(IExperimentService, experimentService);
	});
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:15,代码来源:experimentalPrompts.test.ts

示例3: setup

		setup(() => {
			let contextKeyService = new MockContextKeyService();
			let keybindingService = new MockKeybindingService();
			let terminalFocusContextKey = contextKeyService.createKey('test', false);
			instantiationService = new TestInstantiationService();
			instantiationService.stub(IMessageService, new TestMessageService());
			instantiationService.stub(IWorkspaceContextService, new TestContextService());
			instantiationService.stub(IKeybindingService, keybindingService);
			instantiationService.stub(IContextKeyService, contextKeyService);
			instantiationService.stub(IHistoryService, new TestHistoryService());
			configHelper = {
				config: {
					cwd: null
				}
			};
			instance = instantiationService.createInstance(TestTerminalInstance, terminalFocusContextKey, configHelper, null, null);
		});
开发者ID:SeanKilleen,项目名称:vscode,代码行数:17,代码来源:terminalInstance.test.ts

示例4: test

	test('Search Model: Search reports timed telemetry on search when progress is not called', () => {
		let target2 = sinon.spy();
		stub(nullEvent, 'stop', target2);
		let target1 = sinon.stub().returns(nullEvent);
		instantiationService.stub(ITelemetryService, 'publicLog', target1);

		instantiationService.stub(ISearchService, 'search', ppromiseWithProgress([]));

		let testObject = instantiationService.createInstance(SearchModel);
		const result = testObject.search({ contentPattern: { pattern: 'somestring' }, type: 1, folderQueries });

		return result.then(() => {
			return timeout(1).then(() => {
				assert.ok(target1.calledWith('searchResultsFirstRender'));
				assert.ok(target1.calledWith('searchResultsFinished'));
			});
		});
	});
开发者ID:jinlongchen2018,项目名称:vscode,代码行数:18,代码来源:searchModel.test.ts

示例5: setup

	setup(() => {
		configurationService = new TestConfigurationService();
		configurationService.setUserConfiguration('terminal', {
			integrated: {
				shell: {
					linux: TERMINAL_DEFAULT_SHELL_LINUX,
					osx: TERMINAL_DEFAULT_SHELL_OSX,
					windows: TERMINAL_DEFAULT_SHELL_WINDOWS
				},
				setLocaleVariables: false
			}
		});
		instantiationService = new TestInstantiationService();
		instantiationService.stub(IContextKeyService, { createKey: () => null });
		instantiationService.stub(IConfigurationService, configurationService);
		instantiationService.stub(IInstantiationService, instantiationService);
		instantiationService.stub(IWorkspaceContextService, { getWorkspace: () => null });
		service = instantiationService.createInstance(TestTerminalService);
	});
开发者ID:StateFarmIns,项目名称:vscode,代码行数:19,代码来源:terminalService.test.ts

示例6: test

	test('Search Model: Search reports timed telemetry on search when progress is not called', function (done) {
		let target2 = sinon.spy();
		stub(nullEvent, 'stop', target2);
		let target1 = sinon.stub().returns(nullEvent);
		instantiationService.stub(ITelemetryService, 'publicLog', target1);

		instantiationService.stub(ISearchService, 'search', PPromise.as({ results: [] }));

		let testObject = instantiationService.createInstance(SearchModel);
		const result = testObject.search({ contentPattern: { pattern: 'somestring' }, type: 1 });

		setTimeout(() => {
			result.done(() => {
				assert.ok(target1.calledWith('searchResultsFirstRender'));
				assert.ok(target1.calledWith('searchResultsFinished'));

				done();
			});
		}, 0);
	});
开发者ID:FabianLauer,项目名称:vscode,代码行数:20,代码来源:searchModel.test.ts

示例7: test

	test('Data Source', function () {
		let ds = new SearchDataSource();
		let result = instantiation.createInstance(SearchResult, null);
		result.add([{
			resource: uri.parse('file:///c:/foo'),
			lineMatches: [{ lineNumber: 1, preview: 'bar', offsetAndLengths: [[0, 1]] }]
		}]);

		let fileMatch = result.matches()[0];
		let lineMatch = fileMatch.matches()[0];

		assert.equal(ds.getId(null, result), 'root');
		assert.equal(ds.getId(null, fileMatch), 'file:///c%3A/foo');
		assert.equal(ds.getId(null, lineMatch), 'file:///c%3A/foo>1>0b');

		assert(!ds.hasChildren(null, 'foo'));
		assert(ds.hasChildren(null, result));
		assert(ds.hasChildren(null, fileMatch));
		assert(!ds.hasChildren(null, lineMatch));
	});
开发者ID:FabianLauer,项目名称:vscode,代码行数:20,代码来源:searchViewlet.test.ts

示例8: test

	test('Search Model: Search reports timed telemetry on search when error is cancelled error', function () {
		let target2 = sinon.spy();
		stub(nullEvent, 'stop', target2);
		let target1 = sinon.stub().returns(nullEvent);
		instantiationService.stub(ITelemetryService, 'publicLog', target1);

		let promise = new DeferredPPromise<ISearchComplete, ISearchProgressItem>();
		instantiationService.stub(ISearchService, 'search', promise);

		let testObject = instantiationService.createInstance(SearchModel);
		let result = testObject.search({ contentPattern: { pattern: 'somestring' }, type: 1, folderQueries });

		promise.cancel();

		return timeout(1).then(() => {
			return result.then(() => { }, () => {
				assert.ok(target1.calledWith('searchResultsFirstRender'));
				assert.ok(target1.calledWith('searchResultsFinished'));
				// assert.ok(target2.calledOnce);
			});
		});
	});
开发者ID:AllureFer,项目名称:vscode,代码行数:22,代码来源:searchModel.test.ts

示例9: test

	test('Show experimental prompt if experiment should be run. Choosing an option should mark experiment as complete', () => {

		storageData = {
			enabled: true,
			state: ExperimentState.Run
		};

		instantiationService.stub(INotificationService, {
			prompt: (a: Severity, b: string, c: IPromptChoice[], d) => {
				assert.equal(b, promptText);
				assert.equal(c.length, 2);
				c[0].run();
			}
		});

		experimentalPrompt = instantiationService.createInstance(ExperimentalPrompts);
		onExperimentEnabledEvent.fire(experiment);

		return TPromise.as(null).then(result => {
			assert.equal(storageData['state'], ExperimentState.Complete);
		});

	});
开发者ID:burhandodhy,项目名称:azuredatastudio,代码行数:23,代码来源:experimentalPrompts.test.ts


注:本文中的vs/platform/instantiation/test/common/instantiationServiceMock.TestInstantiationService.createInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。