File tree Expand file tree Collapse file tree 1 file changed +25
-1
lines changed
packages/compiler-sfc/__tests__ Expand file tree Collapse file tree 1 file changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -360,7 +360,7 @@ h1 { color: red }
360
360
} )
361
361
362
362
// This only tests if the "source to sfc" cache has "defaultScriptLang" as part of the cache key.
363
- test ( 'source cache key' , ( ) => {
363
+ test ( 'different source cache key' , ( ) => {
364
364
// The same SFC as previous test
365
365
const { descriptor, errors } = parse (
366
366
`
@@ -375,5 +375,29 @@ h1 { color: red }
375
375
expect ( descriptor . script ?. lang ) . toBe ( 'tsx' )
376
376
expect ( descriptor . scriptSetup ?. lang ) . toBe ( 'tsx' )
377
377
} )
378
+
379
+ test ( 'source cache key conflict' , ( ) => {
380
+ expect (
381
+ parse (
382
+ `
383
+ <script>console.log(0x010)</script>
384
+ <script setup>console.log(0x011)</script>
385
+ ` ,
386
+ {
387
+ defaultScriptLang : ''
388
+ }
389
+ ) . errors . length
390
+ ) . toBe ( 0 )
391
+
392
+ const { descriptor, errors } = parse (
393
+ `
394
+ <script>console.log(0x010)</script>
395
+ <script setup>console.log(0x011)</script>
396
+ `
397
+ )
398
+ expect ( errors . length ) . toBe ( 0 )
399
+ expect ( descriptor . script ?. lang ) . toBeUndefined ( )
400
+ expect ( descriptor . scriptSetup ?. lang ) . toBeUndefined ( )
401
+ } )
378
402
} )
379
403
} )
You can’t perform that action at this time.
0 commit comments