From df2d0c0feec75366dbfc6be6b6966e29497b35d0 Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 4 Jan 2019 16:23:28 -0800 Subject: [PATCH] Add pinning test for #53962 --- .../src/test/completions.test.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/extensions/typescript-language-features/src/test/completions.test.ts b/extensions/typescript-language-features/src/test/completions.test.ts index 5a0a8b8d9c7..d1ce57dad8a 100644 --- a/extensions/typescript-language-features/src/test/completions.test.ts +++ b/extensions/typescript-language-features/src/test/completions.test.ts @@ -52,6 +52,32 @@ suite('TypeScript Completions', () => { 'x.a' )); }); + + test('Accepting a string completion should replace the entire string. #53962', async () => { + await wait(100); + + await createTestEditor(testDocumentUri, + 'interface TFunction {', + ` (_: 'abc.abc2', __ ?: {}): string;`, + ` (_: 'abc.abc', __?: {}): string;`, + `}`, + 'const f: TFunction = (() => { }) as any;', + `f('abc.abc$0')` + ); + + const document = await acceptFirstSuggestion(testDocumentUri, _disposables); + assert.strictEqual( + document.getText(), + joinLines( + 'interface TFunction {', + ` (_: 'abc.abc2', __ ?: {}): string;`, + ` (_: 'abc.abc', __?: {}): string;`, + `}`, + 'const f: TFunction = (() => { }) as any;', + `f('abc.abc')` + )); + }); + }); const joinLines = (...args: string[]) => args.join('\n');