@@ -10,6 +10,7 @@ import {
10
10
removeFile ,
11
11
serverLogs ,
12
12
untilUpdated ,
13
+ viteTestUrl ,
13
14
withRetry
14
15
} from '~utils'
15
16
@@ -78,6 +79,7 @@ test('sass', async () => {
78
79
const imported = await page . $ ( '.sass' )
79
80
const atImport = await page . $ ( '.sass-at-import' )
80
81
const atImportAlias = await page . $ ( '.sass-at-import-alias' )
82
+ const urlStartsWithVariable = await page . $ ( '.sass-url-starts-with-variable' )
81
83
const partialImport = await page . $ ( '.sass-partial' )
82
84
83
85
expect ( await getColor ( imported ) ) . toBe ( 'orange' )
@@ -87,6 +89,9 @@ test('sass', async () => {
87
89
expect ( await getBg ( atImportAlias ) ) . toMatch (
88
90
isBuild ? / b a s e 6 4 / : '/nested/icon.png'
89
91
)
92
+ expect ( await getBg ( urlStartsWithVariable ) ) . toMatch (
93
+ isBuild ? / o k \. \w + \. p n g / : `${ viteTestUrl } /ok.png`
94
+ )
90
95
expect ( await getColor ( partialImport ) ) . toBe ( 'orchid' )
91
96
92
97
editFile ( 'sass.scss' , ( code ) =>
@@ -109,6 +114,7 @@ test('less', async () => {
109
114
const imported = await page . $ ( '.less' )
110
115
const atImport = await page . $ ( '.less-at-import' )
111
116
const atImportAlias = await page . $ ( '.less-at-import-alias' )
117
+ const urlStartsWithVariable = await page . $ ( '.less-url-starts-with-variable' )
112
118
113
119
expect ( await getColor ( imported ) ) . toBe ( 'blue' )
114
120
expect ( await getColor ( atImport ) ) . toBe ( 'darkslateblue' )
@@ -117,6 +123,9 @@ test('less', async () => {
117
123
expect ( await getBg ( atImportAlias ) ) . toMatch (
118
124
isBuild ? / b a s e 6 4 / : '/nested/icon.png'
119
125
)
126
+ expect ( await getBg ( urlStartsWithVariable ) ) . toMatch (
127
+ isBuild ? / o k \. \w + \. p n g / : `${ viteTestUrl } /ok.png`
128
+ )
120
129
121
130
editFile ( 'less.less' , ( code ) => code . replace ( '@color: blue' , '@color: red' ) )
122
131
await untilUpdated ( ( ) => getColor ( imported ) , 'red' )
0 commit comments