@@ -307,8 +307,8 @@ describe('pre process css', () => {
307
307
308
308
test ( 'preProcessCSS: basic' , ( ) => {
309
309
const res = preProcessCSS ( { rootDir : resolve ( 'packages' ) } )
310
- const mockPathTest1 = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.css` )
311
- const mockPathTest2 = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test2.css` )
310
+ const mockPathTest1 = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.css` )
311
+ const mockPathTest2 = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test2.css` )
312
312
const resTest1 = res . get ( mockPathTest1 )
313
313
const resTest2 = res . get ( mockPathTest2 )
314
314
@@ -325,9 +325,9 @@ describe('pre process css', () => {
325
325
326
326
test ( 'preProcessCSS: map path scss -> css or scss' , ( ) => {
327
327
const res = preProcessCSS ( { rootDir : resolve ( 'packages' ) } )
328
- const mockPathFooSCSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/foo.scss` )
329
- const mockPathTestSCSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.scss` )
330
- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test2.css` )
328
+ const mockPathFooSCSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/foo.scss` )
329
+ const mockPathTestSCSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.scss` )
330
+ const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test2.css` )
331
331
// foo.scss -> test.css or test.scss ? -> test.scss
332
332
const importerFooSCSS = res . get ( mockPathFooSCSS )
333
333
expect ( [ ...importerFooSCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTestSCSS )
@@ -336,8 +336,8 @@ describe('pre process css', () => {
336
336
expect ( [ ...importerTestSCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
337
337
338
338
// foo2.scss -> test2.css
339
- const mockPathFoo2SCSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/foo2.scss` )
340
- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.css` )
339
+ const mockPathFoo2SCSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/foo2.scss` )
340
+ const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.css` )
341
341
const importerFoo2SCSS = res . get ( mockPathFoo2SCSS )
342
342
expect ( [ ...importerFoo2SCSS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
343
343
// test2.css -> test.css or test.scss ? -> test.css
@@ -347,9 +347,9 @@ describe('pre process css', () => {
347
347
348
348
test ( 'preProcessCSS: map path less -> css or less' , ( ) => {
349
349
const res = preProcessCSS ( { rootDir : resolve ( 'packages' ) } )
350
- const mockPathFooLESS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/foo.less` )
351
- const mockPathTestLESS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.less` )
352
- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test2.css` )
350
+ const mockPathFooLESS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/foo.less` )
351
+ const mockPathTestLESS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.less` )
352
+ const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test2.css` )
353
353
// foo.less -> test.css or test.less ? -> test.less
354
354
const importerFooLESS = res . get ( mockPathFooLESS )
355
355
expect ( [ ...importerFooLESS ! . importer ] [ 0 ] ) . toBe ( mockPathTestLESS )
@@ -358,8 +358,8 @@ describe('pre process css', () => {
358
358
expect ( [ ...importerTestLESS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
359
359
360
360
// foo2.less -> test2.css
361
- const mockPathFoo2LESS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/foo2.less` )
362
- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.css` )
361
+ const mockPathFoo2LESS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/foo2.less` )
362
+ const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.css` )
363
363
const importerFoo2LESS = res . get ( mockPathFoo2LESS )
364
364
expect ( [ ...importerFoo2LESS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
365
365
// test2.css -> test.css or test.less ? -> test.css
@@ -369,9 +369,9 @@ describe('pre process css', () => {
369
369
370
370
test ( 'preProcessCSS: map path styl -> css or styl' , ( ) => {
371
371
const res = preProcessCSS ( { rootDir : resolve ( 'packages' ) } )
372
- const mockPathFooSTYL = transformSymbol ( `${ resolve ( ) } /core/css /__test__/foo.styl` )
373
- const mockPathTestSTYL = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.styl` )
374
- const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test2.css` )
372
+ const mockPathFooSTYL = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/foo.styl` )
373
+ const mockPathTestSTYL = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.styl` )
374
+ const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test2.css` )
375
375
// foo.styl -> test.css or test.styl ? -> test.styl
376
376
const importerFooSTYL = res . get ( mockPathFooSTYL )
377
377
expect ( [ ...importerFooSTYL ! . importer ] [ 0 ] ) . toBe ( mockPathTestSTYL )
@@ -380,15 +380,37 @@ describe('pre process css', () => {
380
380
expect ( [ ...importerTestSTYL ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
381
381
382
382
// foo2.styl -> test2.css
383
- const mockPathFoo2STYL = transformSymbol ( `${ resolve ( ) } /core/css /__test__/foo2.styl` )
384
- const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/css /__test__/test.css` )
383
+ const mockPathFoo2STYL = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/foo2.styl` )
384
+ const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime /__test__/test.css` )
385
385
const importerFoo2STYL = res . get ( mockPathFoo2STYL )
386
386
expect ( [ ...importerFoo2STYL ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
387
387
// test2.css -> test.css or test.styl ? -> test.css
388
388
const importerTest2CSS = res . get ( mockPathTest2CSS )
389
389
expect ( [ ...importerTest2CSS ! . importer ] [ 0 ] ) . toBe ( mockPathTestCSS )
390
390
} )
391
391
392
+ test ( 'preProcessCSS: map path sass -> css or sass' , ( ) => {
393
+ const res = preProcessCSS ( { rootDir : resolve ( 'packages' ) } )
394
+ const mockPathFooSASS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/foo.sass` )
395
+ const mockPathTestSASS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/test.sass` )
396
+ const mockPathTest2CSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/test2.css` )
397
+ // foo.sass -> test.css or test.sass ? -> test.sass
398
+ const importerFooSASS = res . get ( mockPathFooSASS )
399
+ expect ( [ ...importerFooSASS ! . importer ] [ 0 ] ) . toBe ( mockPathTestSASS )
400
+ // foo.sass -> test.css or test.sass ? -> test.sass -> test2.css
401
+ const importerTestSASS = res . get ( mockPathTestSASS )
402
+ expect ( [ ...importerTestSASS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
403
+
404
+ // foo2.sass -> test2.css
405
+ const mockPathFoo2SASS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/foo2.sass` )
406
+ const mockPathTestCSS = transformSymbol ( `${ resolve ( ) } /core/runtime/__test__/test.css` )
407
+ const importerFoo2SASS = res . get ( mockPathFoo2SASS )
408
+ expect ( [ ...importerFoo2SASS ! . importer ] [ 0 ] ) . toBe ( mockPathTest2CSS )
409
+ // test2.css -> test.css or test.sass ? -> test.css
410
+ const importerTest2CSS = res . get ( mockPathTest2CSS )
411
+ expect ( [ ...importerTest2CSS ! . importer ] [ 0 ] ) . toBe ( mockPathTestCSS )
412
+ } )
413
+
392
414
test ( 'getCurFileContent: basic' , ( ) => {
393
415
const mockSassContent = '@import "./test";\n'
394
416
+ '@use \'./test-use\';\n'
@@ -570,7 +592,7 @@ describe('pre process css', () => {
570
592
+ '.test {\n'
571
593
+ ' color: v-bind(appTheme2);\n'
572
594
+ '}'
573
- const mockPath = `${ resolve ( 'packages' ) } /core/css /__test__/test2.css`
595
+ const mockPath = `${ resolve ( 'packages' ) } /core/runtime /__test__/test2.css`
574
596
const res = generateCSSCode ( mockPath , '.css' )
575
597
expect ( delTransformSymbol ( res ) ) . toBe ( delTransformSymbol ( mockCSSContent ) )
576
598
expect ( delTransformSymbol ( res ) ) . toMatchSnapshot ( )
@@ -581,7 +603,7 @@ describe('pre process css', () => {
581
603
+ '#app div {\n'
582
604
+ ' color: v-bind(fooColor);\n'
583
605
+ '}'
584
- const mockPath = `${ resolve ( 'packages' ) } /core/css /__test__/foo.scss`
606
+ const mockPath = `${ resolve ( 'packages' ) } /core/runtime /__test__/foo.scss`
585
607
const res = generateCSSCode ( mockPath , '.scss' )
586
608
587
609
expect ( delTransformSymbol ( res ) ) . toBe ( delTransformSymbol ( mockSassContent ) )
@@ -594,7 +616,7 @@ describe('pre process css', () => {
594
616
+ ' color: v-bind(fooColor);\n'
595
617
+ '}'
596
618
+ '\n'
597
- const mockPath = `${ resolve ( 'packages' ) } /core/css /__test__/foo.less`
619
+ const mockPath = `${ resolve ( 'packages' ) } /core/runtime /__test__/foo.less`
598
620
const res = generateCSSCode ( mockPath , '.less' )
599
621
expect ( delTransformSymbol ( res ) ) . toBe ( delTransformSymbol ( mockLessContent ) )
600
622
expect ( delTransformSymbol ( res ) ) . toMatchSnapshot ( )
@@ -606,7 +628,7 @@ describe('pre process css', () => {
606
628
+ ' color: v-bind(stylColor);\n'
607
629
+ '}'
608
630
+ '\n'
609
- const mockPath = `${ resolve ( 'packages' ) } /core/css /__test__/foo.styl`
631
+ const mockPath = `${ resolve ( 'packages' ) } /core/runtime /__test__/foo.styl`
610
632
const res = generateCSSCode ( mockPath , '.styl' )
611
633
expect ( delTransformSymbol ( res ) ) . toBe ( delTransformSymbol ( mockStylContent ) )
612
634
expect ( delTransformSymbol ( res ) ) . toMatchSnapshot ( )
0 commit comments