mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-23 18:19:12 +01:00
Adding more pinning tests for JS/TS completions
This commit is contained in:
@@ -267,7 +267,7 @@ suite('TypeScript Completions', () => {
|
||||
));
|
||||
});
|
||||
|
||||
test('should not de-prioritize this.member suggestion, #74164', async () => {
|
||||
test('should not de-prioritize `this.member` suggestion, #74164', async () => {
|
||||
await enumerateConfig(Config.insertMode, insertModes, async config => {
|
||||
await createTestEditor(testDocumentUri,
|
||||
`class A {`,
|
||||
@@ -293,6 +293,32 @@ suite('TypeScript Completions', () => {
|
||||
});
|
||||
});
|
||||
|
||||
test('Member completions for string properties should insert `this.` and use brackets', async () => {
|
||||
await enumerateConfig(Config.insertMode, insertModes, async config => {
|
||||
await createTestEditor(testDocumentUri,
|
||||
`class A {`,
|
||||
` ['xyz 123'] = 1`,
|
||||
` foo() {`,
|
||||
` xyz$0`,
|
||||
` }`,
|
||||
`}`,
|
||||
);
|
||||
|
||||
const document = await acceptFirstSuggestion(testDocumentUri, _disposables);
|
||||
assert.strictEqual(
|
||||
document.getText(),
|
||||
joinLines(
|
||||
`class A {`,
|
||||
` ['xyz 123'] = 1`,
|
||||
` foo() {`,
|
||||
` this["xyz 123"]`,
|
||||
` }`,
|
||||
`}`,
|
||||
),
|
||||
`Config: ${config}`);
|
||||
});
|
||||
});
|
||||
|
||||
test('Accepting a completion in word using insert mode should insert', async () => {
|
||||
await updateConfig({ [Config.insertMode]: 'insert' });
|
||||
|
||||
@@ -327,6 +353,56 @@ suite('TypeScript Completions', () => {
|
||||
));
|
||||
});
|
||||
|
||||
test('Accepting a member completion in word using insert mode add `this.` and insert', async () => {
|
||||
await updateConfig({ [Config.insertMode]: 'insert' });
|
||||
|
||||
await createTestEditor(testDocumentUri,
|
||||
`class Foo {`,
|
||||
` abc = 1;`,
|
||||
` foo() {`,
|
||||
` ab$0c`,
|
||||
` }`,
|
||||
`}`,
|
||||
);
|
||||
|
||||
const document = await acceptFirstSuggestion(testDocumentUri, _disposables);
|
||||
assert.strictEqual(
|
||||
document.getText(),
|
||||
joinLines(
|
||||
`class Foo {`,
|
||||
` abc = 1;`,
|
||||
` foo() {`,
|
||||
` this.abcc`,
|
||||
` }`,
|
||||
`}`,
|
||||
));
|
||||
});
|
||||
|
||||
test('Accepting a member completion in word using replace mode should add `this.` and replace', async () => {
|
||||
await updateConfig({ [Config.insertMode]: 'replace' });
|
||||
|
||||
await createTestEditor(testDocumentUri,
|
||||
`class Foo {`,
|
||||
` abc = 1;`,
|
||||
` foo() {`,
|
||||
` ab$0c`,
|
||||
` }`,
|
||||
`}`,
|
||||
);
|
||||
|
||||
const document = await acceptFirstSuggestion(testDocumentUri, _disposables);
|
||||
assert.strictEqual(
|
||||
document.getText(),
|
||||
joinLines(
|
||||
`class Foo {`,
|
||||
` abc = 1;`,
|
||||
` foo() {`,
|
||||
` this.abc`,
|
||||
` }`,
|
||||
`}`,
|
||||
));
|
||||
});
|
||||
|
||||
test('Accepting string completion inside string using insert mode should insert', async () => {
|
||||
await updateConfig({ [Config.insertMode]: 'insert' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user