@@ -215,6 +215,10 @@ describe('supports completions', async () => {
215215 'a.module.css' : dedent `
216216 .a_1 { color: red; }
217217 ` ,
218+ // The tokens exported from following definition file should be ignored.
219+ 'generated/a.module.css.d.ts' : dedent `
220+ export const a_1: string;
221+ ` ,
218222 } ) ;
219223 describe ( 'default behavior' , async ( ) => {
220224 const iff = await baseIff . fork ( {
@@ -326,9 +330,17 @@ describe('supports code fixes', async () => {
326330 'a.module.css' : dedent `
327331 .a_1 { color: red; }
328332 ` ,
333+ // The tokens exported from following definition file should be ignored.
334+ 'generated/a.module.css.d.ts' : dedent `
335+ export const a_1: string;
336+ ` ,
329337 } ) ;
330338 describe ( 'default behavior' , async ( ) => {
331339 const iff = await baseIff . fork ( {
340+ 'import-statement-already-exists.ts' : dedent `
341+ import { a_1 } from './a.module.css';
342+ styles;
343+ ` ,
332344 'tsconfig.json' : dedent `
333345 {
334346 "cmkOptions": {
@@ -343,7 +355,7 @@ describe('supports code fixes', async () => {
343355 } ) ;
344356 test . each ( [
345357 {
346- name : 'styles' ,
358+ name : 'styles in index.ts ' ,
347359 file : iff . paths [ 'index.ts' ] ,
348360 startLine : 1 ,
349361 startOffset : 1 ,
@@ -368,14 +380,40 @@ describe('supports code fixes', async () => {
368380 ] ,
369381 } ,
370382 {
371- name : 'a_1' ,
383+ name : 'a_1 in index.ts ' ,
372384 file : iff . paths [ 'index.ts' ] ,
373385 startLine : 2 ,
374386 startOffset : 1 ,
375387 endLine : 2 ,
376388 endOffset : 4 ,
377389 expected : [ ] ,
378390 } ,
391+ // MEMO: css-modules-kit does not support the following case to simplify the implementation.
392+ // {
393+ // name: 'styles in import-statement-already-exists.ts',
394+ // file: iff.paths['import-statement-already-exists.ts'],
395+ // startLine: 2,
396+ // startOffset: 1,
397+ // endLine: 2,
398+ // endOffset: 7,
399+ // expected: [
400+ // {
401+ // fixName: 'import',
402+ // changes: [
403+ // {
404+ // fileName: formatPath(iff.paths['import-statement-already-exists.ts']),
405+ // textChanges: [
406+ // {
407+ // start: { line: 1, offset: 1 },
408+ // end: { line: 1, offset: 1 },
409+ // newText: `import * as styles from "./a.module.css";${ts.sys.newLine}${ts.sys.newLine}`,
410+ // },
411+ // ],
412+ // },
413+ // ],
414+ // },
415+ // ],
416+ // },
379417 ] ) ( '$name' , async ( { file, startLine, startOffset, endLine, endOffset, expected } ) => {
380418 const res = await tsserver . sendGetCodeFixes ( {
381419 errorCodes : [ 2304 ] ,
0 commit comments