pull/2260/head
Nolan Lawson 2022-11-27 10:02:34 -08:00
rodzic 08593d0dbb
commit 5bbbc91747
2 zmienionych plików z 21 dodań i 1 usunięć

Wyświetl plik

@ -14,7 +14,7 @@ import {
getActiveElementTagName,
getActiveElementClassList,
getNthStatusSensitiveMediaButton,
getActiveElementAriaLabel, settingsNavButton, getActiveElementHref, communityNavButton
getActiveElementAriaLabel, settingsNavButton, getActiveElementHref, communityNavButton, getActiveElementId
} from '../utils'
import { loginAsFoobar } from '../roles'
import { Selector as $ } from 'testcafe'
@ -73,6 +73,22 @@ test('timeline link preserves focus', async t => {
.expect(getActiveElementInsideNthStatus()).eql('1')
})
test('timeline link preserves focus - reblogger avatar', async t => {
await loginAsFoobar(t)
await t
.expect(getNthStatus(1).exists).ok({ timeout: 20000 })
const avatar = `${getNthStatusSelector(1)} .status-header-avatar a`
const id = await $(avatar).getAttribute('id')
await t
.click($(avatar))
.expect(getUrl()).contains('/accounts/')
.click(goBackButton)
.expect(getUrl()).eql('http://localhost:4002/')
.expect(getNthStatus(1).exists).ok()
.expect(getActiveElementId()).eql(id)
})
test('notification timeline preserves focus', async t => {
await loginAsFoobar(t)
await t

Wyświetl plik

@ -169,6 +169,10 @@ export const getActiveElementInnerText = exec(() =>
(document.activeElement && document.activeElement.innerText) || ''
)
export const getActiveElementId = exec(() =>
(document.activeElement && document.activeElement.id) || ''
)
export const getActiveElementRectTop = exec(() => (
(document.activeElement && document.activeElement.getBoundingClientRect().top) || -1
))