File tree Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Expand file tree Collapse file tree 3 files changed +24
-9
lines changed Original file line number Diff line number Diff line change 1
1
import { fireEvent } from '@testing-library/react'
2
2
import { cloneDeep } from 'lodash'
3
3
import React from 'react'
4
- import { setIsCenterOpen } from 'uiSrc/slices/app/notifications'
4
+ import { notificationCenterSelector , setIsCenterOpen } from 'uiSrc/slices/app/notifications'
5
5
import { cleanup , mockedStore , render , screen } from 'uiSrc/utils/test-utils'
6
6
import NotificationMenu from './NotificationMenu'
7
7
@@ -41,4 +41,15 @@ describe('NotificationMenu', () => {
41
41
expect ( screen . getByTestId ( 'total-unread-badge' ) ) . toBeInTheDocument ( )
42
42
expect ( screen . getByTestId ( 'total-unread-badge' ) ) . toHaveTextContent ( '1' )
43
43
} )
44
+
45
+ it ( 'should show badge with count 9+ of unread messages' , async ( ) => {
46
+ ( notificationCenterSelector as jest . Mock ) . mockReturnValueOnce ( {
47
+ notifications : [ ] ,
48
+ totalUnread : 13 ,
49
+ isCenterOpen : false ,
50
+ } )
51
+ render ( < NotificationMenu /> )
52
+
53
+ expect ( screen . getByTestId ( 'total-unread-badge' ) ) . toHaveTextContent ( '9+' )
54
+ } )
44
55
} )
Original file line number Diff line number Diff line change @@ -33,7 +33,11 @@ const NavButton = () => {
33
33
return (
34
34
< div className = { styles . navBtnWrapper } >
35
35
{ ! isCenterOpen && ! isNotificationOpen ? ( < EuiToolTip content = "Notification Center" position = "right" > { Btn } </ EuiToolTip > ) : Btn }
36
- { ( totalUnread > 0 && ! isCenterOpen ) && ( < div className = { styles . badgeUnreadCount } data-testid = "total-unread-badge" > { totalUnread } </ div > ) }
36
+ { ( totalUnread > 0 && ! isCenterOpen ) && (
37
+ < div className = { styles . badgeUnreadCount } data-testid = "total-unread-badge" >
38
+ { totalUnread > 9 ? '9+' : totalUnread }
39
+ </ div >
40
+ ) }
37
41
</ div >
38
42
)
39
43
}
Original file line number Diff line number Diff line change 12
12
.badgeUnreadCount {
13
13
position : absolute ;
14
14
15
- top : 8 px ;
16
- right : 8 px ;
17
- width : 24 px ;
15
+ top : 12 px ;
16
+ right : 12 px ;
17
+ width : 16 px ;
18
18
height : 16px ;
19
19
border-radius : 22px ;
20
20
21
- background : #9E2A28 ;
21
+ background : #8BA2FF ;
22
22
23
23
text-align : center ;
24
- line-height : 14 px ;
25
- font-size : 12 px ;
26
- color : #fff ;
24
+ line-height : 15 px ;
25
+ font-size : 10 px ;
26
+ color : #000 ;
27
27
}
28
28
}
29
29
You can’t perform that action at this time.
0 commit comments