-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't mock css-module if inline is specified
As per the vite docs here: https://vitejs.dev/guide/features.html#disabling-css-injection-into-the-page Using the 'inline' query parameter for CSS has different semantics than regular css imports and the expected return value should be a string as the default export.
- Loading branch information
1 parent
bcb41e5
commit f61fd98
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { describe, expect, test } from 'vitest' | ||
import { useRemoveStyles } from './utils' | ||
|
||
describe('processing inline css', () => { | ||
useRemoveStyles() | ||
|
||
test('doesn\'t apply css', async () => { | ||
await import('../src/App.module.css?inline') | ||
|
||
const element = document.createElement('div') | ||
element.className = 'main' | ||
const computed = window.getComputedStyle(element) | ||
expect(computed.display, 'css is not processed').toBe('block') | ||
}) | ||
|
||
test('returns a string', async () => { | ||
const { default: style } = await import('../src/App.module.css?inline') | ||
expect(typeof style).toBe('string'); | ||
console.log(style); | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters