+ `
+ )
+
+ await nextFrame()
+
+ let [_a, _b, c, d] = Array.from(document.querySelectorAll('input'))
+
+ // First item in the FocusTrap should be the active one
+ assertActiveElement(c)
+
+ // Tab to the next item
+ await press(Keys.Tab)
+
+ // Ensure that input-d is the active element
+ assertActiveElement(d)
+
+ // Tab to the next item
+ await press(Keys.Tab)
+
+ // Ensure that input-c is the active element
+ assertActiveElement(c)
+
+ // Tab to the next item
+ await press(Keys.Tab)
+
+ // Ensure that input-d is the active element
+ assertActiveElement(d)
+
+ // Let's go the other way
+
+ // Tab to the previous item
+ await press(shift(Keys.Tab))
+
+ // Ensure that input-c is the active element
+ assertActiveElement(c)
+
+ // Tab to the previous item
+ await press(shift(Keys.Tab))
+
+ // Ensure that input-d is the active element
+ assertActiveElement(d)
+
+ // Tab to the previous item
+ await press(shift(Keys.Tab))
+
+ // Ensure that input-c is the active element
+ assertActiveElement(c)
})
-
- await nextFrame()
-
- expect(focusHandler.mock.calls).toEqual([['item-a'], ['item-b'], ['item-c'], ['item-d']])
- expect(spy).toHaveBeenCalledWith('There are no focusable elements inside the