Skip to content

Commit

Permalink
test(theme-ui): use act properly
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus committed Apr 30, 2022
1 parent b96b2b1 commit 4c154e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/theme-ui/test/color-modes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/

import renderer from 'react-test-renderer'
import { render, fireEvent, cleanup } from '@testing-library/react'
import { render, fireEvent, cleanup, act } from '@theme-ui/test-utils'
import { matchers } from '@emotion/jest'
import mockConsole, { RestoreConsole } from 'jest-mock-console'
import packageInfo from '@emotion/react/package.json'
Expand Down Expand Up @@ -159,7 +159,7 @@ test('color mode is passed through theme context', () => {
</ThemeProvider>
)
const button = tree.getByText('test')
button.click()
act(() => button.click())
expect(mode).toBe('dark')
expect(tree.getByText('test')).toHaveStyleRule('color', 'cyan')
})
Expand Down Expand Up @@ -464,7 +464,7 @@ test('dot notation works with color modes', () => {
</ThemeProvider>
)
const button = root.getByText('test')
button.click()
act(() => button.click())
expect(button).toHaveStyleRule('color', 'tomato')
})

Expand Down Expand Up @@ -504,7 +504,7 @@ test('dot notation works with color modes and custom properties', () => {
</ThemeProvider>
)
const button = root.getByText('test')
button.click()
act(() => button.click())
expect(button).toHaveStyleRule('color', 'var(--theme-ui-colors-header-title)')
})

Expand Down

0 comments on commit 4c154e2

Please sign in to comment.