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

remove-alert-role
Nolan Lawson 2022-11-23 08:49:40 -08:00 zatwierdzone przez GitHub
rodzic 8792d912bc
commit 53803db5be
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 25 dodań i 3 usunięć

Wyświetl plik

@ -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()
})

Wyświetl plik

@ -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) {