1
0
mirror of https://github.com/nolanlawson/pinafore synced 2024-12-13 02:37:20 +01:00
Pinafore-Web-Client-Frontend/tests/spec/006-tabindex.js
Nolan Lawson 63003c3763
fix: fix aria-posinset should be 1-based (#1055)
* fix: fix aria-posinset should be 1-based

fixes #1053

* second attempt to fix tests

* try to fix test

*  fixup

* lint fix

* fix more tests

* simplify test math
2019-02-28 08:56:25 -08:00

43 lines
1.6 KiB
JavaScript

import { Selector as $ } from 'testcafe'
import { getNthStatus } from '../utils'
import { loginAsFoobar } from '../roles'
fixture`006-tabindex.js`
.page`http://localhost:4002`
test('shows correct tabindex in home timeline', async t => {
await loginAsFoobar(t)
await t
.expect(getNthStatus(1).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(2).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(3).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(4).getAttribute('tabindex')).eql('0')
})
test('shows correct tabindex in notifications', async t => {
await loginAsFoobar(t)
await t
.navigateTo('/notifications')
.expect(getNthStatus(1).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(2).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(3).getAttribute('tabindex')).eql('0')
.hover(getNthStatus(3))
.expect(getNthStatus(4).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(5).getAttribute('tabindex')).eql('0')
.hover(getNthStatus(5))
.expect(getNthStatus(6).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(7).getAttribute('tabindex')).eql('0')
.hover(getNthStatus(7))
.expect(getNthStatus(8).getAttribute('tabindex')).eql('0')
.expect(getNthStatus(8).getAttribute('aria-setsize')).eql('8')
})
test('shows correct tabindex in pinned statuses', async t => {
await loginAsFoobar(t)
await t
.navigateTo('/pinned')
.expect($('.status-article').getAttribute('tabindex')).eql('0')
.expect($('.status-article').getAttribute('aria-posinset')).eql('1')
.expect($('.status-article').getAttribute('aria-setsize')).eql('1')
})