2018-12-01 09:10:30 +01:00
|
|
|
import { loginAsFoobar } from '../roles'
|
|
|
|
import { getNthStatus } from '../utils'
|
2020-04-26 04:03:39 +02:00
|
|
|
import { createPollAs, postAs, postEmptyStatusWithMediaAs } from '../serverActions'
|
2018-12-01 09:10:30 +01:00
|
|
|
|
|
|
|
fixture`120-status-aria-label.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('aria-labels for statuses with no content text', async t => {
|
|
|
|
await postEmptyStatusWithMediaAs('foobar', 'kitten1.jpg', 'kitteh')
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
2019-02-28 17:56:25 +01:00
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
2020-04-26 04:03:39 +02:00
|
|
|
/foobar, has media, (.+ ago|just now), @foobar, Public/i
|
|
|
|
)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('aria-labels for statuses with polls', async t => {
|
|
|
|
await createPollAs('foobar', 'here is my poll', ['yolo', 'whatever'])
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).match(
|
|
|
|
/foobar, here is my poll, has poll, (.+ ago|just now), @foobar, Public/i
|
2018-12-01 09:10:30 +01:00
|
|
|
)
|
|
|
|
})
|
2019-03-21 22:38:37 +01:00
|
|
|
|
|
|
|
test('aria-labels with links', async t => {
|
2019-08-03 22:49:37 +02:00
|
|
|
const content = 'Text here\n\nMore text\n\n' +
|
2019-03-21 22:38:37 +01:00
|
|
|
'https://example.com/long/url/here/very/long/yes/so/long\n\n' +
|
|
|
|
'#woot #yolo'
|
|
|
|
|
2019-08-03 22:49:37 +02:00
|
|
|
const expected = 'admin, Text here More text ' +
|
2019-03-21 22:38:37 +01:00
|
|
|
'https://example.com/long/url/here/very/long/yes/so/long #woot #yolo,'
|
|
|
|
|
|
|
|
await postAs('admin', content)
|
|
|
|
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.hover(getNthStatus(1))
|
|
|
|
.expect(getNthStatus(1).getAttribute('aria-label')).contains(expected)
|
|
|
|
})
|