From 931eb74333c689da548ccc931eb3f82c2765f4dc Mon Sep 17 00:00:00 2001 From: paoloricciuti Date: Thu, 10 Oct 2024 12:44:43 +0200 Subject: [PATCH] chore: add test --- .../svelte/features/getCodeAction.test.ts | 49 +++++++++++++++++++ .../svelte-ignore-code-action.svelte | 6 +++ 2 files changed, 55 insertions(+) diff --git a/packages/language-server/test/plugins/svelte/features/getCodeAction.test.ts b/packages/language-server/test/plugins/svelte/features/getCodeAction.test.ts index e94dcd2fa..617ad0b4f 100644 --- a/packages/language-server/test/plugins/svelte/features/getCodeAction.test.ts +++ b/packages/language-server/test/plugins/svelte/features/getCodeAction.test.ts @@ -421,6 +421,55 @@ describe('SveltePlugin#getCodeAction', () => { } ]); }); + + it('should provide ignore comment in script tags', async () => { + ( + await expectCodeActionFor(svelteIgnoreCodeAction, { + diagnostics: [ + { + severity: DiagnosticSeverity.Warning, + code: 'state_referenced_locally', + range: Range.create( + { line: 13, character: 9 }, + { line: 13, character: 14 } + ), + message: '', + source: 'svelte' + } + ] + }) + ).toEqual([ + { + edit: { + documentChanges: [ + { + edits: [ + { + newText: `\t// svelte-ignore state_referenced_locally${EOL}\t`, + range: { + end: { + character: 0, + line: 13 + }, + start: { + character: 0, + line: 13 + } + } + } + ], + textDocument: { + uri: getUri(svelteIgnoreCodeAction), + version: null + } + } + ] + }, + title: '(svelte) Disable state_referenced_locally for this line', + kind: 'quickfix' + } + ]); + }); }); describe('It should provide svelte ignore code actions (TypeScript)', () => { diff --git a/packages/language-server/test/plugins/svelte/testfiles/svelte-ignore-code-action.svelte b/packages/language-server/test/plugins/svelte/testfiles/svelte-ignore-code-action.svelte index 14bb3276e..7d01939d7 100644 --- a/packages/language-server/test/plugins/svelte/testfiles/svelte-ignore-code-action.svelte +++ b/packages/language-server/test/plugins/svelte/testfiles/svelte-ignore-code-action.svelte @@ -7,3 +7,9 @@ href="" >about {/if} + +