@@ -10,6 +10,7 @@ import {
1010 removeFile ,
1111 serverLogs ,
1212 untilUpdated ,
13+ viteTestUrl ,
1314 withRetry
1415} from '~utils'
1516
@@ -78,6 +79,7 @@ test('sass', async () => {
7879 const imported = await page . $ ( '.sass' )
7980 const atImport = await page . $ ( '.sass-at-import' )
8081 const atImportAlias = await page . $ ( '.sass-at-import-alias' )
82+ const urlStartsWithVariable = await page . $ ( '.sass-url-starts-with-variable' )
8183 const partialImport = await page . $ ( '.sass-partial' )
8284
8385 expect ( await getColor ( imported ) ) . toBe ( 'orange' )
@@ -87,6 +89,9 @@ test('sass', async () => {
8789 expect ( await getBg ( atImportAlias ) ) . toMatch (
8890 isBuild ? / b a s e 6 4 / : '/nested/icon.png'
8991 )
92+ expect ( await getBg ( urlStartsWithVariable ) ) . toMatch (
93+ isBuild ? / o k \. \w + \. p n g / : `${ viteTestUrl } /ok.png`
94+ )
9095 expect ( await getColor ( partialImport ) ) . toBe ( 'orchid' )
9196
9297 editFile ( 'sass.scss' , ( code ) =>
@@ -109,6 +114,7 @@ test('less', async () => {
109114 const imported = await page . $ ( '.less' )
110115 const atImport = await page . $ ( '.less-at-import' )
111116 const atImportAlias = await page . $ ( '.less-at-import-alias' )
117+ const urlStartsWithVariable = await page . $ ( '.less-url-starts-with-variable' )
112118
113119 expect ( await getColor ( imported ) ) . toBe ( 'blue' )
114120 expect ( await getColor ( atImport ) ) . toBe ( 'darkslateblue' )
@@ -117,6 +123,9 @@ test('less', async () => {
117123 expect ( await getBg ( atImportAlias ) ) . toMatch (
118124 isBuild ? / b a s e 6 4 / : '/nested/icon.png'
119125 )
126+ expect ( await getBg ( urlStartsWithVariable ) ) . toMatch (
127+ isBuild ? / o k \. \w + \. p n g / : `${ viteTestUrl } /ok.png`
128+ )
120129
121130 editFile ( 'less.less' , ( code ) => code . replace ( '@color: blue' , '@color: red' ) )
122131 await untilUpdated ( ( ) => getColor ( imported ) , 'red' )
0 commit comments