File tree 3 files changed +39
-4
lines changed
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', () => {
82
82
expect ( pushMock ) . toHaveBeenCalledTimes ( 1 ) ;
83
83
} ) ;
84
84
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' , ( ) => {
86
106
const { getByLabelText } = render (
87
107
< AppContext . Provider value = { { isLoggedIn : true , notifications : [ ] } } >
88
108
< MemoryRouter >
@@ -92,5 +112,8 @@ describe('components/Sidebar.tsx', () => {
92
112
) ;
93
113
fireEvent . click ( getByLabelText ( 'View project on GitHub' ) ) ;
94
114
expect ( shell . openExternal ) . toHaveBeenCalledTimes ( 1 ) ;
115
+ expect ( shell . openExternal ) . toHaveBeenCalledWith (
116
+ 'https://github.com/manosim/gitify'
117
+ ) ;
95
118
} ) ;
96
119
} ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ export const Sidebar: React.FC = () => {
20
20
shell . openExternal ( `https://github.com/${ Constants . REPO_SLUG } ` ) ;
21
21
} , [ ] ) ;
22
22
23
+ const onOpenGitHubNotifications = useCallback ( ( ) => {
24
+ shell . openExternal ( `https://github.com/notifications` ) ;
25
+ } , [ ] ) ;
26
+
23
27
const quitApp = useCallback ( ( ) => {
24
28
ipcRenderer . send ( 'app-quit' ) ;
25
29
} , [ ] ) ;
@@ -43,7 +47,11 @@ export const Sidebar: React.FC = () => {
43
47
/>
44
48
45
49
{ 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
+ >
47
55
< Octicons . BellIcon size = { 12 } />
48
56
{ notificationsCount }
49
57
</ 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)
52
52
</g >
53
53
</svg >
54
54
<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 ]}
56
58
>
57
59
<svg
58
60
aria-hidden = " true"
@@ -195,7 +197,9 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
195
197
</g >
196
198
</svg >
197
199
<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 ]}
199
203
>
200
204
<svg
201
205
aria-hidden = " true"
You can’t perform that action at this time.
0 commit comments