2019-03-24 01:16:06 +00:00
|
|
|
import {
|
|
|
|
getMediaScrollLeft,
|
|
|
|
getNthStatusMediaButton, getNthStatusOptionsButton,
|
2019-03-24 22:08:34 +00:00
|
|
|
modalDialog, scrollToStatus, sleep
|
2019-03-24 01:16:06 +00:00
|
|
|
} from '../utils'
|
|
|
|
import { loginAsFoobar } from '../roles'
|
2019-03-31 16:21:57 +00:00
|
|
|
|
2019-03-24 01:16:06 +00:00
|
|
|
import { homeTimeline } from '../fixtures'
|
|
|
|
|
|
|
|
fixture`030-shortcuts-modal.js`
|
|
|
|
.page`http://localhost:4002`
|
|
|
|
|
|
|
|
test('Backspace dismisses modal', async t => {
|
|
|
|
await loginAsFoobar(t)
|
|
|
|
await t
|
|
|
|
.click(getNthStatusOptionsButton(1))
|
|
|
|
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
|
|
|
|
await sleep(1000)
|
|
|
|
await t
|
|
|
|
.pressKey('backspace')
|
|
|
|
.expect(modalDialog.exists).false
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Backspace dismisses media modal', async t => {
|
|
|
|
await loginAsFoobar(t)
|
2019-08-03 20:49:37 +00:00
|
|
|
const idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos'))
|
2019-03-24 01:16:06 +00:00
|
|
|
await scrollToStatus(t, idx + 1)
|
|
|
|
await t
|
|
|
|
.click(getNthStatusMediaButton(idx + 1))
|
|
|
|
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
|
|
|
|
await sleep(1000)
|
|
|
|
await t
|
|
|
|
.pressKey('backspace')
|
|
|
|
.expect(modalDialog.exists).false
|
|
|
|
})
|
|
|
|
|
|
|
|
test('Left/right changes active media in modal', async t => {
|
|
|
|
await loginAsFoobar(t)
|
2019-08-03 20:49:37 +00:00
|
|
|
const idx = homeTimeline.findIndex(_ => (_.content || '').includes('2 kitten photos'))
|
2019-03-24 01:16:06 +00:00
|
|
|
await scrollToStatus(t, idx + 1)
|
|
|
|
await t
|
|
|
|
.click(getNthStatusMediaButton(idx + 1))
|
|
|
|
.expect(modalDialog.hasAttribute('aria-hidden')).notOk()
|
|
|
|
.expect(getMediaScrollLeft()).eql(0)
|
|
|
|
await sleep(1000)
|
|
|
|
await t
|
|
|
|
.pressKey('right')
|
|
|
|
.expect(getMediaScrollLeft()).gt(0)
|
|
|
|
await sleep(1000)
|
|
|
|
await t
|
|
|
|
.pressKey('backspace')
|
|
|
|
.expect(modalDialog.exists).false
|
|
|
|
})
|