Skip to content

Commit

Permalink
Make sure ts extension has loaded before running on-enter tests
Browse files Browse the repository at this point in the history
Fixes #101922

Also adds back a test that was incorrectly removed
  • Loading branch information
mjbvz committed Jan 15, 2021
1 parent d87041e commit 308a4f6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions extensions/typescript-language-features/src/test/onEnter.test.ts
Expand Up @@ -28,6 +28,11 @@ const type = async (document: vscode.TextDocument, text: string): Promise<vscode
};

suite('OnEnter', () => {
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');
Expand All @@ -51,4 +56,15 @@ suite('OnEnter', () => {
`})`));
});
});

test('should indent after simple jsx tag with attributes', () => {
return withRandomFileEditor(`const a = <div onclick={bla}>${CURSOR}`, 'jsx', async (_editor, document) => {
await type(document, '\nx');
assert.strictEqual(
document.getText(),
joinLines(
`const a = <div onclick={bla}>`,
` x`));
});
});
});

0 comments on commit 308a4f6

Please sign in to comment.