From 1512e4a7efc827b715429c19b63f1b5a25152ac7 Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Thu, 12 Dec 2024 13:41:16 +0100 Subject: [PATCH] fix test --- .../test/plugins/html/HTMLPlugin.test.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/language-server/test/plugins/html/HTMLPlugin.test.ts b/packages/language-server/test/plugins/html/HTMLPlugin.test.ts index 7cf0bfa44..aaad0f52c 100644 --- a/packages/language-server/test/plugins/html/HTMLPlugin.test.ts +++ b/packages/language-server/test/plugins/html/HTMLPlugin.test.ts @@ -13,6 +13,9 @@ import { import { HTMLPlugin } from '../../../src/plugins'; import { DocumentManager, Document } from '../../../src/lib/documents'; import { LSConfigManager } from '../../../src/ls-config'; +import { VERSION } from 'svelte/compiler'; + +const isSvelte5Plus = Number(VERSION.split('.')[0]) >= 5; describe('HTML Plugin', () => { function setup(content: string) { @@ -67,7 +70,7 @@ describe('HTML Plugin', () => { const completions = await plugin.getCompletions(document, Position.create(0, 7)); const onClick = completions?.items.find((item) => item.label === 'on:click'); - assert.deepStrictEqual(onClick, { + const expected: CompletionItem = { label: 'on:click', kind: CompletionItemKind.Value, documentation: { @@ -80,7 +83,13 @@ describe('HTML Plugin', () => { ), insertTextFormat: InsertTextFormat.Snippet, command: undefined - }); + }; + + if (isSvelte5Plus) { + expected.sortText = 'zon:click'; + } + + assert.deepStrictEqual(onClick, expected); }); it('provide event handler completions in svelte strict mode', async () => {