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 } from '@testing-library/react'
55import { COLORS , SPACING , TYPOGRAPHY , BORDERS } from '@opentrons/components'
66import { renderWithProviders } from '../../../__testing-utils__'
77
88import { QuaternaryButton } from '..'
99
10+ vi . mock ( 'styled-components' , async ( ) => {
11+ const actual = await vi . importActual (
12+ 'styled-components/dist/styled-components.browser.esm.js'
13+ )
14+ return actual
15+ } )
16+
1017const render = ( props : React . ComponentProps < typeof QuaternaryButton > ) => {
1118 return renderWithProviders ( < QuaternaryButton { ...props } /> ) [ 0 ]
1219}
@@ -25,7 +32,7 @@ describe('QuaternaryButton', () => {
2532 const button = screen . getByText ( 'secondary tertiary button' )
2633 expect ( button ) . toHaveStyle ( `background-color: ${ COLORS . white } ` )
2734 expect ( button ) . toHaveStyle ( `border-radius: ${ BORDERS . borderRadiusFull } ` )
28- expect ( button ) . toHaveStyle ( 'box-shadow: 0 0 0 ' )
35+ expect ( button ) . toHaveStyle ( 'box-shadow: none ' )
2936 expect ( button ) . toHaveStyle ( `color: ${ COLORS . blue50 } ` )
3037 expect ( button ) . toHaveStyle (
3138 `padding: ${ SPACING . spacing8 } ${ SPACING . spacing16 } ${ SPACING . spacing8 } ${ SPACING . spacing16 } `
@@ -47,14 +54,6 @@ describe('QuaternaryButton', () => {
4754 expect ( button ) . toHaveStyle ( 'opacity: 50%' )
4855 } )
4956
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-
5857 it ( 'renders secondary tertiary button with text and different background color' , ( ) => {
5958 props . color = COLORS . red50
6059 render ( props )
0 commit comments