mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 09:42:34 -05:00
* Merge from vscode a348d103d1256a06a2c9b3f9b406298a9fef6898 * Fixes and cleanup * Distro * Fix hygiene yarn * delete no yarn lock changes file * Fix hygiene * Fix layer check * Fix CI * Skip lib checks * Remove tests deleted in vs code * Fix tests * Distro * Fix tests and add removed extension point * Skip failing notebook tests for now * Disable broken tests and cleanup build folder * Update yarn.lock and fix smoke tests * Bump sqlite * fix contributed actions and file spacing * Fix user data path * Update yarn.locks Co-authored-by: ADS Merger <karlb@microsoft.com>
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as assert from 'assert';
|
|
import { URI } from 'vs/base/common/uri';
|
|
import { MainThreadDocumentContentProviders } from 'vs/workbench/api/browser/mainThreadDocumentContentProviders';
|
|
import { createTextModel } from 'vs/editor/test/common/editorTestUtils';
|
|
import { mock } from 'vs/base/test/common/mock';
|
|
import { IModelService } from 'vs/editor/common/services/modelService';
|
|
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
|
|
import { TestRPCProtocol } from 'vs/workbench/test/browser/api/testRPCProtocol';
|
|
import { TextEdit } from 'vs/editor/common/modes';
|
|
|
|
suite('MainThreadDocumentContentProviders', function () {
|
|
|
|
test('events are processed properly', function () {
|
|
|
|
let uri = URI.parse('test:uri');
|
|
let model = createTextModel('1', undefined, undefined, uri);
|
|
|
|
let providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
|
|
new class extends mock<IModelService>() {
|
|
override getModel(_uri: URI) {
|
|
assert.strictEqual(uri.toString(), _uri.toString());
|
|
return model;
|
|
}
|
|
},
|
|
new class extends mock<IEditorWorkerService>() {
|
|
override computeMoreMinimalEdits(_uri: URI, data: TextEdit[] | undefined) {
|
|
assert.strictEqual(model.getValue(), '1');
|
|
return Promise.resolve(data);
|
|
}
|
|
},
|
|
);
|
|
|
|
return new Promise<void>((resolve, reject) => {
|
|
let expectedEvents = 1;
|
|
model.onDidChangeContent(e => {
|
|
expectedEvents -= 1;
|
|
try {
|
|
assert.ok(expectedEvents >= 0);
|
|
} catch (err) {
|
|
reject(err);
|
|
}
|
|
if (model.getValue() === '1\n2\n3') {
|
|
resolve();
|
|
}
|
|
});
|
|
providers.$onVirtualDocumentChange(uri, '1\n2');
|
|
providers.$onVirtualDocumentChange(uri, '1\n2\n3');
|
|
});
|
|
});
|
|
});
|