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

Method close

packages/@react-aria/test-utils/src/dialog.ts:123–136  ·  view source on GitHub ↗

* Closes the dialog via the Escape key.

()

Source from the content-addressed store, hash-verified

121 * Closes the dialog via the Escape key.
122 */
123 async close(): Promise<void> {
124 let dialog = this._dialog;
125 if (dialog) {
126 await this.user.keyboard('[Escape]');
127 await waitFor(() => {
128 if (document.contains(dialog)) {
129 throw new Error('Expected the dialog to not be in the document after closing it.');
130 } else {
131 this._dialog = undefined;
132 return true;
133 }
134 });
135 }
136 }
137
138 /**
139 * Returns the dialog's trigger.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected