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

Method close

packages/@react-aria/test-utils/src/combobox.ts:238–254  ·  view source on GitHub ↗

* Closes the combobox dropdown.

()

Source from the content-addressed store, hash-verified

236 * Closes the combobox dropdown.
237 */
238 async close(): Promise<void> {
239 let listbox = this.getListbox();
240 if (listbox) {
241 act(() => this.getCombobox().focus());
242 await this.user.keyboard('[Escape]');
243
244 await waitFor(() => {
245 if (document.contains(listbox)) {
246 throw new Error(
247 'Expected listbox element to not be in the document after selecting an option'
248 );
249 } else {
250 return true;
251 }
252 });
253 }
254 }
255
256 /**
257 * Returns the combobox.

Callers

nothing calls this directly

Calls 4

getListboxMethod · 0.95
getComboboxMethod · 0.95
actFunction · 0.90
focusMethod · 0.80

Tested by

no test coverage detected