MCPcopy Create free account
hub / github.com/testing-library/user-event / assertTabOrderForward

Function assertTabOrderForward

tests/utils/focus/getTabDestination.ts:4–14  ·  view source on GitHub ↗
(tabOrder: Element[])

Source from the content-addressed store, hash-verified

2import {setup} from '#testHelpers'
3
4function assertTabOrderForward(tabOrder: Element[]) {
5 expect(getTabDestination(document.body, false)).toBe(
6 tabOrder[0] ?? document.body,
7 )
8
9 for (let i = 0; i < tabOrder.length - 1; i++) {
10 expect(getTabDestination(tabOrder[i], false)).toBe(
11 i === tabOrder.length - 1 ? document.body : tabOrder[i + 1],
12 )
13 }
14}
15
16function assertTabOrderBackward(tabOrder: Element[]) {
17 expect(getTabDestination(document.body, true)).toBe(

Callers 2

assertTabOrderFunction · 0.85

Calls 1

getTabDestinationFunction · 0.90

Tested by

no test coverage detected