Skip to content

Commit 5017e99

Browse files
committed
Add v4 document link tests for @config
1 parent 636f192 commit 5017e99

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

packages/tailwindcss-language-server/tests/document-links/document-links.test.js

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,42 @@ withFixture('basic', (c) => {
4040
],
4141
})
4242
})
43+
44+
withFixture('v4/basic', (c) => {
45+
async function testDocumentLinks(name, { text, lang, expected }) {
46+
test.concurrent(name, async ({ expect }) => {
47+
let textDocument = await c.openDocument({ text, lang })
48+
let res = await c.sendRequest('textDocument/documentLink', {
49+
textDocument,
50+
})
51+
52+
expect(res).toEqual(expected)
53+
})
54+
}
55+
56+
testDocumentLinks('config: file exists', {
57+
text: '@config "tailwind.config.js";',
58+
lang: 'css',
59+
expected: [
60+
{
61+
target: `file://${path
62+
.resolve('./tests/fixtures/v4/basic/tailwind.config.js')
63+
.replace(/@/g, '%40')}`,
64+
range: { start: { line: 0, character: 8 }, end: { line: 0, character: 28 } },
65+
},
66+
],
67+
})
68+
69+
testDocumentLinks('config: file does not exist', {
70+
text: '@config "does-not-exist.js";',
71+
lang: 'css',
72+
expected: [
73+
{
74+
target: `file://${path
75+
.resolve('./tests/fixtures/v4/basic/does-not-exist.js')
76+
.replace(/@/g, '%40')}`,
77+
range: { start: { line: 0, character: 8 }, end: { line: 0, character: 27 } },
78+
},
79+
],
80+
})
81+
})

0 commit comments

Comments
 (0)