Skip to content

Commit

Permalink
fix(vitest): correctly support CSS variable when using happy-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
sheremet-va committed Nov 27, 2023
1 parent 3f8c3fb commit 92aa38c
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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 92aa38c

Please sign in to comment.