(
defaultValue,
beforeRange,
key,
count,
value,
afterRange,
props,
opts
)
| 33 | }); |
| 34 | |
| 35 | async function testKeyboard( |
| 36 | defaultValue, |
| 37 | beforeRange, |
| 38 | key, |
| 39 | count, |
| 40 | value, |
| 41 | afterRange, |
| 42 | props, |
| 43 | opts |
| 44 | ) { |
| 45 | let {getByRole, getByLabelText, getAllByLabelText, unmount} = render( |
| 46 | <Example defaultValue={defaultValue} autoFocus {...props} /> |
| 47 | ); |
| 48 | let grid = getByRole('grid'); |
| 49 | expect(grid).toHaveAttribute('aria-label', beforeRange); |
| 50 | |
| 51 | let cell = getAllByLabelText('selected', {exact: false}).filter( |
| 52 | cell => cell.role !== 'grid' |
| 53 | )[0]; |
| 54 | expect(document.activeElement).toBe(cell); |
| 55 | |
| 56 | for (let i = 0; i < count; i++) { |
| 57 | if (opts?.shiftKey) { |
| 58 | await user.keyboard('{Shift>}'); |
| 59 | } |
| 60 | |
| 61 | await user.keyboard(`{${key}}`); |
| 62 | |
| 63 | if (opts?.shiftKey) { |
| 64 | await user.keyboard('{/Shift}'); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | cell = getByLabelText(value, {exact: false}); |
| 69 | expect(document.activeElement).toBe(cell); |
| 70 | |
| 71 | expect(grid).toHaveAttribute('aria-label', afterRange); |
| 72 | |
| 73 | // clear any live announcers |
| 74 | act(() => { |
| 75 | jest.runAllTimers(); |
| 76 | }); |
| 77 | |
| 78 | unmount(); |
| 79 | } |
| 80 | |
| 81 | async function testFirstDayOfWeek( |
| 82 | defaultValue, |
no test coverage detected