From 308a4f6a48499edc2e1e987ee4604e2d2198adcf Mon Sep 17 00:00:00 2001 From: Matt Bierner Date: Fri, 15 Jan 2021 10:35:06 -0800 Subject: [PATCH] Make sure ts extension has loaded before running on-enter tests Fixes #101922 Also adds back a test that was incorrectly removed --- .../src/test/onEnter.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/extensions/typescript-language-features/src/test/onEnter.test.ts b/extensions/typescript-language-features/src/test/onEnter.test.ts index 72e59b4482f..5ec03f5c40a 100644 --- a/extensions/typescript-language-features/src/test/onEnter.test.ts +++ b/extensions/typescript-language-features/src/test/onEnter.test.ts @@ -28,6 +28,11 @@ const type = async (document: vscode.TextDocument, text: string): Promise { + setup(async () => { + // the tests make the assumption that language rules are registered + await vscode.extensions.getExtension('vscode.typescript-language-features')!.activate(); + }); + test('should indent after if block with braces', () => { return withRandomFileEditor(`if (true) {${CURSOR}`, 'js', async (_editor, document) => { await type(document, '\nx'); @@ -51,4 +56,15 @@ suite('OnEnter', () => { `})`)); }); }); + + test('should indent after simple jsx tag with attributes', () => { + return withRandomFileEditor(`const a =
${CURSOR}`, 'jsx', async (_editor, document) => { + await type(document, '\nx'); + assert.strictEqual( + document.getText(), + joinLines( + `const a =
`, + ` x`)); + }); + }); });