Skip to content

Commit a6a29da

Browse files
committed
Add more tests
1 parent e92420d commit a6a29da

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

packages/tailwindcss-language-server/tests/env/custom-languages.test.js

+48-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test } from 'vitest'
22
import { init } from '../common'
3-
import { HoverRequest } from 'vscode-languageserver'
3+
import { CompletionRequest, HoverRequest } from 'vscode-languageserver'
44

55
test('Unknown languages do not provide completions', async ({ expect }) => {
66
let c = await init('basic')
@@ -16,6 +16,14 @@ test('Unknown languages do not provide completions', async ({ expect }) => {
1616
})
1717

1818
expect(hover).toEqual(null)
19+
20+
let completion = await c.sendRequest(CompletionRequest.type, {
21+
textDocument,
22+
position: { line: 0, character: 13 },
23+
context: { triggerKind: 1 },
24+
})
25+
26+
expect(completion).toBe(null)
1927
})
2028

2129
test('Custom languages may be specified via init options (deprecated)', async ({ expect }) => {
@@ -43,6 +51,14 @@ test('Custom languages may be specified via init options (deprecated)', async ({
4351
},
4452
range: { start: { line: 0, character: 12 }, end: { line: 0, character: 21 } },
4553
})
54+
55+
let completion = await c.sendRequest(CompletionRequest.type, {
56+
textDocument,
57+
position: { line: 0, character: 13 },
58+
context: { triggerKind: 1 },
59+
})
60+
61+
expect(completion.items.length).toBe(11509)
4662
})
4763

4864
test('Custom languages may be specified via settings', async ({ expect }) => {
@@ -74,6 +90,14 @@ test('Custom languages may be specified via settings', async ({ expect }) => {
7490
},
7591
range: { start: { line: 0, character: 12 }, end: { line: 0, character: 21 } },
7692
})
93+
94+
let completion = await c.sendRequest(CompletionRequest.type, {
95+
textDocument,
96+
position: { line: 0, character: 13 },
97+
context: { triggerKind: 1 },
98+
})
99+
100+
expect(completion.items.length).toBe(11509)
77101
})
78102

79103
test('Custom languages are merged from init options and settings', async ({ expect }) => {
@@ -101,6 +125,12 @@ test('Custom languages are merged from init options and settings', async ({ expe
101125
position: { line: 0, character: 13 },
102126
})
103127

128+
let completion = await c.sendRequest(CompletionRequest.type, {
129+
textDocument,
130+
position: { line: 0, character: 13 },
131+
context: { triggerKind: 1 },
132+
})
133+
104134
textDocument = await c.openDocument({
105135
lang: 'other-lang',
106136
text: '<div class="bg-[#000]">',
@@ -111,6 +141,12 @@ test('Custom languages are merged from init options and settings', async ({ expe
111141
position: { line: 0, character: 13 },
112142
})
113143

144+
let completion2 = await c.sendRequest(CompletionRequest.type, {
145+
textDocument,
146+
position: { line: 0, character: 13 },
147+
context: { triggerKind: 1 },
148+
})
149+
114150
expect(hover).toEqual({
115151
contents: {
116152
language: 'css',
@@ -128,6 +164,9 @@ test('Custom languages are merged from init options and settings', async ({ expe
128164
},
129165
range: { start: { line: 0, character: 12 }, end: { line: 0, character: 21 } },
130166
})
167+
168+
expect(completion.items.length).toBe(11509)
169+
expect(completion2.items.length).toBe(11509)
131170
})
132171

133172
test('Language mappings from settings take precedence', async ({ expect }) => {
@@ -163,4 +202,12 @@ test('Language mappings from settings take precedence', async ({ expect }) => {
163202
},
164203
range: { start: { line: 0, character: 12 }, end: { line: 0, character: 21 } },
165204
})
205+
206+
let completion = await c.sendRequest(CompletionRequest.type, {
207+
textDocument,
208+
position: { line: 0, character: 13 },
209+
context: { triggerKind: 1 },
210+
})
211+
212+
expect(completion.items.length).toBe(11509)
166213
})

0 commit comments

Comments
 (0)