MCPcopy Create free account
hub / github.com/adobe/react-spectrum / chooseOption

Function chooseOption

perf/drivers.mjs:122–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

120
121// Choosing commits the value, unmounts the popup's options, and restores focus.
122const chooseOption = fixture => ({
123 prepare: ({page}) => openPopup(page, fixture, () => page.keyboard.press('Home')),
124 spec: () =>
125 press('Enter', '.list', [
126 condition('#select-value', {text: 'item-0'}),
127 condition('[role="option"]', {count: 0}),
128 condition('#select-open', {focused: true})
129 ]),
130 verify: async ({page}) => {
131 let label = await page.locator('#select-open [slot="label"]').textContent();
132 if (label !== 'Record 0') {
133 throw new Error('The Select trigger does not show the chosen record.');
134 }
135 }
136});
137
138// Keyboard drag starts from Record 0's drag button and targets drop indicators by label.
139const insertBetween = (a, b) => `[aria-label="Insert between Record ${a} and Record ${b}"]`;

Callers 1

drivers.mjsFile · 0.85

Calls 3

openPopupFunction · 0.85
pressFunction · 0.85
conditionFunction · 0.85

Tested by

no test coverage detected