2018-02-21 17:26:22 +00:00
|
|
|
import {
|
2018-03-16 03:31:58 +00:00
|
|
|
getNthStatus, scrollToStatus, closeDialogButton, modalDialogContents, getActiveElementClass, goBack, getUrl,
|
|
|
|
goBackButton, getActiveElementInnerText
|
2018-02-21 17:26:22 +00:00
|
|
|
} from '../utils'
|
|
|
|
import { foobarRole } from '../roles'
|
|
|
|
|
2018-03-07 05:32:51 +00:00
|
|
|
fixture`010-focus.js`
|
2018-02-21 17:26:22 +00:00
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('modal preserves focus', async t => {
|
|
|
|
await t.useRole(foobarRole)
|
|
|
|
await scrollToStatus(t, 9)
|
|
|
|
await t.click(getNthStatus(9).find('.play-video-button'))
|
|
|
|
.click(closeDialogButton)
|
|
|
|
.expect(modalDialogContents.exists).notOk()
|
|
|
|
.expect(getActiveElementClass()).eql('play-video-button')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('timeline preserves focus', async t => {
|
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.click(getNthStatus(0))
|
2018-03-06 06:36:54 +00:00
|
|
|
.expect(getUrl()).contains('/statuses/')
|
2018-02-21 17:26:22 +00:00
|
|
|
|
|
|
|
await goBack()
|
2018-03-16 03:31:58 +00:00
|
|
|
await t.expect(getUrl()).eql('http://localhost:4002/')
|
|
|
|
.expect(getActiveElementClass()).eql('status-article status-in-timeline')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('timeline link preserves focus', async t => {
|
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.click(getNthStatus(0).find('.status-header a'))
|
|
|
|
.expect(getUrl()).contains('/accounts/')
|
|
|
|
.click(goBackButton)
|
|
|
|
.expect(getUrl()).eql('http://localhost:4002/')
|
|
|
|
.expect(getActiveElementInnerText()).eql('admin')
|
|
|
|
})
|
|
|
|
|
|
|
|
test('notification timeline preserves focus', async t => {
|
|
|
|
await t.useRole(foobarRole)
|
|
|
|
.navigateTo('/notifications')
|
|
|
|
await scrollToStatus(t, 5)
|
|
|
|
await t.click(getNthStatus(5).find('.status-header a'))
|
|
|
|
.expect(getUrl()).contains('/accounts/')
|
|
|
|
.click(goBackButton)
|
|
|
|
.expect(getUrl()).eql('http://localhost:4002/notifications')
|
|
|
|
.expect(getActiveElementInnerText()).eql('quux')
|
2018-02-21 17:26:22 +00:00
|
|
|
})
|