1- import {
2- getDefaultTailwindSettings ,
3- type DocumentClassList ,
4- type EditorState ,
5- type State ,
6- } from './state'
1+ import { getDefaultTailwindSettings , type DocumentClassList } from './state'
72import { test } from 'vitest'
83import { TextDocument } from 'vscode-languageserver-textdocument'
94import { findClassListsInHtmlRange } from './find'
@@ -18,15 +13,13 @@ test('test astro', async ({ expect }) => {
1813
1914 let doc = TextDocument . create ( 'file://file.astro' , 'astro' , 1 , content )
2015 let defaultSettings = getDefaultTailwindSettings ( )
21- let state : State = {
22- blocklist : [ ] ,
23- enabled : true ,
16+ let state : Parameters < typeof findClassListsInHtmlRange > [ 0 ] = {
2417 editor : {
25- userLanguages : { } ,
2618 getConfiguration : async ( ) => ( {
2719 ...defaultSettings ,
2820 tailwindCSS : {
2921 ...defaultSettings . tailwindCSS ,
22+ classAttributes : [ 'class' ] ,
3023 experimental : {
3124 ...defaultSettings . tailwindCSS . experimental ,
3225 classRegex : [
@@ -36,7 +29,7 @@ test('test astro', async ({ expect }) => {
3629 } ,
3730 } ,
3831 } ) ,
39- } as EditorState ,
32+ } ,
4033 }
4134
4235 let classLists = await findClassListsInHtmlRange ( state , doc , 'html' )
@@ -180,7 +173,7 @@ test('test simple classFunctions', async ({ expect }) => {
180173 const cmaDoc = TextDocument . create ( 'file://file.html' , 'html' , 1 , cmaContent )
181174 const cmaClassLists = await findClassListsInHtmlRange ( state , cmaDoc , 'html' )
182175
183- expect ( cmaClassLists ) . not . toMatchObject ( expectedResult )
176+ expect ( cmaClassLists ) . toMatchObject ( [ ] )
184177} )
185178
186179test ( 'test nested classFunctions' , async ( { expect } ) => {
@@ -283,13 +276,10 @@ test('test nested classFunctions', async ({ expect }) => {
283276 expect ( classLists ) . toMatchObject ( expectedResult )
284277} )
285278
286- function getTailwindSettingsForClassFunctions ( ) : State {
279+ function getTailwindSettingsForClassFunctions ( ) : Parameters < typeof findClassListsInHtmlRange > [ 0 ] {
287280 const defaultSettings = getDefaultTailwindSettings ( )
288281 return {
289- blocklist : [ ] ,
290- enabled : true ,
291282 editor : {
292- userLanguages : { } ,
293283 getConfiguration : async ( ) => ( {
294284 ...defaultSettings ,
295285 tailwindCSS : {
@@ -300,6 +290,6 @@ function getTailwindSettingsForClassFunctions(): State {
300290 } ,
301291 } ,
302292 } ) ,
303- } as EditorState ,
293+ } ,
304294 }
305295}
0 commit comments