From c815292b0bcd368c5d955e042fc24e6a7f472089 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Fri, 2 Apr 2021 17:01:08 -0700 Subject: [PATCH] fix: fix aria-labels on relative timestamps (#2028) --- src/routes/_components/status/StatusRelativeDate.html | 4 ++-- tests/spec/022-status-aria-label.js | 5 ++++- tests/utils.js | 4 ++++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/routes/_components/status/StatusRelativeDate.html b/src/routes/_components/status/StatusRelativeDate.html index a8284651..ad2ffde6 100644 --- a/src/routes/_components/status/StatusRelativeDate.html +++ b/src/routes/_components/status/StatusRelativeDate.html @@ -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 }) ) } } diff --git a/tests/spec/022-status-aria-label.js b/tests/spec/022-status-aria-label.js index b34c1e5a..114b3503 100644 --- a/tests/spec/022-status-aria-label.js +++ b/tests/spec/022-status-aria-label.js @@ -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 diff --git a/tests/utils.js b/tests/utils.js index 77e95877..3c39f582 100644 --- a/tests/utils.js +++ b/tests/utils.js @@ -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`) }