mirror of
https://github.com/vitejs/vite.git
synced 2024-11-21 14:48:41 +00:00
test: add #8245 test case
This commit is contained in:
parent
09742e21dc
commit
4816527b46
@ -426,3 +426,9 @@ test('PostCSS source.input.from includes query', async () => {
|
||||
// should resolve assets
|
||||
expect(code).toContain('/postcss-source-input.css?query=foo')
|
||||
})
|
||||
|
||||
test('aliased css has content', async () => {
|
||||
expect(await getColor('.aliased')).toBe('blue')
|
||||
expect(await page.textContent('.aliased-content')).toMatch('.aliased')
|
||||
expect(await getColor('.aliased-module')).toBe('blue')
|
||||
})
|
||||
|
3
playground/css/aliased/bar.module.css
Normal file
3
playground/css/aliased/bar.module.css
Normal file
@ -0,0 +1,3 @@
|
||||
.aliasedModule {
|
||||
color: blue;
|
||||
}
|
3
playground/css/aliased/foo.css
Normal file
3
playground/css/aliased/foo.css
Normal file
@ -0,0 +1,3 @@
|
||||
.aliased {
|
||||
color: blue;
|
||||
}
|
@ -141,6 +141,11 @@
|
||||
|
||||
<p>PostCSS source.input.from. Should include query</p>
|
||||
<pre class="postcss-source-input"></pre>
|
||||
|
||||
<p>Aliased</p>
|
||||
<p class="aliased">import '#alias': this should be blue</p>
|
||||
<pre class="aliased-content"></pre>
|
||||
<p class="aliased-module">import '#alias-module': this should be blue</p>
|
||||
</div>
|
||||
|
||||
<script type="module" src="./main.js"></script>
|
||||
|
@ -92,3 +92,10 @@ text('.imported-css-globEager', JSON.stringify(globEager, null, 2))
|
||||
|
||||
import postcssSourceInput from './postcss-source-input.css?query=foo'
|
||||
text('.postcss-source-input', postcssSourceInput)
|
||||
|
||||
import aliasContent from '#alias'
|
||||
text('.aliased-content', aliasContent)
|
||||
import aliasModule from '#alias-module'
|
||||
document
|
||||
.querySelector('.aliased-module')
|
||||
.classList.add(aliasModule.aliasedModule)
|
||||
|
@ -10,7 +10,9 @@ module.exports = {
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': __dirname,
|
||||
spacefolder: __dirname + '/folder with space'
|
||||
spacefolder: __dirname + '/folder with space',
|
||||
'#alias': __dirname + '/aliased/foo.css',
|
||||
'#alias-module': __dirname + '/aliased/bar.module.css'
|
||||
}
|
||||
},
|
||||
css: {
|
||||
|
Loading…
Reference in New Issue
Block a user