test: add test for shortcut when focus is inside status (#2232)

This commit is contained in:
Nolan Lawson 2022-11-23 08:49:40 -08:00 committed by GitHub
parent 8792d912bc
commit 53803db5be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 3 deletions

View File

@ -7,9 +7,17 @@ import {
getNthStatusMediaImg,
getNthStatusSensitiveMediaButton,
getNthStatusSpoiler,
getUrl, modalDialog,
getUrl,
modalDialog,
scrollToStatus,
isNthStatusActive, getActiveElementRectTop, scrollToTop, isActiveStatusPinned, getFirstModalMedia
isNthStatusActive,
getActiveElementRectTop,
scrollToTop,
isActiveStatusPinned,
getFirstModalMedia,
getNthStatusAccountLink,
getNthStatusAccountLinkSelector,
focus
} from '../utils'
import { homeTimeline } from '../fixtures'
import { loginAsFoobar } from '../roles'
@ -216,3 +224,13 @@ test('Shortcut j/k change the active status on pinned statuses', async t => {
.expect(isNthStatusActive(1)()).ok()
.expect(isActiveStatusPinned()).eql(true)
})
test('Shortcut down makes next status active when focused inside of a status', async t => {
await loginAsFoobar(t)
await t
.expect(getNthStatusAccountLink(1).exists).ok()
await focus(getNthStatusAccountLinkSelector(1))()
await t
.pressKey('down')
.expect(isNthStatusActive(2)()).ok()
})

View File

@ -522,8 +522,12 @@ export function getNthStatusOptionsButton (n) {
return $(`${getNthStatusSelector(n)} .status-toolbar button:nth-child(4)`)
}
export function getNthStatusAccountLinkSelector (n) {
return `${getNthStatusSelector(n)} .status-author-name`
}
export function getNthStatusAccountLink (n) {
return $(`${getNthStatusSelector(n)} .status-author-name`)
return $(getNthStatusAccountLinkSelector(n))
}
export function getNthFavoritedLabel (n) {