11import * as React from 'react'
22import '@testing-library/jest-dom/vitest'
3- import { describe , it , expect , beforeEach } from 'vitest'
4- import { screen , fireEvent } from '@testing-library/react'
3+ import { describe , it , expect , beforeEach , vi } from 'vitest'
4+ import { screen , fireEvent , waitFor , prettyDOM } from '@testing-library/react'
5+ import userEvent from '@testing-library/user-event'
56import { COLORS , SPACING , TYPOGRAPHY , BORDERS } from '@opentrons/components'
67import { renderWithProviders } from '../../../__testing-utils__'
78
89import { QuaternaryButton } from '..'
910
11+ vi . mock ( 'styled-components' , async ( ) => {
12+ const actual = await vi . importActual (
13+ 'styled-components/dist/styled-components.browser.esm.js'
14+ )
15+ return actual
16+ } )
17+
1018const render = ( props : React . ComponentProps < typeof QuaternaryButton > ) => {
1119 return renderWithProviders ( < QuaternaryButton { ...props } /> ) [ 0 ]
1220}
@@ -25,7 +33,7 @@ describe('QuaternaryButton', () => {
2533 const button = screen . getByText ( 'secondary tertiary button' )
2634 expect ( button ) . toHaveStyle ( `background-color: ${ COLORS . white } ` )
2735 expect ( button ) . toHaveStyle ( `border-radius: ${ BORDERS . borderRadiusFull } ` )
28- expect ( button ) . toHaveStyle ( 'box-shadow: 0 0 0 ' )
36+ expect ( button ) . toHaveStyle ( 'box-shadow: none ' )
2937 expect ( button ) . toHaveStyle ( `color: ${ COLORS . blue50 } ` )
3038 expect ( button ) . toHaveStyle (
3139 `padding: ${ SPACING . spacing8 } ${ SPACING . spacing16 } ${ SPACING . spacing8 } ${ SPACING . spacing16 } `
@@ -47,14 +55,6 @@ describe('QuaternaryButton', () => {
4755 expect ( button ) . toHaveStyle ( 'opacity: 50%' )
4856 } )
4957
50- it ( 'applies the correct states to the button - hover' , ( ) => {
51- render ( props )
52- const button = screen . getByText ( 'secondary tertiary button' )
53- fireEvent . mouseOver ( button )
54- expect ( button ) . toHaveStyle ( 'opacity: 70%' )
55- expect ( button ) . toHaveStyle ( 'box-shadow: 0 0 0' )
56- } )
57-
5858 it ( 'renders secondary tertiary button with text and different background color' , ( ) => {
5959 props . color = COLORS . red50
6060 render ( props )
0 commit comments