File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,12 @@ export default function Banner({
114114 const dismissButton = onDismiss
115115 ? (
116116 < div className = { styles . Dismiss } >
117- < Button plain icon = "cancelSmall" accessibilityLabel = "Dismiss notification" />
117+ < Button
118+ plain
119+ icon = "cancelSmall"
120+ onClick = { onDismiss }
121+ accessibilityLabel = "Dismiss notification"
122+ />
118123 </ div >
119124 )
120125 : null ;
Original file line number Diff line number Diff line change 1+ import * as React from 'react' ;
2+ import { shallow } from 'enzyme' ;
3+ import Banner from '..' ;
4+ import Button from '../../Button' ;
5+
6+ describe ( '<Banner />' , ( ) => {
7+ describe ( 'onDismiss()' , ( ) => {
8+ it ( 'is called when the dismiss button is clicked' , ( ) => {
9+ const spy = jest . fn ( ) ;
10+ const banner = shallow ( < Banner onDismiss = { spy } /> ) ;
11+ banner . find ( Button ) . simulate ( 'click' ) ;
12+ expect ( spy ) . toHaveBeenCalled ( ) ;
13+ } ) ;
14+ } ) ;
15+ } ) ;
You can’t perform that action at this time.
0 commit comments