Skip to content

Commit

Permalink
fix(vitest): correctly support CSS variable when using happy-dom (#4601)
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Nov 27, 2023
1 parent 3f8c3fb commit 9fbf39a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions packages/vitest/src/integrations/env/jsdom-keys.ts
Expand Up @@ -181,6 +181,8 @@ const LIVING_KEYS = [
'Image',
'Audio',
'Option',

'CSS',
]

const OTHER_KEYS = [
Expand Down
8 changes: 7 additions & 1 deletion test/core/test/environments/happy-dom.spec.ts
@@ -1,6 +1,6 @@
// @vitest-environment happy-dom

import { afterEach, test, vi } from 'vitest'
import { afterEach, expect, test, vi } from 'vitest'

afterEach(() => {
vi.useRealTimers()
Expand All @@ -9,3 +9,9 @@ afterEach(() => {
test('fake timers don\'t fail when using empty config', () => {
vi.useFakeTimers({})
})

test('global CSS is injected correctly', () => {
expect(CSS).toBeDefined()
expect(CSS.escape).toBeDefined()
expect(CSS.supports).toBeDefined()
})

0 comments on commit 9fbf39a

Please sign in to comment.