fix favorites/boosts reversed aria labels (#153)

Fixes #146
This commit is contained in:
Nolan Lawson 2018-04-17 18:38:27 -07:00 committed by GitHub
parent 1d61a737da
commit 980fec15ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -8,7 +8,7 @@
</ExternalLink> </ExternalLink>
<a class="status-favs-reblogs" <a class="status-favs-reblogs"
href="/statuses/{{originalStatusId}}/reblogs" href="/statuses/{{originalStatusId}}/reblogs"
aria-label="{{favoritesLabel}}"> aria-label="{{reblogsLabel}}">
<svg class="status-favs-reblogs-svg"> <svg class="status-favs-reblogs-svg">
<use xlink:href="#fa-retweet"/> <use xlink:href="#fa-retweet"/>
</svg> </svg>
@ -16,7 +16,7 @@
</a> </a>
<a class="status-favs-reblogs" <a class="status-favs-reblogs"
href="/statuses/{{originalStatusId}}/favorites" href="/statuses/{{originalStatusId}}/favorites"
aria-label="{{reblogsLabel}}"> aria-label="{{favoritesLabel}}">
<svg class="status-favs-reblogs-svg"> <svg class="status-favs-reblogs-svg">
<use xlink:href="#fa-star" /> <use xlink:href="#fa-star" />
</svg> </svg>

View File

@ -1,5 +1,8 @@
import { Selector as $ } from 'testcafe' import { Selector as $ } from 'testcafe'
import { getFavoritesCount, getNthStatus, getReblogsCount, getUrl } from '../utils' import {
favoritesCountElement, getFavoritesCount, getNthStatus, getReblogsCount, getUrl,
reblogsCountElement
} from '../utils'
import { foobarRole } from '../roles' import { foobarRole } from '../roles'
fixture`011-reblog-favorites-count.js` fixture`011-reblog-favorites-count.js`
@ -10,6 +13,7 @@ test('shows favorites', async t => {
.click(getNthStatus(0)) .click(getNthStatus(0))
.expect(getUrl()).contains('/statuses/') .expect(getUrl()).contains('/statuses/')
.expect(getFavoritesCount()).eql(2) .expect(getFavoritesCount()).eql(2)
.expect(favoritesCountElement.getAttribute('aria-label')).eql('Favorited 2 times')
.expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true') .expect($('.icon-button[aria-label="Favorite"]').getAttribute('aria-pressed')).eql('true')
.click($('.status-favs-reblogs').nth(1)) .click($('.status-favs-reblogs').nth(1))
.expect(getUrl()).match(/\/statuses\/[^/]+\/favorites/) .expect(getUrl()).match(/\/statuses\/[^/]+\/favorites/)
@ -24,6 +28,7 @@ test('shows boosts', async t => {
.click(getNthStatus(0)) .click(getNthStatus(0))
.expect(getUrl()).contains('/statuses/') .expect(getUrl()).contains('/statuses/')
.expect(getReblogsCount()).eql(1) .expect(getReblogsCount()).eql(1)
.expect(reblogsCountElement.getAttribute('aria-label')).eql('Boosted 1 time')
.expect($('.icon-button[aria-label="Boost"]').getAttribute('aria-pressed')).eql('false') .expect($('.icon-button[aria-label="Boost"]').getAttribute('aria-pressed')).eql('false')
.click($('.status-favs-reblogs').nth(0)) .click($('.status-favs-reblogs').nth(0))
.expect(getUrl()).match(/\/statuses\/[^/]+\/reblogs/) .expect(getUrl()).match(/\/statuses\/[^/]+\/reblogs/)