pinafore/tests/spec/10-focus.js

26 lines
805 B
JavaScript
Raw Normal View History

2018-02-21 17:26:22 +00:00
import {
getNthStatus, scrollToStatus, closeDialogButton, modalDialogContents, getActiveElementClass, goBack, getUrl
} from '../utils'
import { foobarRole } from '../roles'
2018-02-22 02:39:53 +00:00
fixture`10-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))
.expect(getUrl()).contains('/statuses/99549266679020981')
await goBack()
await t.expect(getActiveElementClass()).eql('status-article status-in-timeline')
})