@@ -11,6 +11,7 @@ describe('Rename Symbol', async () => {
1111 styles.a_1;
1212 styles.a_1;
1313 styles.a_2;
14+ styles['a-3'];
1415 styles.b_1;
1516 styles.c_1;
1617 styles.c_alias;
@@ -22,6 +23,7 @@ describe('Rename Symbol', async () => {
2223 .a_1 { color: red; }
2324 .a_1 { color: red; }
2425 @value a_2: red;
26+ .a-3 { color: red; }
2527 ` ,
2628 'b.module.css' : dedent `
2729 .b_1 { color: red; }
@@ -124,14 +126,46 @@ describe('Rename Symbol', async () => {
124126 ] ,
125127 } ,
126128 {
127- name : 'b_1 in index.ts' ,
129+ name : 'a-2 in index.ts' ,
128130 file : iff . paths [ 'index.ts' ] ,
129131 line : 5 ,
132+ offset : 9 ,
133+ expected : [
134+ {
135+ file : formatPath ( iff . paths [ 'index.ts' ] ) ,
136+ locs : [ { start : { line : 5 , offset : 9 } , end : { line : 5 , offset : 12 } } ] ,
137+ } ,
138+ {
139+ file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
140+ locs : [ { start : { line : 6 , offset : 2 } , end : { line : 6 , offset : 5 } } ] ,
141+ } ,
142+ ] ,
143+ } ,
144+ {
145+ name : 'a-2 in a.module.css' ,
146+ file : iff . paths [ 'a.module.css' ] ,
147+ line : 6 ,
148+ offset : 2 ,
149+ expected : [
150+ {
151+ file : formatPath ( iff . paths [ 'index.ts' ] ) ,
152+ locs : [ { start : { line : 5 , offset : 9 } , end : { line : 5 , offset : 12 } } ] ,
153+ } ,
154+ {
155+ file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
156+ locs : [ { start : { line : 6 , offset : 2 } , end : { line : 6 , offset : 5 } } ] ,
157+ } ,
158+ ] ,
159+ } ,
160+ {
161+ name : 'b_1 in index.ts' ,
162+ file : iff . paths [ 'index.ts' ] ,
163+ line : 6 ,
130164 offset : 8 ,
131165 expected : [
132166 {
133167 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
134- locs : [ { start : { line : 5 , offset : 8 } , end : { line : 5 , offset : 11 } } ] ,
168+ locs : [ { start : { line : 6 , offset : 8 } , end : { line : 6 , offset : 11 } } ] ,
135169 } ,
136170 {
137171 file : formatPath ( iff . paths [ 'b.module.css' ] ) ,
@@ -147,7 +181,7 @@ describe('Rename Symbol', async () => {
147181 expected : [
148182 {
149183 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
150- locs : [ { start : { line : 5 , offset : 8 } , end : { line : 5 , offset : 11 } } ] ,
184+ locs : [ { start : { line : 6 , offset : 8 } , end : { line : 6 , offset : 11 } } ] ,
151185 } ,
152186 {
153187 file : formatPath ( iff . paths [ 'b.module.css' ] ) ,
@@ -158,13 +192,13 @@ describe('Rename Symbol', async () => {
158192 {
159193 name : 'c_1 in index.ts' ,
160194 file : iff . paths [ 'index.ts' ] ,
161- line : 6 ,
195+ line : 7 ,
162196 offset : 8 ,
163197 // NOTE: For simplicity of implementation, this is not the ideal behavior. The ideal behavior is as follows:
164198 // expected: [
165199 // {
166200 // file: formatPath(iff.paths['index.ts']),
167- // locs: [{ start: { line: 6 , offset: 8 }, end: { line: 6 , offset: 11 } }],
201+ // locs: [{ start: { line: 7 , offset: 8 }, end: { line: 7 , offset: 11 } }],
168202 // },
169203 // {
170204 // file: formatPath(iff.paths['a.module.css']),
@@ -174,7 +208,7 @@ describe('Rename Symbol', async () => {
174208 expected : [
175209 {
176210 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
177- locs : [ { start : { line : 6 , offset : 8 } , end : { line : 6 , offset : 11 } } ] ,
211+ locs : [ { start : { line : 7 , offset : 8 } , end : { line : 7 , offset : 11 } } ] ,
178212 } ,
179213 {
180214 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
@@ -195,7 +229,7 @@ describe('Rename Symbol', async () => {
195229 // expected: [
196230 // {
197231 // file: formatPath(iff.paths['index.ts']),
198- // locs: [{ start: { line: 6 , offset: 8 }, end: { line: 6 , offset: 11 } }],
232+ // locs: [{ start: { line: 7 , offset: 8 }, end: { line: 7 , offset: 11 } }],
199233 // },
200234 // {
201235 // file: formatPath(iff.paths['a.module.css']),
@@ -205,7 +239,7 @@ describe('Rename Symbol', async () => {
205239 expected : [
206240 {
207241 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
208- locs : [ { start : { line : 6 , offset : 8 } , end : { line : 6 , offset : 11 } } ] ,
242+ locs : [ { start : { line : 7 , offset : 8 } , end : { line : 7 , offset : 11 } } ] ,
209243 } ,
210244 {
211245 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
@@ -236,7 +270,7 @@ describe('Rename Symbol', async () => {
236270 expected : [
237271 {
238272 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
239- locs : [ { start : { line : 6 , offset : 8 } , end : { line : 6 , offset : 11 } } ] ,
273+ locs : [ { start : { line : 7 , offset : 8 } , end : { line : 7 , offset : 11 } } ] ,
240274 } ,
241275 {
242276 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
@@ -251,13 +285,13 @@ describe('Rename Symbol', async () => {
251285 {
252286 name : 'c_alias in index.ts' ,
253287 file : iff . paths [ 'index.ts' ] ,
254- line : 7 ,
288+ line : 8 ,
255289 offset : 8 ,
256290 // NOTE: For simplicity of implementation, this is not the ideal behavior. The ideal behavior is as follows:
257291 // expected: [
258292 // {
259293 // file: formatPath(iff.paths['index.ts']),
260- // locs: [{ start: { line: 7 , offset: 8 }, end: { line: 7 , offset: 15 } }],
294+ // locs: [{ start: { line: 8 , offset: 8 }, end: { line: 8 , offset: 15 } }],
261295 // },
262296 // {
263297 // file: formatPath(iff.paths['a.module.css']),
@@ -267,7 +301,7 @@ describe('Rename Symbol', async () => {
267301 expected : [
268302 {
269303 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
270- locs : [ { start : { line : 7 , offset : 8 } , end : { line : 7 , offset : 15 } } ] ,
304+ locs : [ { start : { line : 8 , offset : 8 } , end : { line : 8 , offset : 15 } } ] ,
271305 } ,
272306 {
273307 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
@@ -301,7 +335,7 @@ describe('Rename Symbol', async () => {
301335 expected : [
302336 {
303337 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
304- locs : [ { start : { line : 7 , offset : 8 } , end : { line : 7 , offset : 15 } } ] ,
338+ locs : [ { start : { line : 8 , offset : 8 } , end : { line : 8 , offset : 15 } } ] ,
305339 } ,
306340 {
307341 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
@@ -335,7 +369,7 @@ describe('Rename Symbol', async () => {
335369 expected : [
336370 {
337371 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
338- locs : [ { start : { line : 7 , offset : 8 } , end : { line : 7 , offset : 15 } } ] ,
372+ locs : [ { start : { line : 8 , offset : 8 } , end : { line : 8 , offset : 15 } } ] ,
339373 } ,
340374 {
341375 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
@@ -369,7 +403,7 @@ describe('Rename Symbol', async () => {
369403 expected : [
370404 {
371405 file : formatPath ( iff . paths [ 'index.ts' ] ) ,
372- locs : [ { start : { line : 8 , offset : 8 } , end : { line : 8 , offset : 11 } } ] ,
406+ locs : [ { start : { line : 9 , offset : 8 } , end : { line : 9 , offset : 11 } } ] ,
373407 } ,
374408 {
375409 file : formatPath ( iff . paths [ 'a.module.css' ] ) ,
0 commit comments