File tree Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Expand file tree Collapse file tree 3 files changed +39
-4
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,27 @@ describe('components/Sidebar.tsx', () => {
8282 expect ( pushMock ) . toHaveBeenCalledTimes ( 1 ) ;
8383 } ) ;
8484
85- it ( 'open the gitify repo in browser' , ( ) => {
85+ it ( 'opens github in the notifications page' , ( ) => {
86+ const { getByLabelText } = render (
87+ < AppContext . Provider
88+ value = { {
89+ isLoggedIn : true ,
90+ notifications : mockedAccountNotifications ,
91+ } }
92+ >
93+ < MemoryRouter >
94+ < Sidebar />
95+ </ MemoryRouter >
96+ </ AppContext . Provider >
97+ ) ;
98+ fireEvent . click ( getByLabelText ( '4 Unread Notifications' ) ) ;
99+ expect ( shell . openExternal ) . toHaveBeenCalledTimes ( 1 ) ;
100+ expect ( shell . openExternal ) . toHaveBeenCalledWith (
101+ 'https://github.com/notifications'
102+ ) ;
103+ } ) ;
104+
105+ it ( 'opens the gitify repo in browser' , ( ) => {
86106 const { getByLabelText } = render (
87107 < AppContext . Provider value = { { isLoggedIn : true , notifications : [ ] } } >
88108 < MemoryRouter >
@@ -92,5 +112,8 @@ describe('components/Sidebar.tsx', () => {
92112 ) ;
93113 fireEvent . click ( getByLabelText ( 'View project on GitHub' ) ) ;
94114 expect ( shell . openExternal ) . toHaveBeenCalledTimes ( 1 ) ;
115+ expect ( shell . openExternal ) . toHaveBeenCalledWith (
116+ 'https://github.com/manosim/gitify'
117+ ) ;
95118 } ) ;
96119} ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ export const Sidebar: React.FC = () => {
2020 shell . openExternal ( `https://github.com/${ Constants . REPO_SLUG } ` ) ;
2121 } , [ ] ) ;
2222
23+ const onOpenGitHubNotifications = useCallback ( ( ) => {
24+ shell . openExternal ( `https://github.com/notifications` ) ;
25+ } , [ ] ) ;
26+
2327 const quitApp = useCallback ( ( ) => {
2428 ipcRenderer . send ( 'app-quit' ) ;
2529 } , [ ] ) ;
@@ -43,7 +47,11 @@ export const Sidebar: React.FC = () => {
4347 />
4448
4549 { notificationsCount > 0 && (
46- < div className = "flex justify-around self-stretch items-center my-1 py-1 px-2 text-green-500 text-xs font-extrabold" >
50+ < div
51+ className = "flex justify-around self-stretch items-center my-1 py-1 px-2 text-green-500 text-xs font-extrabold cursor-pointer"
52+ onClick = { onOpenGitHubNotifications }
53+ aria-label = { `${ notificationsCount } Unread Notifications` }
54+ >
4755 < Octicons . BellIcon size = { 12 } />
4856 { notificationsCount }
4957 </ div >
Original file line number Diff line number Diff line change @@ -52,7 +52,9 @@ exports[`components/Sidebar.tsx should render itself & its children (logged in)
5252 </g >
5353 </svg >
5454 <div
55- className = " flex justify-around self-stretch items-center my-1 py-1 px-2 text-green-500 text-xs font-extrabold"
55+ aria-label = " 4 Unread Notifications"
56+ className = " flex justify-around self-stretch items-center my-1 py-1 px-2 text-green-500 text-xs font-extrabold cursor-pointer"
57+ onClick = { [Function ]}
5658 >
5759 <svg
5860 aria-hidden = " true"
@@ -195,7 +197,9 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
195197 </g >
196198 </svg >
197199 <div
198- className = " flex justify-around self-stretch items-center my-1 py-1 px-2 text-green-500 text-xs font-extrabold"
200+ aria-label = " 4 Unread Notifications"
201+ className = " flex justify-around self-stretch items-center my-1 py-1 px-2 text-green-500 text-xs font-extrabold cursor-pointer"
202+ onClick = { [Function ]}
199203 >
200204 <svg
201205 aria-hidden = " true"
You can’t perform that action at this time.
0 commit comments