Skip to content

Commit a55831a

Browse files
committed
Add test
1 parent 9dc65c9 commit a55831a

File tree

6 files changed

+220
-0
lines changed

6 files changed

+220
-0
lines changed

packages/tailwindcss-language-server/src/project-locator.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ function testFixture(fixture: string, details: any[]) {
2929
let configPath = path.relative(fixturePath, project.config.path)
3030

3131
expect(configPath).toEqual(detail?.config)
32+
33+
if (detail?.content) {
34+
let expected = detail?.content.map((path) => path.replace('{URL}', fixturePath))
35+
36+
let actual = project.documentSelector
37+
.filter((selector) => selector.priority === 1 /** content */)
38+
.map((selector) => selector.pattern)
39+
40+
expect(actual).toEqual(expected)
41+
}
3242
}
3343

3444
expect(projects).toHaveLength(details.length)
@@ -84,3 +94,16 @@ testFixture('v4/workspaces', [
8494
// { config: 'packages/style-export/lib.css' }, // Should this be included?
8595
{ config: 'packages/web/app.css' },
8696
])
97+
98+
testFixture('v4/auto-content', [
99+
//
100+
{
101+
config: 'src/app.css',
102+
content: [
103+
'{URL}/package.json',
104+
'{URL}/src/index.html',
105+
'{URL}/src/components/example.html',
106+
'{URL}/src/**/*.{py,tpl,js,vue,php,mjs,cts,jsx,tsx,rhtml,slim,handlebars,twig,rs,njk,svelte,liquid,pug,md,ts,heex,mts,astro,nunjucks,rb,eex,haml,cjs,html,hbs,jade,aspx,razor,erb,mustache,mdx}',
107+
],
108+
},
109+
])

packages/tailwindcss-language-server/tests/fixtures/v4/auto-content/package-lock.json

Lines changed: 188 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"dependencies": {
3+
"tailwindcss": "4.0.0-alpha.9",
4+
"@tailwindcss/oxide": "4.0.0-alpha.9"
5+
}
6+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@import 'tailwindcss';
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div class="underline">Test</div>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<div class="flex">Test</div>

0 commit comments

Comments
 (0)