Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
dummdidumm committed Dec 12, 2024
1 parent ad0872d commit 1512e4a
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/language-server/test/plugins/html/HTMLPlugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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, <CompletionItem>{
const expected: CompletionItem = {
label: 'on:click',
kind: CompletionItemKind.Value,
documentation: {
Expand All @@ -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 () => {
Expand Down

0 comments on commit 1512e4a

Please sign in to comment.