File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
packages/buttons/src/views/icon-button Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -12,13 +12,17 @@ import ButtonStyles from '@zendeskgarden/css-buttons';
1212
1313const COMPONENT_ID = 'buttons.icon' ;
1414
15- const Icon = ( { children, rotated } ) => {
15+ const Icon = ( { children, className , rotated } ) => {
1616 return React . cloneElement ( Children . only ( children ) , {
1717 'data-garden-id' : COMPONENT_ID ,
1818 'data-garden-version' : PACKAGE_VERSION ,
19- className : classNames ( ButtonStyles [ 'c-btn__icon' ] , {
20- [ ButtonStyles [ 'is-rotated' ] ] : rotated
21- } )
19+ className : classNames (
20+ ButtonStyles [ 'c-btn__icon' ] ,
21+ {
22+ [ ButtonStyles [ 'is-rotated' ] ] : rotated
23+ } ,
24+ className
25+ )
2226 } ) ;
2327} ;
2428
Original file line number Diff line number Diff line change @@ -29,4 +29,14 @@ describe('Icon', () => {
2929
3030 expect ( container . firstChild ) . toHaveClass ( 'is-rotated' ) ;
3131 } ) ;
32+
33+ it ( 'passes className prop' , ( ) => {
34+ const { container } = render (
35+ < Icon className = "test" >
36+ < svg />
37+ </ Icon >
38+ ) ;
39+
40+ expect ( container . firstChild . classList [ 1 ] ) . toBe ( 'test' ) ;
41+ } ) ;
3242} ) ;
You can’t perform that action at this time.
0 commit comments