File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,11 @@ describe('Button', () => {
33
33
expect ( container . firstChild ) . toHaveClass ( 'custom-class' ) ;
34
34
} ) ;
35
35
36
+ it ( 'applies size className' , ( ) => {
37
+ const { container } = render ( < Button size = "small" > Test</ Button > ) ;
38
+ expect ( container . firstChild ) . toHaveClass ( 'ant-btn-sm' ) ;
39
+ } ) ;
40
+
36
41
it ( 'passes other props to AntdButton' , ( ) => {
37
42
const { getByText } = render ( < Button type = "primary" > Primary</ Button > ) ;
38
43
expect ( getByText ( 'Primary' ) . parentNode ) . toHaveClass ( 'ant-btn-primary' ) ;
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ export default function Button({
14
14
...rest
15
15
} : ButtonProps ) {
16
16
return (
17
- < AntdButton className = { classNames ( 'dtc-button' , className ) } { ...rest } >
17
+ < AntdButton className = { classNames ( 'dtc-button' , className ) } size = { size } { ...rest } >
18
18
{ icon && < span className = { `dtc-button__icon dtc-button__icon--${ size } ` } > { icon } </ span > }
19
19
{ children && (
20
20
< span className = { `dtc-button__text dtc-button__text--${ size } ` } > { children } </ span >
You can’t perform that action at this time.
0 commit comments