(fixture)
| 68 | |
| 69 | // Virtualized popups render only the visible options, so they cannot check the count. |
| 70 | function navigation(fixture) { |
| 71 | let combobox = fixture.startsWith('combobox'); |
| 72 | let virtualized = fixture.endsWith('-virtual'); |
| 73 | let conditions = size => [ |
| 74 | ...(virtualized ? [] : [condition('[role="option"]', {count: size})]), |
| 75 | condition('[role="option"][data-focused]', { |
| 76 | count: 1, |
| 77 | attribute: 'data-record', |
| 78 | value: 'item-1' |
| 79 | }), |
| 80 | combobox |
| 81 | ? condition('#combo-input', {focused: true, activeDescendant: option('item-1')}) |
| 82 | : condition(option('item-1'), {focused: true}) |
| 83 | ]; |
| 84 | return { |
| 85 | keyboard: { |
| 86 | prepare: ({page}) => openPopup(page, fixture, () => page.keyboard.press('Home')), |
| 87 | spec: size => press('ArrowDown', combobox ? '#combo-input' : '.list', conditions(size)) |
| 88 | }, |
| 89 | hover: { |
| 90 | prepare: ({page}) => openPopup(page, fixture, () => page.locator(option('item-0')).hover()), |
| 91 | spec: size => ({event: 'pointerover', target: option('item-1'), conditions: conditions(size)}) |
| 92 | } |
| 93 | }; |
| 94 | } |
| 95 | |
| 96 | async function openComboFilter({page}) { |
| 97 | await page.locator('#combo-open').click(); |
no test coverage detected