1
- import {
2
- getDefaultTailwindSettings ,
3
- type DocumentClassList ,
4
- type EditorState ,
5
- type State ,
6
- } from './state'
1
+ import { getDefaultTailwindSettings , type DocumentClassList } from './state'
7
2
import { test } from 'vitest'
8
3
import { TextDocument } from 'vscode-languageserver-textdocument'
9
4
import { findClassListsInHtmlRange } from './find'
@@ -18,15 +13,13 @@ test('test astro', async ({ expect }) => {
18
13
19
14
let doc = TextDocument . create ( 'file://file.astro' , 'astro' , 1 , content )
20
15
let defaultSettings = getDefaultTailwindSettings ( )
21
- let state : State = {
22
- blocklist : [ ] ,
23
- enabled : true ,
16
+ let state : Parameters < typeof findClassListsInHtmlRange > [ 0 ] = {
24
17
editor : {
25
- userLanguages : { } ,
26
18
getConfiguration : async ( ) => ( {
27
19
...defaultSettings ,
28
20
tailwindCSS : {
29
21
...defaultSettings . tailwindCSS ,
22
+ classAttributes : [ 'class' ] ,
30
23
experimental : {
31
24
...defaultSettings . tailwindCSS . experimental ,
32
25
classRegex : [
@@ -36,7 +29,7 @@ test('test astro', async ({ expect }) => {
36
29
} ,
37
30
} ,
38
31
} ) ,
39
- } as EditorState ,
32
+ } ,
40
33
}
41
34
42
35
let classLists = await findClassListsInHtmlRange ( state , doc , 'html' )
@@ -180,7 +173,7 @@ test('test simple classFunctions', async ({ expect }) => {
180
173
const cmaDoc = TextDocument . create ( 'file://file.html' , 'html' , 1 , cmaContent )
181
174
const cmaClassLists = await findClassListsInHtmlRange ( state , cmaDoc , 'html' )
182
175
183
- expect ( cmaClassLists ) . not . toMatchObject ( expectedResult )
176
+ expect ( cmaClassLists ) . toMatchObject ( [ ] )
184
177
} )
185
178
186
179
test ( 'test nested classFunctions' , async ( { expect } ) => {
@@ -283,13 +276,10 @@ test('test nested classFunctions', async ({ expect }) => {
283
276
expect ( classLists ) . toMatchObject ( expectedResult )
284
277
} )
285
278
286
- function getTailwindSettingsForClassFunctions ( ) : State {
279
+ function getTailwindSettingsForClassFunctions ( ) : Parameters < typeof findClassListsInHtmlRange > [ 0 ] {
287
280
const defaultSettings = getDefaultTailwindSettings ( )
288
281
return {
289
- blocklist : [ ] ,
290
- enabled : true ,
291
282
editor : {
292
- userLanguages : { } ,
293
283
getConfiguration : async ( ) => ( {
294
284
...defaultSettings ,
295
285
tailwindCSS : {
@@ -300,6 +290,6 @@ function getTailwindSettingsForClassFunctions(): State {
300
290
} ,
301
291
} ,
302
292
} ) ,
303
- } as EditorState ,
293
+ } ,
304
294
}
305
295
}
0 commit comments