@@ -222,14 +222,14 @@ describe('tailwindcss intellisense settings', () => {
222
222
await handler ( { } )
223
223
224
224
const settingsJson = JSON . parse ( readVsCodeSettings ( ) )
225
- const tailwindCSS = settingsJson [ 'tailwindCSS' ]
226
-
227
- expect ( Array . isArray ( tailwindCSS . classAttributes ) ) . toBe ( true )
228
- expect ( tailwindCSS . classAttributes ) . toContain ( 'class' )
229
- expect ( tailwindCSS . classAttributes ) . toContain ( 'className' )
230
- expect ( tailwindCSS . classAttributes ) . toContain ( 'activeClassName' )
231
- expect ( tailwindCSS . classAttributes ) . toContain ( 'errorClassName' )
232
- expect ( tailwindCSS . classAttributes . length ) . toBe ( 4 )
225
+ const twClassAttributes = settingsJson [ 'tailwindCSS.classAttributes ' ]
226
+
227
+ expect ( Array . isArray ( twClassAttributes ) ) . toBe ( true )
228
+ expect ( twClassAttributes ) . toContain ( 'class' )
229
+ expect ( twClassAttributes ) . toContain ( 'className' )
230
+ expect ( twClassAttributes ) . toContain ( 'activeClassName' )
231
+ expect ( twClassAttributes ) . toContain ( 'errorClassName' )
232
+ expect ( twClassAttributes . length ) . toBe ( 4 )
233
233
} )
234
234
235
235
it ( 'adds to existing empty settings file' , async ( ) => {
@@ -240,16 +240,15 @@ describe('tailwindcss intellisense settings', () => {
240
240
await handler ( { } )
241
241
242
242
const settingsJson = JSON . parse ( readVsCodeSettings ( ) )
243
- const tailwindCSS = settingsJson [ 'tailwindCSS' ]
243
+ const twClassAttributes = settingsJson [ 'tailwindCSS.classAttributes ' ]
244
244
245
245
expect ( Object . keys ( settingsJson ) . length ) . toBe ( 1 )
246
- expect ( Object . keys ( tailwindCSS ) . length ) . toBe ( 1 )
247
- expect ( Array . isArray ( tailwindCSS . classAttributes ) ) . toBe ( true )
248
- expect ( tailwindCSS . classAttributes ) . toContain ( 'class' )
249
- expect ( tailwindCSS . classAttributes ) . toContain ( 'className' )
250
- expect ( tailwindCSS . classAttributes ) . toContain ( 'activeClassName' )
251
- expect ( tailwindCSS . classAttributes ) . toContain ( 'errorClassName' )
252
- expect ( tailwindCSS . classAttributes . length ) . toBe ( 4 )
246
+ expect ( Array . isArray ( twClassAttributes ) ) . toBe ( true )
247
+ expect ( twClassAttributes ) . toContain ( 'class' )
248
+ expect ( twClassAttributes ) . toContain ( 'className' )
249
+ expect ( twClassAttributes ) . toContain ( 'activeClassName' )
250
+ expect ( twClassAttributes ) . toContain ( 'errorClassName' )
251
+ expect ( twClassAttributes . length ) . toBe ( 4 )
253
252
} )
254
253
255
254
it ( 'adds to existing settings file without any tailwindCSS settings' , async ( ) => {
@@ -267,16 +266,15 @@ describe('tailwindcss intellisense settings', () => {
267
266
await handler ( { } )
268
267
269
268
const settingsJson = JSON . parse ( readVsCodeSettings ( ) )
270
- const tailwindCSS = settingsJson [ 'tailwindCSS' ]
269
+ const twClassAttributes = settingsJson [ 'tailwindCSS.classAttributes ' ]
271
270
272
271
expect ( Object . keys ( settingsJson ) . length ) . toBe ( 3 )
273
- expect ( Object . keys ( tailwindCSS ) . length ) . toBe ( 1 )
274
- expect ( Array . isArray ( tailwindCSS . classAttributes ) ) . toBe ( true )
275
- expect ( tailwindCSS . classAttributes ) . toContain ( 'class' )
276
- expect ( tailwindCSS . classAttributes ) . toContain ( 'className' )
277
- expect ( tailwindCSS . classAttributes ) . toContain ( 'activeClassName' )
278
- expect ( tailwindCSS . classAttributes ) . toContain ( 'errorClassName' )
279
- expect ( tailwindCSS . classAttributes . length ) . toBe ( 4 )
272
+ expect ( Array . isArray ( twClassAttributes ) ) . toBe ( true )
273
+ expect ( twClassAttributes ) . toContain ( 'class' )
274
+ expect ( twClassAttributes ) . toContain ( 'className' )
275
+ expect ( twClassAttributes ) . toContain ( 'activeClassName' )
276
+ expect ( twClassAttributes ) . toContain ( 'errorClassName' )
277
+ expect ( twClassAttributes . length ) . toBe ( 4 )
280
278
} )
281
279
282
280
it ( 'adds to existing settings file with existing tailwindCSS settings' , async ( ) => {
@@ -287,27 +285,24 @@ describe('tailwindcss intellisense settings', () => {
287
285
' "editor.codeActionsOnSave": {' ,
288
286
' "source.fixAll.eslint": "explicit"' ,
289
287
' },' ,
290
- ' "tailwindCSS": {' ,
291
- ' "emmetCompletions": true' ,
292
- ' }' ,
288
+ ' "tailwindCSS.emmetCompletions": true' ,
293
289
'}' ,
294
290
] . join ( '\n' ) ,
295
291
} )
296
292
297
293
await handler ( { } )
298
294
299
295
const settingsJson = JSON . parse ( readVsCodeSettings ( ) )
300
- const tailwindCSS = settingsJson [ 'tailwindCSS' ]
301
-
302
- expect ( Object . keys ( settingsJson ) . length ) . toBe ( 3 )
303
- expect ( Object . keys ( tailwindCSS ) . length ) . toBe ( 2 )
304
- expect ( tailwindCSS . emmetCompletions ) . toBeTruthy ( )
305
- expect ( Array . isArray ( tailwindCSS . classAttributes ) ) . toBe ( true )
306
- expect ( tailwindCSS . classAttributes ) . toContain ( 'class' )
307
- expect ( tailwindCSS . classAttributes ) . toContain ( 'className' )
308
- expect ( tailwindCSS . classAttributes ) . toContain ( 'activeClassName' )
309
- expect ( tailwindCSS . classAttributes ) . toContain ( 'errorClassName' )
310
- expect ( tailwindCSS . classAttributes . length ) . toBe ( 4 )
296
+ const twClassAttributes = settingsJson [ 'tailwindCSS.classAttributes' ]
297
+
298
+ expect ( Object . keys ( settingsJson ) . length ) . toBe ( 4 )
299
+ expect ( settingsJson [ 'tailwindCSS.emmetCompletions' ] ) . toBeTruthy ( )
300
+ expect ( Array . isArray ( twClassAttributes ) ) . toBe ( true )
301
+ expect ( twClassAttributes ) . toContain ( 'class' )
302
+ expect ( twClassAttributes ) . toContain ( 'className' )
303
+ expect ( twClassAttributes ) . toContain ( 'activeClassName' )
304
+ expect ( twClassAttributes ) . toContain ( 'errorClassName' )
305
+ expect ( twClassAttributes . length ) . toBe ( 4 )
311
306
} )
312
307
313
308
// This is what I decided to do now. If good arguments are made to change
@@ -320,29 +315,30 @@ describe('tailwindcss intellisense settings', () => {
320
315
' "editor.codeActionsOnSave": {' ,
321
316
' "source.fixAll.eslint": "explicit"' ,
322
317
' },' ,
323
- ' "tailwindCSS": {' ,
324
- ' "emmetCompletions": true,' ,
325
- ' "classAttributes": ["class", "className", "ngClass"]' ,
326
- ' }' ,
318
+ ' "tailwindCSS.emmetCompletions": true,' ,
319
+ ' "tailwindCSS.classAttributes": [' ,
320
+ ' "class",' ,
321
+ ' "className",' ,
322
+ ' "ngClass"' ,
323
+ ' ]' ,
327
324
'}' ,
328
325
] . join ( '\n' ) ,
329
326
} )
330
327
331
328
await handler ( { } )
332
329
333
330
const settingsJson = JSON . parse ( readVsCodeSettings ( ) )
334
- const tailwindCSS = settingsJson [ 'tailwindCSS' ]
335
-
336
- expect ( Object . keys ( settingsJson ) . length ) . toBe ( 3 )
337
- expect ( Object . keys ( tailwindCSS ) . length ) . toBe ( 2 )
338
- expect ( tailwindCSS . emmetCompletions ) . toBeTruthy ( )
339
- expect ( Array . isArray ( tailwindCSS . classAttributes ) ) . toBe ( true )
340
- expect ( tailwindCSS . classAttributes ) . toContain ( 'class' )
341
- expect ( tailwindCSS . classAttributes ) . toContain ( 'className' )
342
- expect ( tailwindCSS . classAttributes ) . toContain ( 'ngClass' )
343
- expect ( tailwindCSS . classAttributes ) . toContain ( 'activeClassName' )
344
- expect ( tailwindCSS . classAttributes ) . toContain ( 'errorClassName' )
345
- expect ( tailwindCSS . classAttributes . length ) . toBe ( 5 )
331
+ const twClassAttributes = settingsJson [ 'tailwindCSS.classAttributes' ]
332
+
333
+ expect ( Object . keys ( settingsJson ) . length ) . toBe ( 4 )
334
+ expect ( settingsJson [ 'tailwindCSS.emmetCompletions' ] ) . toBeTruthy ( )
335
+ expect ( Array . isArray ( twClassAttributes ) ) . toBe ( true )
336
+ expect ( twClassAttributes ) . toContain ( 'class' )
337
+ expect ( twClassAttributes ) . toContain ( 'className' )
338
+ expect ( twClassAttributes ) . toContain ( 'ngClass' )
339
+ expect ( twClassAttributes ) . toContain ( 'activeClassName' )
340
+ expect ( twClassAttributes ) . toContain ( 'errorClassName' )
341
+ expect ( twClassAttributes . length ) . toBe ( 5 )
346
342
} )
347
343
} )
348
344
0 commit comments