fix: fix aria-labels on relative timestamps (#2028)

This commit is contained in:
Nolan Lawson 2021-04-02 17:01:08 -07:00 committed by GitHub
parent d0c9be0c09
commit c815292b0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -41,8 +41,8 @@
// just a duplicate link in the focus order.
$disableTapOnStatus ? '0' : '-1'
),
createdAtLabel: ({ formattedDate }) => (
formatIntl('intl.clickToShowThread', { time: formattedDate })
createdAtLabel: ({ shortInlineFormattedDate }) => (
formatIntl('intl.clickToShowThread', { time: shortInlineFormattedDate })
)
}
}

View File

@ -2,7 +2,7 @@ import { loginAsFoobar } from '../roles'
import {
generalSettingsButton,
getNthShowOrHideButton,
getNthStatus, homeNavButton,
getNthStatus, getNthStatusRelativeDateTime, homeNavButton,
notificationsNavButton,
scrollToStatus,
settingsNavButton
@ -21,6 +21,9 @@ test('basic aria-labels for statuses', async t => {
.expect(getNthStatus(1).getAttribute('aria-label')).match(
/quux, pinned toot 1, .+ ago, @quux, Unlisted, Boosted by admin/i
)
.expect(getNthStatusRelativeDateTime(1).getAttribute('aria-label')).match(
/.* ago - click to show thread/i
)
.hover(getNthStatus(1))
.expect(getNthStatus(2).getAttribute('aria-label')).match(
/admin, @foobar notification of unlisted message, .* ago, @admin, Unlisted/i

View File

@ -466,6 +466,10 @@ export function getNthStatusRelativeDate (n) {
return $(`${getNthStatusSelector(n)} .status-relative-date`)
}
export function getNthStatusRelativeDateTime (n) {
return $(`${getNthStatusSelector(n)} .status-relative-date time`)
}
export function getNthStatusMediaImg (n) {
return $(`${getNthStatusSelector(n)} .status-media img`)
}