File tree Expand file tree Collapse file tree 3 files changed +21
-16
lines changed Expand file tree Collapse file tree 3 files changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -137,22 +137,22 @@ describe('components/Sidebar.tsx', () => {
137
137
138
138
describe ( 'should render the notifications icon' , ( ) => {
139
139
it ( 'when there are 0 notifications' , ( ) => {
140
- const { getByLabelText } = render (
140
+ const { getByTitle } = render (
141
141
< AppContext . Provider value = { { isLoggedIn : true , notifications : [ ] } } >
142
142
< MemoryRouter >
143
143
< Sidebar />
144
144
</ MemoryRouter >
145
145
</ AppContext . Provider > ,
146
146
) ;
147
147
148
- const notificationsIcon = getByLabelText ( '0 Unread Notifications' ) ;
148
+ const notificationsIcon = getByTitle ( '0 Unread Notifications' ) ;
149
149
expect ( notificationsIcon . className ) . toContain ( 'text-white' ) ;
150
150
expect ( notificationsIcon . childNodes . length ) . toBe ( 1 ) ;
151
151
expect ( notificationsIcon . childNodes [ 0 ] . nodeName ) . toBe ( 'svg' ) ;
152
152
} ) ;
153
153
154
154
it ( 'when there are more than 0 notifications' , ( ) => {
155
- const { getByLabelText } = render (
155
+ const { getByTitle } = render (
156
156
< AppContext . Provider
157
157
value = { {
158
158
isLoggedIn : true ,
@@ -165,7 +165,7 @@ describe('components/Sidebar.tsx', () => {
165
165
</ AppContext . Provider > ,
166
166
) ;
167
167
168
- const notificationsIcon = getByLabelText ( '4 Unread Notifications' ) ;
168
+ const notificationsIcon = getByTitle ( '4 Unread Notifications' ) ;
169
169
expect ( notificationsIcon . className ) . toContain ( 'text-green-500' ) ;
170
170
expect ( notificationsIcon . childNodes . length ) . toBe ( 2 ) ;
171
171
expect ( notificationsIcon . childNodes [ 0 ] . nodeName ) . toBe ( 'svg' ) ;
Original file line number Diff line number Diff line change @@ -52,16 +52,19 @@ export const Sidebar: React.FC = () => {
52
52
< Logo aria-label = "Open Gitify" />
53
53
</ button >
54
54
55
- < div
55
+ < button
56
56
className = { `flex justify-around self-stretch items-center my-1 py-1 px-2 text-xs font-extrabold cursor-pointer ${
57
57
notificationsCount > 0 ? 'text-green-500' : 'text-white'
58
58
} `}
59
59
onClick = { onOpenGitHubNotifications }
60
- aria-label = { `${ notificationsCount } Unread Notifications` }
60
+ title = { `${ notificationsCount } Unread Notifications` }
61
61
>
62
- < BellIcon size = { 12 } />
62
+ < BellIcon
63
+ size = { 12 }
64
+ aria-label = { `${ notificationsCount } Unread Notifications` }
65
+ />
63
66
{ notificationsCount > 0 && notificationsCount }
64
- </ div >
67
+ </ button >
65
68
</ div >
66
69
67
70
< div className = "py-4 px-3" >
Original file line number Diff line number Diff line change @@ -59,13 +59,14 @@ exports[`components/Sidebar.tsx should render itself & its children (logged in)
59
59
</g >
60
60
</svg >
61
61
</button >
62
- <div
63
- aria-label = " 4 Unread Notifications"
62
+ <button
64
63
className = " flex justify-around self-stretch items-center my-1 py-1 px-2 text-xs font-extrabold cursor-pointer text-green-500"
65
64
onClick = { [Function ]}
65
+ title = " 4 Unread Notifications"
66
66
>
67
67
<svg
68
- aria-hidden = " true"
68
+ aria-hidden = " false"
69
+ aria-label = " 4 Unread Notifications"
69
70
className = " octicon octicon-bell"
70
71
fill = " currentColor"
71
72
focusable = " false"
@@ -87,7 +88,7 @@ exports[`components/Sidebar.tsx should render itself & its children (logged in)
87
88
/>
88
89
</svg >
89
90
4
90
- </div >
91
+ </button >
91
92
</div >
92
93
<div
93
94
className = " py-4 px-3"
@@ -187,13 +188,14 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
187
188
</g >
188
189
</svg >
189
190
</button >
190
- <div
191
- aria-label = " 4 Unread Notifications"
191
+ <button
192
192
className = " flex justify-around self-stretch items-center my-1 py-1 px-2 text-xs font-extrabold cursor-pointer text-green-500"
193
193
onClick = { [Function ]}
194
+ title = " 4 Unread Notifications"
194
195
>
195
196
<svg
196
- aria-hidden = " true"
197
+ aria-hidden = " false"
198
+ aria-label = " 4 Unread Notifications"
197
199
className = " octicon octicon-bell"
198
200
fill = " currentColor"
199
201
focusable = " false"
@@ -215,7 +217,7 @@ exports[`components/Sidebar.tsx should render itself & its children (logged out)
215
217
/>
216
218
</svg >
217
219
4
218
- </div >
220
+ </button >
219
221
</div >
220
222
<div
221
223
className = " py-4 px-3"
You can’t perform that action at this time.
0 commit comments