@@ -51,7 +51,7 @@ describe('components/NotificationRow.tsx', () => {
5151 expect ( tree ) . toMatchSnapshot ( ) ;
5252 } ) ;
5353
54- it ( 'should open a notification in the browser' , ( ) => {
54+ it ( 'should open a notification in the browser - click ' , ( ) => {
5555 const removeNotificationFromState = jest . fn ( ) ;
5656
5757 const props = {
@@ -76,6 +76,31 @@ describe('components/NotificationRow.tsx', () => {
7676 expect ( removeNotificationFromState ) . toHaveBeenCalledTimes ( 1 ) ;
7777 } ) ;
7878
79+ it ( 'should open a notification in the browser - key down' , ( ) => {
80+ const removeNotificationFromState = jest . fn ( ) ;
81+
82+ const props = {
83+ notification : mockedSingleNotification ,
84+ hostname : 'github.com' ,
85+ } ;
86+
87+ render (
88+ < AppContext . Provider
89+ value = { {
90+ settings : { ...mockSettings , markAsDoneOnOpen : false } ,
91+ removeNotificationFromState,
92+ accounts : mockAccounts ,
93+ } }
94+ >
95+ < NotificationRow { ...props } />
96+ </ AppContext . Provider > ,
97+ ) ;
98+
99+ fireEvent . keyDown ( screen . getByRole ( 'main' ) ) ;
100+ expect ( helpers . openInBrowser ) . toHaveBeenCalledTimes ( 1 ) ;
101+ expect ( removeNotificationFromState ) . toHaveBeenCalledTimes ( 1 ) ;
102+ } ) ;
103+
79104 it ( 'should open a notification in browser & mark it as done' , ( ) => {
80105 const markNotificationDone = jest . fn ( ) ;
81106
0 commit comments