fix: fix disableNotificationsBadge aria-label (#1260)

lazy-load-compose-box
Nolan Lawson 2019-06-01 15:51:53 -07:00 zatwierdzone przez GitHub
rodzic 604471a158
commit d75507bbce
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 45 dodań i 6 usunięć

Wyświetl plik

@ -167,16 +167,18 @@ export function timelineComputations (store) {
) )
store.compute('numberOfNotifications', store.compute('numberOfNotifications',
['filteredTimelineNotificationItemSummaries'], ['filteredTimelineNotificationItemSummaries', 'disableNotificationBadge'],
(filteredTimelineNotificationItemSummaries) => ( (filteredTimelineNotificationItemSummaries, disableNotificationBadge) => (
filteredTimelineNotificationItemSummaries ? filteredTimelineNotificationItemSummaries.length : 0 (!disableNotificationBadge && filteredTimelineNotificationItemSummaries)
? filteredTimelineNotificationItemSummaries.length
: 0
) )
) )
store.compute('hasNotifications', store.compute('hasNotifications',
['numberOfNotifications', 'currentPage', 'disableNotificationBadge'], ['numberOfNotifications', 'currentPage'],
(numberOfNotifications, currentPage, $disableNotificationBadge) => ( (numberOfNotifications, currentPage) => (
!$disableNotificationBadge && currentPage !== 'notifications' && !!numberOfNotifications currentPage !== 'notifications' && !!numberOfNotifications
) )
) )
} }

Wyświetl plik

@ -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)')
})

Wyświetl plik

@ -49,6 +49,7 @@ export const markMediaSensitiveInput = $('#choice-mark-media-sensitive')
export const neverMarkMediaSensitiveInput = $('#choice-never-mark-media-sensitive') export const neverMarkMediaSensitiveInput = $('#choice-never-mark-media-sensitive')
export const removeEmojiFromDisplayNamesInput = $('#choice-omit-emoji-in-display-names') export const removeEmojiFromDisplayNamesInput = $('#choice-omit-emoji-in-display-names')
export const disableInfiniteScroll = $('#choice-disable-infinite-scroll') export const disableInfiniteScroll = $('#choice-disable-infinite-scroll')
export const disableUnreadNotifications = $('#choice-disable-unread-notification-counts')
export const dialogOptionsOption = $(`.modal-dialog button`) export const dialogOptionsOption = $(`.modal-dialog button`)
export const emojiSearchInput = $('.emoji-mart-search input') export const emojiSearchInput = $('.emoji-mart-search input')
export const confirmationDialogOKButton = $('.confirmation-dialog-form-flex button:nth-child(1)') export const confirmationDialogOKButton = $('.confirmation-dialog-form-flex button:nth-child(1)')