fix: fix disableNotificationsBadge aria-label (#1260)
This commit is contained in:
parent
604471a158
commit
d75507bbce
|
@ -167,16 +167,18 @@ export function timelineComputations (store) {
|
|||
)
|
||||
|
||||
store.compute('numberOfNotifications',
|
||||
['filteredTimelineNotificationItemSummaries'],
|
||||
(filteredTimelineNotificationItemSummaries) => (
|
||||
filteredTimelineNotificationItemSummaries ? filteredTimelineNotificationItemSummaries.length : 0
|
||||
['filteredTimelineNotificationItemSummaries', 'disableNotificationBadge'],
|
||||
(filteredTimelineNotificationItemSummaries, disableNotificationBadge) => (
|
||||
(!disableNotificationBadge && filteredTimelineNotificationItemSummaries)
|
||||
? filteredTimelineNotificationItemSummaries.length
|
||||
: 0
|
||||
)
|
||||
)
|
||||
|
||||
store.compute('hasNotifications',
|
||||
['numberOfNotifications', 'currentPage', 'disableNotificationBadge'],
|
||||
(numberOfNotifications, currentPage, $disableNotificationBadge) => (
|
||||
!$disableNotificationBadge && currentPage !== 'notifications' && !!numberOfNotifications
|
||||
['numberOfNotifications', 'currentPage'],
|
||||
(numberOfNotifications, currentPage) => (
|
||||
currentPage !== 'notifications' && !!numberOfNotifications
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
36
tests/spec/129-wellness.js
Normal file
36
tests/spec/129-wellness.js
Normal file
|
@ -0,0 +1,36 @@
|
|||
import {
|
||||
settingsNavButton,
|
||||
homeNavButton,
|
||||
disableUnreadNotifications,
|
||||
getFirstVisibleStatus,
|
||||
getUrl,
|
||||
notificationsNavButton, getTitleText, sleep
|
||||
} from '../utils'
|
||||
import { loginAsFoobar } from '../roles'
|
||||
import { Selector as $ } from 'testcafe'
|
||||
import { postAs } from '../serverActions'
|
||||
|
||||
fixture`129-wellness.js`
|
||||
.page`http://localhost:4002`
|
||||
|
||||
test('Can disable unread notification counts', async t => {
|
||||
await loginAsFoobar(t)
|
||||
await t.click(settingsNavButton)
|
||||
.click($('a').withText('Wellness'))
|
||||
.click(disableUnreadNotifications)
|
||||
.expect(disableUnreadNotifications.checked).ok()
|
||||
.click(homeNavButton)
|
||||
.expect(getUrl()).eql('http://localhost:4002/')
|
||||
.expect(getFirstVisibleStatus().exists).ok()
|
||||
await postAs('admin', 'hey @foobar')
|
||||
await sleep(2000)
|
||||
await t
|
||||
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications')
|
||||
.expect(getTitleText()).notContains('(1)')
|
||||
.click(settingsNavButton)
|
||||
.click($('a').withText('Wellness'))
|
||||
.click(disableUnreadNotifications)
|
||||
.expect(disableUnreadNotifications.checked).notOk()
|
||||
.expect(notificationsNavButton.getAttribute('aria-label')).eql('Notifications (1 notification)')
|
||||
.expect(getTitleText()).contains('(1)')
|
||||
})
|
|
@ -49,6 +49,7 @@ export const markMediaSensitiveInput = $('#choice-mark-media-sensitive')
|
|||
export const neverMarkMediaSensitiveInput = $('#choice-never-mark-media-sensitive')
|
||||
export const removeEmojiFromDisplayNamesInput = $('#choice-omit-emoji-in-display-names')
|
||||
export const disableInfiniteScroll = $('#choice-disable-infinite-scroll')
|
||||
export const disableUnreadNotifications = $('#choice-disable-unread-notification-counts')
|
||||
export const dialogOptionsOption = $(`.modal-dialog button`)
|
||||
export const emojiSearchInput = $('.emoji-mart-search input')
|
||||
export const confirmationDialogOKButton = $('.confirmation-dialog-form-flex button:nth-child(1)')
|
||||
|
|
Loading…
Reference in a new issue