File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
import { render } from '@testing-library/react'
3
+ import { blockSizes } from '../common/system'
3
4
4
5
import Bar from './Bar'
5
6
@@ -15,11 +16,11 @@ describe('<Bar />', () => {
15
16
const { container, rerender } = render ( < Bar size = 'sm' /> )
16
17
const barEl = container . firstChild
17
18
18
- expect ( barEl ) . toHaveStyleRule ( 'height' , '27px' )
19
+ expect ( barEl ) . toHaveStyleRule ( 'height' , blockSizes . sm )
19
20
20
21
rerender ( < Bar size = 'lg' /> )
21
22
22
- expect ( barEl ) . toHaveStyleRule ( 'height' , '43px' )
23
+ expect ( barEl ) . toHaveStyleRule ( 'height' , blockSizes . lg )
23
24
} )
24
25
25
26
it ( 'should handle custom style' , ( ) => {
Original file line number Diff line number Diff line change @@ -79,4 +79,14 @@ describe('<Button />', () => {
79
79
80
80
expect ( button . innerHTML ) . toBe ( 'click me' )
81
81
} )
82
+
83
+ it ( 'should not fire click when disabled' , ( ) => {
84
+ const onButtonClick = jest . fn ( )
85
+ const { getByRole } = render ( < Button { ...defaultProps } disabled /> )
86
+ const button = getByRole ( 'button' )
87
+
88
+ fireEvent . click ( button )
89
+
90
+ expect ( onButtonClick ) . not . toHaveBeenCalled ( )
91
+ } )
82
92
} )
You can’t perform that action at this time.
0 commit comments