當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript configurationModels.ConfigurationModel類代碼示例

本文整理匯總了TypeScript中vs/platform/configuration/common/configurationModels.ConfigurationModel的典型用法代碼示例。如果您正苦於以下問題:TypeScript ConfigurationModel類的具體用法?TypeScript ConfigurationModel怎麽用?TypeScript ConfigurationModel使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了ConfigurationModel類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

	test('simple merge', () => {
		let base = new ConfigurationModel({ 'a': 1, 'b': 2 }, ['a', 'b']);
		let add = new ConfigurationModel({ 'a': 3, 'c': 4 }, ['a', 'c']);
		let result = base.merge(add);

		assert.deepEqual(result.contents, { 'a': 3, 'b': 2, 'c': 4 });
		assert.deepEqual(result.keys, ['a', 'b', 'c']);
	});
開發者ID:eamodio,項目名稱:vscode,代碼行數:8,代碼來源:configurationModels.test.ts

示例2: test

	test('removeValue: remove a multi segemented key', () => {
		let testObject = new ConfigurationModel({ 'a': { 'b': 1 } }, ['a.b']);

		testObject.removeValue('a.b');

		assert.deepEqual(testObject.contents, {});
		assert.deepEqual(testObject.keys, []);
	});
開發者ID:AlexxNica,項目名稱:sqlopsstudio,代碼行數:8,代碼來源:configurationModels.test.ts

示例3: test

	test('removeValue: remove a single segmented key', () => {
		let testObject = new ConfigurationModel({ 'a': 1 }, ['a']);

		testObject.removeValue('a');

		assert.deepEqual(testObject.contents, {});
		assert.deepEqual(testObject.keys, []);
	});
開發者ID:PKRoma,項目名稱:vscode,代碼行數:8,代碼來源:configurationModels.test.ts

示例4: test

	test('setValueInOverrides adds a nested key to overrides if exist', () => {
		let testObject = new ConfigurationModel({ 'a': 1, 'b': 1 }, ['a'], [{ identifiers: ['or'], contents: { 'a': { 'c': 1 } } }]);

		testObject.setValueInOverrides('or', 'a.c', 2);

		assert.deepEqual(testObject.overrides[0].contents, { 'a': { 'c': 2 } });
		assert.deepEqual(testObject.override('or').contents, { 'a': { 'c': 2 }, 'b': 1 });
	});
開發者ID:gokulakrishna9,項目名稱:vscode,代碼行數:8,代碼來源:configurationModels.test.ts

示例5: test

	test('recursive merge', () => {
		let base = new ConfigurationModel({ 'a': { 'b': 1 } }, ['a.b']);
		let add = new ConfigurationModel({ 'a': { 'b': 2 } }, ['a.b']);
		let result = base.merge(add);

		assert.deepEqual(result.contents, { 'a': { 'b': 2 } });
		assert.deepEqual(result.getValue('a'), { 'b': 2 });
		assert.deepEqual(result.keys, ['a.b']);
	});
開發者ID:VishalMadhvani,項目名稱:vscode,代碼行數:9,代碼來源:configurationModels.test.ts

示例6: test

	test('setValueInOverrides adds new overrides if exist', () => {
		let testObject = new ConfigurationModel({ 'a': 1, 'b': 1 }, ['a'], [{ identifiers: ['or1'], contents: { 'a': 2 } }]);

		testObject.setValueInOverrides('or2', 'b', 2);

		assert.deepEqual(testObject.overrides[0].contents, { 'a': 2 });
		assert.deepEqual(testObject.overrides[1].contents, { 'b': 2 });
		assert.deepEqual(testObject.override('or1').contents, { 'a': 2, 'b': 1 });
		assert.deepEqual(testObject.override('or2').contents, { 'a': 1, 'b': 2 });
	});
開發者ID:SeanKilleen,項目名稱:vscode,代碼行數:10,代碼來源:configurationModels.test.ts


注:本文中的vs/platform/configuration/common/configurationModels.ConfigurationModel類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。