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

pull/2029/head
Nolan Lawson 2021-04-02 17:01:08 -07:00 zatwierdzone przez GitHub
rodzic d0c9be0c09
commit c815292b0b
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 10 dodań i 3 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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