test: add #8245 test case

This commit is contained in:
sapphi-red 2022-07-01 12:08:47 +09:00 committed by patak
parent 09742e21dc
commit 4816527b46
6 changed files with 27 additions and 1 deletions

View File

@ -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')
})

View File

@ -0,0 +1,3 @@
.aliasedModule {
color: blue;
}

View File

@ -0,0 +1,3 @@
.aliased {
color: blue;
}

View File

@ -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>

View File

@ -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)

View File

@ -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: {