Skip to content

Commit 858c9b0

Browse files
committed
Add test
1 parent 686a148 commit 858c9b0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

packages/tailwindcss-language-server/tests/completions/completions.test.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,39 @@ defineTest({
814814
},
815815
})
816816

817+
defineTest({
818+
name: 'v4: class completions show colors when using prefixes',
819+
fs: {
820+
'app.css': css`
821+
@import 'tailwindcss' prefix(tw);
822+
`,
823+
},
824+
prepare: async ({ root }) => ({ client: await createClient({ root }) }),
825+
handle: async ({ client }) => {
826+
let document = await client.open({
827+
lang: 'html',
828+
text: '<div class="tw:">',
829+
})
830+
831+
// <div class="tw:">
832+
// ^
833+
let completion = await document.completions({ line: 0, character: 15 })
834+
835+
expect(completion).toEqual({
836+
isIncomplete: false,
837+
items: expect.arrayContaining([
838+
expect.objectContaining({
839+
label: 'bg-black',
840+
841+
// And it's shown as a color
842+
kind: CompletionItemKind.Color,
843+
documentation: '#000000',
844+
}),
845+
]),
846+
})
847+
},
848+
})
849+
817850
defineTest({
818851
name: 'v4: Completions show inside class functions in JS/TS files',
819852
fs: {

0 commit comments

Comments
 (0)