@react-aria/test-utils 1.0.0-alpha.5 → 1.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/combobox.main.js.map +1 -1
- package/dist/combobox.module.js.map +1 -1
- package/dist/events.main.js.map +1 -1
- package/dist/events.module.js.map +1 -1
- package/dist/gridlist.main.js +1 -1
- package/dist/gridlist.main.js.map +1 -1
- package/dist/gridlist.mjs +1 -1
- package/dist/gridlist.module.js +1 -1
- package/dist/gridlist.module.js.map +1 -1
- package/dist/listbox.main.js +2 -3
- package/dist/listbox.main.js.map +1 -1
- package/dist/listbox.mjs +2 -3
- package/dist/listbox.module.js +2 -3
- package/dist/listbox.module.js.map +1 -1
- package/dist/menu.main.js +39 -19
- package/dist/menu.main.js.map +1 -1
- package/dist/menu.mjs +39 -19
- package/dist/menu.module.js +39 -19
- package/dist/menu.module.js.map +1 -1
- package/dist/select.main.js.map +1 -1
- package/dist/select.module.js.map +1 -1
- package/dist/table.main.js +48 -0
- package/dist/table.main.js.map +1 -1
- package/dist/table.mjs +48 -0
- package/dist/table.module.js +48 -0
- package/dist/table.module.js.map +1 -1
- package/dist/tabs.main.js.map +1 -1
- package/dist/tabs.module.js.map +1 -1
- package/dist/testSetup.main.js.map +1 -1
- package/dist/testSetup.module.js.map +1 -1
- package/dist/tree.main.js +1 -1
- package/dist/tree.main.js.map +1 -1
- package/dist/tree.mjs +1 -1
- package/dist/tree.module.js +1 -1
- package/dist/tree.module.js.map +1 -1
- package/dist/types.d.ts +16 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/user.main.js +1 -1
- package/dist/user.main.js.map +1 -1
- package/dist/user.mjs +1 -1
- package/dist/user.module.js +1 -1
- package/dist/user.module.js.map +1 -1
- package/package.json +5 -4
- package/src/combobox.ts +4 -4
- package/src/events.ts +3 -3
- package/src/gridlist.ts +8 -7
- package/src/listbox.ts +7 -13
- package/src/menu.ts +64 -14
- package/src/select.ts +4 -4
- package/src/table.ts +98 -6
- package/src/tabs.ts +2 -2
- package/src/testSetup.ts +2 -2
- package/src/tree.ts +9 -8
- package/src/types.ts +8 -4
- package/src/user.ts +1 -1
package/dist/tree.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM;IAmBX;;GAEC,GACD,mBAAmB,IAAiC,EAAE;QACpD,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,QAAQ,IAAuC,EAAe;QAC5D,IAAI,kBACF,cAAc,EACf,GAAG;QAEJ,IAAI;QACJ,IAAI,OAAO,mBAAmB,UAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe;aAC1B,IAAI,OAAO,mBAAmB,UACnC,MAAO,CAAA,GAAA,iCAAK,EAAE,IAAI,CAAC,IAAI,EAAG,SAAS,CAAC,gBAAgB,OAAO,CAAC;QAG9D,OAAO;IACT;IAEA,YAAY;IACZ,MAAc,sBAAsB,IAAwB,EAAE;QAC5D,IAAI,OAAC,GAAG,EAAC,GAAG;QACZ,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,cAAc,KAAK,OAAO,CAAC;QAC/B,IAAI,gBAAgB,IAClB,MAAM,IAAI,MAAM;QAElB,IAAI,SAAS,aAAa,KAAK,IAAI,CAAC,IAAI,EACtC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;aACpB,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,aAAa,KAAK,SAAS,aAAa,CAAE,YAAY,CAAC,YAAY,OACzG,GACE,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;eAClB,SAAS,aAAa,CAAE,YAAY,CAAC,YAAY,OAAO;QAEnE,IAAI,YAAY,KAAK,OAAO,CAAC,SAAS,aAAa;QACnD,IAAI,cAAc,IAChB,MAAM,IAAI,MAAM;QAElB,IAAI,YAAY,cAAc,YAAY,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QAAE,IAAI,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG;QAClD,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAC3C,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,KAAK,GAAG;QACb,oCAAoC;QACpC,IAAI,OAAO,CAAA,GAAA,iCAAK,EAAE,MAAM,WAAW,CAAC;QACpC,IAAI,KAAK,YAAY,CAAC,YAAY,cAAc,MAC9C,IAAI,CAAC,KAAK,GAAG;IAEjB;AAiNF","sources":["packages/@react-aria/test-utils/src/tree.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act, within} from '@testing-library/react';\nimport {BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts} from './types';\nimport {pressElement, triggerLongPress} from './events';\n\ninterface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {}\ninterface TreeToggleRowOpts extends ToggleGridRowOpts {}\ninterface TreeRowActionOpts extends GridRowActionOpts {}\n\n// TODO: this ended up being pretty much the same as gridlist, refactor so it extends from gridlist\nexport class TreeTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _tree: HTMLElement;\n\n constructor(opts: TreeTesterOpts) {\n let {root, user, interactionType, advanceTimer} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n this._tree = root;\n // TODO: should all helpers do this?\n let tree = within(root).queryByRole('treegrid');\n if (root.getAttribute('role') !== 'treegrid' && tree) {\n this._tree = tree;\n }\n }\n\n /**\n * Set the interaction type used by the tree tester.\n */\n setInteractionType(type: UserOpts['interactionType']) {\n this._interactionType = type;\n };\n\n /**\n * Returns a row matching the specified index or text content.\n */\n findRow(opts: {rowIndexOrText: number | string}): HTMLElement {\n let {\n rowIndexOrText\n } = opts;\n\n let row;\n if (typeof rowIndexOrText === 'number') {\n row = this.rows[rowIndexOrText];\n } else if (typeof rowIndexOrText === 'string') {\n row = (within(this.tree!).getByText(rowIndexOrText).closest('[role=row]'))! as HTMLElement;\n }\n\n return row;\n }\n\n // TODO: RTL\n private async keyboardNavigateToRow(opts: {row: HTMLElement}) {\n let {row} = opts;\n let rows = this.rows;\n let targetIndex = rows.indexOf(row);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the tree');\n }\n if (document.activeElement === this.tree) {\n await this.user.keyboard('[ArrowDown]');\n } else if (this._tree.contains(document.activeElement) && document.activeElement!.getAttribute('role') !== 'row') {\n do {\n await this.user.keyboard('[ArrowLeft]');\n } while (document.activeElement!.getAttribute('role') !== 'row');\n }\n let currIndex = rows.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('ActiveElement is not in the tree');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n };\n\n /**\n * Toggles the selection for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowSelection(opts: TreeToggleRowOpts) {\n let {\n row,\n needsLongPress,\n checkboxSelection = true,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n let rowCheckbox = within(row).queryByRole('checkbox');\n\n // TODO: we early return here because the checkbox can't be keyboard navigated to if the row is disabled usually\n // but we may to check for disabledBehavior (aka if the disable row gets skipped when keyboard navigating or not)\n if (interactionType === 'keyboard' && (rowCheckbox?.getAttribute('disabled') === '' || row?.getAttribute('aria-disabled') === 'true')) {\n return;\n }\n\n // this would be better than the check to do nothing in events.ts\n // also, it'd be good to be able to trigger selection on the row instead of having to go to the checkbox directly\n if (interactionType === 'keyboard' && !checkboxSelection) {\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('{Space}');\n return;\n }\n if (rowCheckbox && checkboxSelection) {\n await pressElement(this.user, rowCheckbox, interactionType);\n } else {\n let cell = within(row).getAllByRole('gridcell')[0];\n if (needsLongPress && interactionType === 'touch') {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n\n // Note that long press interactions with rows is strictly touch only for grid rows\n await triggerLongPress({element: cell, advanceTimer: this._advanceTimer, pointerOpts: {pointerType: 'touch'}});\n } else {\n await pressElement(this.user, cell, interactionType);\n }\n }\n };\n\n /**\n * Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowExpansion(opts: TreeToggleExpansionOpts) {\n let {\n row,\n interactionType = this._interactionType\n } = opts;\n if (!this.tree.contains(document.activeElement)) {\n await act(async () => {\n this.tree.focus();\n });\n }\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n } else if (row.getAttribute('aria-expanded') == null) {\n throw new Error('Target row is not expandable.');\n }\n\n if (interactionType === 'mouse' || interactionType === 'touch') {\n let rowExpander = within(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?\n await pressElement(this.user, rowExpander, interactionType);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n await this.keyboardNavigateToRow({row});\n if (row.getAttribute('aria-expanded') === 'true') {\n await this.user.keyboard('[ArrowLeft]');\n } else {\n await this.user.keyboard('[ArrowRight]');\n }\n }\n };\n\n /**\n * Triggers the action for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async triggerRowAction(opts: TreeRowActionOpts) {\n let {\n row,\n needsDoubleClick,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n if (needsDoubleClick) {\n await this.user.dblClick(row);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) {\n act(() => this._tree.focus());\n }\n\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('[Enter]');\n } else {\n await pressElement(this.user, row, interactionType);\n }\n };\n\n /**\n * Returns the tree.\n */\n get tree(): HTMLElement {\n return this._tree;\n }\n\n /**\n * Returns the tree's rows if any.\n */\n get rows(): HTMLElement[] {\n return within(this?.tree).queryAllByRole('row');\n }\n\n /**\n * Returns the tree's selected rows if any.\n */\n get selectedRows(): HTMLElement[] {\n return this.rows.filter(row => row.getAttribute('aria-selected') === 'true');\n }\n\n /**\n * Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.\n */\n cells(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.tree} = opts;\n return within(element).queryAllByRole('gridcell');\n }\n}\n"],"names":[],"version":3,"file":"tree.main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM;IAmBX;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,QAAQ,IAAuC,EAAe;QAC5D,IAAI,kBACF,cAAc,EACf,GAAG;QAEJ,IAAI;QACJ,IAAI,OAAO,mBAAmB,UAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe;aAC1B,IAAI,OAAO,mBAAmB,UACnC,MAAO,CAAA,GAAA,iCAAK,EA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CAAC,qBAAqB,CAAC;qBAAC;YAAG;YACrC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B,OACE,MAAM,CAAA,GAAA,sCAAW,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK;IAEvC;IAEA;;GAEC,GACD,IAAI,OAAqB;QACvB,OAAO,IAAI,CAAC,KAAK;IACnB;IAEA;;GAEC,GACD,IAAI,OAAsB;YACV;QAAd,OAAO,CAAA,GAAA,iCAAK,GAAE,QAAA,IAAI,cAAJ,4BAAA,MAAM,IAAI,EAAE,cAAc,CAAC;IAC3C;IAEA;;GAEC,GACD,IAAI,eAA8B;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,MAAO,IAAI,YAAY,CAAC,qBAAqB;IACvE;IAEA;;GAEC,GACD,MAAM,OAAgC,CAAC,CAAC,EAAiB;QACvD,IAAI,WAAC,UAAU,IAAI,CAAC,IAAI,EAAC,GAAG;QAC5B,OAAO,CAAA,GAAA,iCAAK,EAAE,SAAS,cAAc,CAAC;IACxC;IA5NA,YAAY,IAAoB,CAAE;QAChC,IAAI,QAAC,IAAI,QAAE,IAAI,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG;QAClD,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAC3C,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,KAAK,GAAG;QACb,oCAAoC;QACpC,IAAI,OAAO,CAAA,GAAA,iCAAK,EAAE,MAAM,WAAW,CAAC;QACpC,IAAI,KAAK,YAAY,CAAC,YAAY,cAAc,MAC9C,IAAI,CAAC,KAAK,GAAG;IAEjB;AAkNF","sources":["packages/@react-aria/test-utils/src/tree.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act, within} from '@testing-library/react';\nimport {BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts} from './types';\nimport {pressElement, triggerLongPress} from './events';\n\ninterface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {}\ninterface TreeToggleRowOpts extends ToggleGridRowOpts {}\ninterface TreeRowActionOpts extends GridRowActionOpts {}\n\n// TODO: this ended up being pretty much the same as gridlist, refactor so it extends from gridlist\nexport class TreeTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _tree: HTMLElement;\n\n constructor(opts: TreeTesterOpts) {\n let {root, user, interactionType, advanceTimer} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n this._tree = root;\n // TODO: should all helpers do this?\n let tree = within(root).queryByRole('treegrid');\n if (root.getAttribute('role') !== 'treegrid' && tree) {\n this._tree = tree;\n }\n }\n\n /**\n * Set the interaction type used by the tree tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n };\n\n /**\n * Returns a row matching the specified index or text content.\n */\n findRow(opts: {rowIndexOrText: number | string}): HTMLElement {\n let {\n rowIndexOrText\n } = opts;\n\n let row;\n if (typeof rowIndexOrText === 'number') {\n row = this.rows[rowIndexOrText];\n } else if (typeof rowIndexOrText === 'string') {\n row = (within(this.tree!).getByText(rowIndexOrText).closest('[role=row]'))! as HTMLElement;\n }\n\n return row;\n }\n\n // TODO: RTL\n private async keyboardNavigateToRow(opts: {row: HTMLElement}) {\n let {row} = opts;\n let rows = this.rows;\n let targetIndex = rows.indexOf(row);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the tree');\n }\n\n if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) {\n act(() => this._tree.focus());\n }\n\n if (document.activeElement === this.tree) {\n await this.user.keyboard('[ArrowDown]');\n } else if (this._tree.contains(document.activeElement) && document.activeElement!.getAttribute('role') !== 'row') {\n do {\n await this.user.keyboard('[ArrowLeft]');\n } while (document.activeElement!.getAttribute('role') !== 'row');\n }\n let currIndex = rows.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('ActiveElement is not in the tree');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n };\n\n /**\n * Toggles the selection for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowSelection(opts: TreeToggleRowOpts): Promise<void> {\n let {\n row,\n needsLongPress,\n checkboxSelection = true,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n let rowCheckbox = within(row).queryByRole('checkbox');\n\n // TODO: we early return here because the checkbox can't be keyboard navigated to if the row is disabled usually\n // but we may to check for disabledBehavior (aka if the disable row gets skipped when keyboard navigating or not)\n if (interactionType === 'keyboard' && (rowCheckbox?.getAttribute('disabled') === '' || row?.getAttribute('aria-disabled') === 'true')) {\n return;\n }\n\n // this would be better than the check to do nothing in events.ts\n // also, it'd be good to be able to trigger selection on the row instead of having to go to the checkbox directly\n if (interactionType === 'keyboard' && !checkboxSelection) {\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('{Space}');\n return;\n }\n if (rowCheckbox && checkboxSelection) {\n await pressElement(this.user, rowCheckbox, interactionType);\n } else {\n let cell = within(row).getAllByRole('gridcell')[0];\n if (needsLongPress && interactionType === 'touch') {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n\n // Note that long press interactions with rows is strictly touch only for grid rows\n await triggerLongPress({element: cell, advanceTimer: this._advanceTimer, pointerOpts: {pointerType: 'touch'}});\n } else {\n await pressElement(this.user, cell, interactionType);\n }\n }\n };\n\n /**\n * Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowExpansion(opts: TreeToggleExpansionOpts): Promise<void> {\n let {\n row,\n interactionType = this._interactionType\n } = opts;\n if (!this.tree.contains(document.activeElement)) {\n await act(async () => {\n this.tree.focus();\n });\n }\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n } else if (row.getAttribute('aria-expanded') == null) {\n throw new Error('Target row is not expandable.');\n }\n\n if (interactionType === 'mouse' || interactionType === 'touch') {\n let rowExpander = within(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?\n await pressElement(this.user, rowExpander, interactionType);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n await this.keyboardNavigateToRow({row});\n if (row.getAttribute('aria-expanded') === 'true') {\n await this.user.keyboard('[ArrowLeft]');\n } else {\n await this.user.keyboard('[ArrowRight]');\n }\n }\n };\n\n /**\n * Triggers the action for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async triggerRowAction(opts: TreeRowActionOpts): Promise<void> {\n let {\n row,\n needsDoubleClick,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n if (needsDoubleClick) {\n await this.user.dblClick(row);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('[Enter]');\n } else {\n await pressElement(this.user, row, interactionType);\n }\n };\n\n /**\n * Returns the tree.\n */\n get tree(): HTMLElement {\n return this._tree;\n }\n\n /**\n * Returns the tree's rows if any.\n */\n get rows(): HTMLElement[] {\n return within(this?.tree).queryAllByRole('row');\n }\n\n /**\n * Returns the tree's selected rows if any.\n */\n get selectedRows(): HTMLElement[] {\n return this.rows.filter(row => row.getAttribute('aria-selected') === 'true');\n }\n\n /**\n * Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.\n */\n cells(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.tree} = opts;\n return within(element).queryAllByRole('gridcell');\n }\n}\n"],"names":[],"version":3,"file":"tree.main.js.map"}
|
package/dist/tree.mjs
CHANGED
|
@@ -34,6 +34,7 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
|
|
|
34
34
|
let rows = this.rows;
|
|
35
35
|
let targetIndex = rows.indexOf(row);
|
|
36
36
|
if (targetIndex === -1) throw new Error('Option provided is not in the tree');
|
|
37
|
+
if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) (0, $3mnbZ$act)(()=>this._tree.focus());
|
|
37
38
|
if (document.activeElement === this.tree) await this.user.keyboard('[ArrowDown]');
|
|
38
39
|
else if (this._tree.contains(document.activeElement) && document.activeElement.getAttribute('role') !== 'row') do await this.user.keyboard('[ArrowLeft]');
|
|
39
40
|
while (document.activeElement.getAttribute('role') !== 'row');
|
|
@@ -114,7 +115,6 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
|
|
|
114
115
|
if (needsDoubleClick) await this.user.dblClick(row);
|
|
115
116
|
else if (interactionType === 'keyboard') {
|
|
116
117
|
if ((row === null || row === void 0 ? void 0 : row.getAttribute('aria-disabled')) === 'true') return;
|
|
117
|
-
if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) (0, $3mnbZ$act)(()=>this._tree.focus());
|
|
118
118
|
await this.keyboardNavigateToRow({
|
|
119
119
|
row: row
|
|
120
120
|
});
|
package/dist/tree.module.js
CHANGED
|
@@ -34,6 +34,7 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
|
|
|
34
34
|
let rows = this.rows;
|
|
35
35
|
let targetIndex = rows.indexOf(row);
|
|
36
36
|
if (targetIndex === -1) throw new Error('Option provided is not in the tree');
|
|
37
|
+
if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) (0, $3mnbZ$act)(()=>this._tree.focus());
|
|
37
38
|
if (document.activeElement === this.tree) await this.user.keyboard('[ArrowDown]');
|
|
38
39
|
else if (this._tree.contains(document.activeElement) && document.activeElement.getAttribute('role') !== 'row') do await this.user.keyboard('[ArrowLeft]');
|
|
39
40
|
while (document.activeElement.getAttribute('role') !== 'row');
|
|
@@ -114,7 +115,6 @@ class $962758aa2f16f1a4$export$4445864b14128396 {
|
|
|
114
115
|
if (needsDoubleClick) await this.user.dblClick(row);
|
|
115
116
|
else if (interactionType === 'keyboard') {
|
|
116
117
|
if ((row === null || row === void 0 ? void 0 : row.getAttribute('aria-disabled')) === 'true') return;
|
|
117
|
-
if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) (0, $3mnbZ$act)(()=>this._tree.focus());
|
|
118
118
|
await this.keyboardNavigateToRow({
|
|
119
119
|
row: row
|
|
120
120
|
});
|
package/dist/tree.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM;IAmBX;;GAEC,GACD,mBAAmB,IAAiC,EAAE;QACpD,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,QAAQ,IAAuC,EAAe;QAC5D,IAAI,kBACF,cAAc,EACf,GAAG;QAEJ,IAAI;QACJ,IAAI,OAAO,mBAAmB,UAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe;aAC1B,IAAI,OAAO,mBAAmB,UACnC,MAAO,CAAA,GAAA,aAAK,EAAE,IAAI,CAAC,IAAI,EAAG,SAAS,CAAC,gBAAgB,OAAO,CAAC;QAG9D,OAAO;IACT;IAEA,YAAY;IACZ,MAAc,sBAAsB,IAAwB,EA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CAAC,IAAI,EAAE,KAAK;IAEvC;IAEA;;GAEC,GACD,IAAI,OAAqB;QACvB,OAAO,IAAI,CAAC,KAAK;IACnB;IAEA;;GAEC,GACD,IAAI,OAAsB;YACV;QAAd,OAAO,CAAA,GAAA,aAAK,GAAE,QAAA,IAAI,cAAJ,4BAAA,MAAM,IAAI,EAAE,cAAc,CAAC;IAC3C;IAEA;;GAEC,GACD,IAAI,eAA8B;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA,MAAO,IAAI,YAAY,CAAC,qBAAqB;IACvE;IAEA;;GAEC,GACD,MAAM,OAAgC,CAAC,CAAC,EAAiB;QACvD,IAAI,WAAC,UAAU,IAAI,CAAC,IAAI,EAAC,GAAG;QAC5B,OAAO,CAAA,GAAA,aAAK,EAAE,SAAS,cAAc,CAAC;IACxC;IA3NA,YAAY,IAAoB,CAAE;QAChC,IAAI,QAAC,IAAI,QAAE,IAAI,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG;QAClD,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAC3C,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,KAAK,GAAG;QACb,oCAAoC;QACpC,IAAI,OAAO,CAAA,GAAA,aAAK,EAAE,MAAM,WAAW,CAAC;QACpC,IAAI,KAAK,YAAY,CAAC,YAAY,cAAc,MAC9C,IAAI,CAAC,KAAK,GAAG;IAEjB;AAiNF","sources":["packages/@react-aria/test-utils/src/tree.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act, within} from '@testing-library/react';\nimport {BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts} from './types';\nimport {pressElement, triggerLongPress} from './events';\n\ninterface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {}\ninterface TreeToggleRowOpts extends ToggleGridRowOpts {}\ninterface TreeRowActionOpts extends GridRowActionOpts {}\n\n// TODO: this ended up being pretty much the same as gridlist, refactor so it extends from gridlist\nexport class TreeTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _tree: HTMLElement;\n\n constructor(opts: TreeTesterOpts) {\n let {root, user, interactionType, advanceTimer} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n this._tree = root;\n // TODO: should all helpers do this?\n let tree = within(root).queryByRole('treegrid');\n if (root.getAttribute('role') !== 'treegrid' && tree) {\n this._tree = tree;\n }\n }\n\n /**\n * Set the interaction type used by the tree tester.\n */\n setInteractionType(type: UserOpts['interactionType']) {\n this._interactionType = type;\n };\n\n /**\n * Returns a row matching the specified index or text content.\n */\n findRow(opts: {rowIndexOrText: number | string}): HTMLElement {\n let {\n rowIndexOrText\n } = opts;\n\n let row;\n if (typeof rowIndexOrText === 'number') {\n row = this.rows[rowIndexOrText];\n } else if (typeof rowIndexOrText === 'string') {\n row = (within(this.tree!).getByText(rowIndexOrText).closest('[role=row]'))! as HTMLElement;\n }\n\n return row;\n }\n\n // TODO: RTL\n private async keyboardNavigateToRow(opts: {row: HTMLElement}) {\n let {row} = opts;\n let rows = this.rows;\n let targetIndex = rows.indexOf(row);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the tree');\n }\n if (document.activeElement === this.tree) {\n await this.user.keyboard('[ArrowDown]');\n } else if (this._tree.contains(document.activeElement) && document.activeElement!.getAttribute('role') !== 'row') {\n do {\n await this.user.keyboard('[ArrowLeft]');\n } while (document.activeElement!.getAttribute('role') !== 'row');\n }\n let currIndex = rows.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('ActiveElement is not in the tree');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n };\n\n /**\n * Toggles the selection for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowSelection(opts: TreeToggleRowOpts) {\n let {\n row,\n needsLongPress,\n checkboxSelection = true,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n let rowCheckbox = within(row).queryByRole('checkbox');\n\n // TODO: we early return here because the checkbox can't be keyboard navigated to if the row is disabled usually\n // but we may to check for disabledBehavior (aka if the disable row gets skipped when keyboard navigating or not)\n if (interactionType === 'keyboard' && (rowCheckbox?.getAttribute('disabled') === '' || row?.getAttribute('aria-disabled') === 'true')) {\n return;\n }\n\n // this would be better than the check to do nothing in events.ts\n // also, it'd be good to be able to trigger selection on the row instead of having to go to the checkbox directly\n if (interactionType === 'keyboard' && !checkboxSelection) {\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('{Space}');\n return;\n }\n if (rowCheckbox && checkboxSelection) {\n await pressElement(this.user, rowCheckbox, interactionType);\n } else {\n let cell = within(row).getAllByRole('gridcell')[0];\n if (needsLongPress && interactionType === 'touch') {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n\n // Note that long press interactions with rows is strictly touch only for grid rows\n await triggerLongPress({element: cell, advanceTimer: this._advanceTimer, pointerOpts: {pointerType: 'touch'}});\n } else {\n await pressElement(this.user, cell, interactionType);\n }\n }\n };\n\n /**\n * Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowExpansion(opts: TreeToggleExpansionOpts) {\n let {\n row,\n interactionType = this._interactionType\n } = opts;\n if (!this.tree.contains(document.activeElement)) {\n await act(async () => {\n this.tree.focus();\n });\n }\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n } else if (row.getAttribute('aria-expanded') == null) {\n throw new Error('Target row is not expandable.');\n }\n\n if (interactionType === 'mouse' || interactionType === 'touch') {\n let rowExpander = within(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?\n await pressElement(this.user, rowExpander, interactionType);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n await this.keyboardNavigateToRow({row});\n if (row.getAttribute('aria-expanded') === 'true') {\n await this.user.keyboard('[ArrowLeft]');\n } else {\n await this.user.keyboard('[ArrowRight]');\n }\n }\n };\n\n /**\n * Triggers the action for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async triggerRowAction(opts: TreeRowActionOpts) {\n let {\n row,\n needsDoubleClick,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n if (needsDoubleClick) {\n await this.user.dblClick(row);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) {\n act(() => this._tree.focus());\n }\n\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('[Enter]');\n } else {\n await pressElement(this.user, row, interactionType);\n }\n };\n\n /**\n * Returns the tree.\n */\n get tree(): HTMLElement {\n return this._tree;\n }\n\n /**\n * Returns the tree's rows if any.\n */\n get rows(): HTMLElement[] {\n return within(this?.tree).queryAllByRole('row');\n }\n\n /**\n * Returns the tree's selected rows if any.\n */\n get selectedRows(): HTMLElement[] {\n return this.rows.filter(row => row.getAttribute('aria-selected') === 'true');\n }\n\n /**\n * Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.\n */\n cells(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.tree} = opts;\n return within(element).queryAllByRole('gridcell');\n }\n}\n"],"names":[],"version":3,"file":"tree.module.js.map"}
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC;;AAWM,MAAM;IAmBX;;GAEC,GACD,mBAAmB,IAAiC,EAAQ;QAC1D,IAAI,CAAC,gBAAgB,GAAG;IAC1B;IAEA;;GAEC,GACD,QAAQ,IAAuC,EAAe;QAC5D,IAAI,kBACF,cAAc,EACf,GAAG;QAEJ,IAAI;QACJ,IAAI,OAAO,mBAAmB,UAC5B,MAAM,IAAI,CAAC,IAAI,CAAC,eAAe;aAC1B,IAAI,OAAO,mBAAmB,UACnC,MAAO,CAAA,GAAA,aAAK,EAAE,IAAI,CAAC,IAAI,EAAG,SAAS,CAAC,gBAAgB,OAAO,CAAC;QAG9D,OAAO;IACT;IAEA,YAAY;IACZ,MAAc,sBAAsB,IAAwB,EAAE;QAC5D,IAAI,OAAC,GAAG,EAAC,GAAG;QACZ,IAAI,OAAO,IAAI,CAAC,IAAI;QACpB,IAAI,cAAc,KAAK,OAAO,CAAC;QAC/B,IAAI,gBAAgB,IAClB,MAAM,IAAI,MAAM;QAGlB,IAAI,SAAS,aAAa,KAAK,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,aAAa,GACtF,CAAA,GAAA,UAAE,EAAE,IAAM,IAAI,CAAC,KAAK,CAAC,KAAK;QAG5B,IAAI,SAAS,aAAa,KAAK,IAAI,CAAC,IAAI,EACtC,MAAM,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;aACpB,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,aAAa,KAAK,SAAS,aAAa,CAAE,YAAY,CAAC,YAAY,OACzG,GAC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AoB,CAAE;QAChC,IAAI,QAAC,IAAI,QAAE,IAAI,mBAAE,eAAe,gBAAE,YAAY,EAAC,GAAG;QAClD,IAAI,CAAC,IAAI,GAAG;QACZ,IAAI,CAAC,gBAAgB,GAAG,mBAAmB;QAC3C,IAAI,CAAC,aAAa,GAAG;QACrB,IAAI,CAAC,KAAK,GAAG;QACb,oCAAoC;QACpC,IAAI,OAAO,CAAA,GAAA,aAAK,EAAE,MAAM,WAAW,CAAC;QACpC,IAAI,KAAK,YAAY,CAAC,YAAY,cAAc,MAC9C,IAAI,CAAC,KAAK,GAAG;IAEjB;AAkNF","sources":["packages/@react-aria/test-utils/src/tree.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {act, within} from '@testing-library/react';\nimport {BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts} from './types';\nimport {pressElement, triggerLongPress} from './events';\n\ninterface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {}\ninterface TreeToggleRowOpts extends ToggleGridRowOpts {}\ninterface TreeRowActionOpts extends GridRowActionOpts {}\n\n// TODO: this ended up being pretty much the same as gridlist, refactor so it extends from gridlist\nexport class TreeTester {\n private user;\n private _interactionType: UserOpts['interactionType'];\n private _advanceTimer: UserOpts['advanceTimer'];\n private _tree: HTMLElement;\n\n constructor(opts: TreeTesterOpts) {\n let {root, user, interactionType, advanceTimer} = opts;\n this.user = user;\n this._interactionType = interactionType || 'mouse';\n this._advanceTimer = advanceTimer;\n this._tree = root;\n // TODO: should all helpers do this?\n let tree = within(root).queryByRole('treegrid');\n if (root.getAttribute('role') !== 'treegrid' && tree) {\n this._tree = tree;\n }\n }\n\n /**\n * Set the interaction type used by the tree tester.\n */\n setInteractionType(type: UserOpts['interactionType']): void {\n this._interactionType = type;\n };\n\n /**\n * Returns a row matching the specified index or text content.\n */\n findRow(opts: {rowIndexOrText: number | string}): HTMLElement {\n let {\n rowIndexOrText\n } = opts;\n\n let row;\n if (typeof rowIndexOrText === 'number') {\n row = this.rows[rowIndexOrText];\n } else if (typeof rowIndexOrText === 'string') {\n row = (within(this.tree!).getByText(rowIndexOrText).closest('[role=row]'))! as HTMLElement;\n }\n\n return row;\n }\n\n // TODO: RTL\n private async keyboardNavigateToRow(opts: {row: HTMLElement}) {\n let {row} = opts;\n let rows = this.rows;\n let targetIndex = rows.indexOf(row);\n if (targetIndex === -1) {\n throw new Error('Option provided is not in the tree');\n }\n\n if (document.activeElement !== this._tree || !this._tree.contains(document.activeElement)) {\n act(() => this._tree.focus());\n }\n\n if (document.activeElement === this.tree) {\n await this.user.keyboard('[ArrowDown]');\n } else if (this._tree.contains(document.activeElement) && document.activeElement!.getAttribute('role') !== 'row') {\n do {\n await this.user.keyboard('[ArrowLeft]');\n } while (document.activeElement!.getAttribute('role') !== 'row');\n }\n let currIndex = rows.indexOf(document.activeElement as HTMLElement);\n if (currIndex === -1) {\n throw new Error('ActiveElement is not in the tree');\n }\n let direction = targetIndex > currIndex ? 'down' : 'up';\n\n for (let i = 0; i < Math.abs(targetIndex - currIndex); i++) {\n await this.user.keyboard(`[${direction === 'down' ? 'ArrowDown' : 'ArrowUp'}]`);\n }\n };\n\n /**\n * Toggles the selection for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowSelection(opts: TreeToggleRowOpts): Promise<void> {\n let {\n row,\n needsLongPress,\n checkboxSelection = true,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n let rowCheckbox = within(row).queryByRole('checkbox');\n\n // TODO: we early return here because the checkbox can't be keyboard navigated to if the row is disabled usually\n // but we may to check for disabledBehavior (aka if the disable row gets skipped when keyboard navigating or not)\n if (interactionType === 'keyboard' && (rowCheckbox?.getAttribute('disabled') === '' || row?.getAttribute('aria-disabled') === 'true')) {\n return;\n }\n\n // this would be better than the check to do nothing in events.ts\n // also, it'd be good to be able to trigger selection on the row instead of having to go to the checkbox directly\n if (interactionType === 'keyboard' && !checkboxSelection) {\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('{Space}');\n return;\n }\n if (rowCheckbox && checkboxSelection) {\n await pressElement(this.user, rowCheckbox, interactionType);\n } else {\n let cell = within(row).getAllByRole('gridcell')[0];\n if (needsLongPress && interactionType === 'touch') {\n if (this._advanceTimer == null) {\n throw new Error('No advanceTimers provided for long press.');\n }\n\n // Note that long press interactions with rows is strictly touch only for grid rows\n await triggerLongPress({element: cell, advanceTimer: this._advanceTimer, pointerOpts: {pointerType: 'touch'}});\n } else {\n await pressElement(this.user, cell, interactionType);\n }\n }\n };\n\n /**\n * Toggles the expansion for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async toggleRowExpansion(opts: TreeToggleExpansionOpts): Promise<void> {\n let {\n row,\n interactionType = this._interactionType\n } = opts;\n if (!this.tree.contains(document.activeElement)) {\n await act(async () => {\n this.tree.focus();\n });\n }\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n } else if (row.getAttribute('aria-expanded') == null) {\n throw new Error('Target row is not expandable.');\n }\n\n if (interactionType === 'mouse' || interactionType === 'touch') {\n let rowExpander = within(row).getAllByRole('button')[0]; // what happens if the button is not first? how can we differentiate?\n await pressElement(this.user, rowExpander, interactionType);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n await this.keyboardNavigateToRow({row});\n if (row.getAttribute('aria-expanded') === 'true') {\n await this.user.keyboard('[ArrowLeft]');\n } else {\n await this.user.keyboard('[ArrowRight]');\n }\n }\n };\n\n /**\n * Triggers the action for the specified tree row. Defaults to using the interaction type set on the tree tester.\n */\n async triggerRowAction(opts: TreeRowActionOpts): Promise<void> {\n let {\n row,\n needsDoubleClick,\n interactionType = this._interactionType\n } = opts;\n\n if (typeof row === 'string' || typeof row === 'number') {\n row = this.findRow({rowIndexOrText: row});\n }\n\n if (!row) {\n throw new Error('Target row not found in the tree.');\n }\n\n if (needsDoubleClick) {\n await this.user.dblClick(row);\n } else if (interactionType === 'keyboard') {\n if (row?.getAttribute('aria-disabled') === 'true') {\n return;\n }\n\n await this.keyboardNavigateToRow({row});\n await this.user.keyboard('[Enter]');\n } else {\n await pressElement(this.user, row, interactionType);\n }\n };\n\n /**\n * Returns the tree.\n */\n get tree(): HTMLElement {\n return this._tree;\n }\n\n /**\n * Returns the tree's rows if any.\n */\n get rows(): HTMLElement[] {\n return within(this?.tree).queryAllByRole('row');\n }\n\n /**\n * Returns the tree's selected rows if any.\n */\n get selectedRows(): HTMLElement[] {\n return this.rows.filter(row => row.getAttribute('aria-selected') === 'true');\n }\n\n /**\n * Returns the tree's cells if any. Can be filtered against a specific row if provided via `element`.\n */\n cells(opts: {element?: HTMLElement} = {}): HTMLElement[] {\n let {element = this.tree} = opts;\n return within(element).queryAllByRole('gridcell');\n }\n}\n"],"names":[],"version":3,"file":"tree.module.js.map"}
|
package/dist/types.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface UserOpts {
|
|
|
11
11
|
* A function used by the test utils to advance timers during interactions. Required for certain aria patterns (e.g. table). This can be overridden
|
|
12
12
|
* at the aria pattern tester level if needed.
|
|
13
13
|
*/
|
|
14
|
-
advanceTimer?: (time
|
|
14
|
+
advanceTimer?: (time: number) => unknown | Promise<unknown>;
|
|
15
15
|
}
|
|
16
16
|
interface BaseTesterOpts extends UserOpts {
|
|
17
17
|
/** @private */
|
|
@@ -48,6 +48,10 @@ interface MenuTesterOpts extends BaseTesterOpts {
|
|
|
48
48
|
* Whether the current menu is a submenu.
|
|
49
49
|
*/
|
|
50
50
|
isSubmenu?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The root menu of the menu tree. Only available if the menu is a submenu.
|
|
53
|
+
*/
|
|
54
|
+
rootMenu?: HTMLElement;
|
|
51
55
|
}
|
|
52
56
|
interface SelectTesterOpts extends BaseTesterOpts {
|
|
53
57
|
/**
|
|
@@ -111,7 +115,7 @@ interface GridRowActionOpts extends BaseGridRowInteractionOpts {
|
|
|
111
115
|
*/
|
|
112
116
|
export function triggerLongPress(opts: {
|
|
113
117
|
element: HTMLElement;
|
|
114
|
-
advanceTimer: (time
|
|
118
|
+
advanceTimer: (time: number) => unknown | Promise<unknown>;
|
|
115
119
|
pointerOpts?: Record<string, any>;
|
|
116
120
|
}): Promise<void>;
|
|
117
121
|
/**
|
|
@@ -457,6 +461,12 @@ interface TableToggleSortOpts {
|
|
|
457
461
|
*/
|
|
458
462
|
interactionType?: UserOpts['interactionType'];
|
|
459
463
|
}
|
|
464
|
+
interface TableColumnHeaderActionOpts extends TableToggleSortOpts {
|
|
465
|
+
/**
|
|
466
|
+
* The index of the column header action to trigger.
|
|
467
|
+
*/
|
|
468
|
+
action: number;
|
|
469
|
+
}
|
|
460
470
|
interface TableRowActionOpts extends GridRowActionOpts {
|
|
461
471
|
}
|
|
462
472
|
declare class TableTester {
|
|
@@ -473,6 +483,10 @@ declare class TableTester {
|
|
|
473
483
|
* Toggles the sort order for the specified table column. Defaults to using the interaction type set on the table tester.
|
|
474
484
|
*/
|
|
475
485
|
toggleSort(opts: TableToggleSortOpts): Promise<void>;
|
|
486
|
+
/**
|
|
487
|
+
* Triggers an action for the specified table column menu. Defaults to using the interaction type set on the table tester.
|
|
488
|
+
*/
|
|
489
|
+
triggerColumnHeaderAction(opts: TableColumnHeaderActionOpts): Promise<void>;
|
|
476
490
|
/**
|
|
477
491
|
* Triggers the action for the specified table row. Defaults to using the interaction type set on the table tester.
|
|
478
492
|
*/
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";AAaA,iBAAwB,KAAK,GAAG,KAAK,CAAC;AAItC;IACE;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAIjD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC1D;AAED,wBAAgC,SAAQ,QAAQ;IAC9C,eAAe;IACf,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,wFAAwF;IACxF,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,4BAAoC,SAAQ,cAAc;IACxD;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAA;CACtB;AAED,4BAAoC,SAAQ,cAAc;CAAG;AAE7D,2BAAmC,SAAQ,cAAc;IACvD;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;CACxC;AAED,wBAAgC,SAAQ,cAAc;IACpD;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB;AAED,0BAAkC,SAAQ,cAAc;IACtD;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,yBAAiC,SAAQ,cAAc;IACrD;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;CACxC;AAED,wBAAgC,SAAQ,cAAc;IACpD;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,wBAAgC,SAAQ,cAAc;IACpD;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;CACxC;AAED;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AC,SAAS,UAAU,GAAG,kBAAkB,GACzC,CAAC,SAAS,SAAS,GAAG,iBAAiB,GACvC,CAAC,SAAS,MAAM,GAAG,cAAc,GACjC,CAAC,SAAS,QAAQ,GAAG,gBAAgB,GACrC,CAAC,SAAS,OAAO,GAAG,eAAe,GACnC,CAAC,SAAS,MAAM,GAAG,cAAc,GACjC,CAAC,SAAS,MAAM,GAAG,cAAc,GACjC,KAAK,CAAC;AAIR;IAEE;;;;OAIG;IACH,eAAe,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC7C;;OAEG;IACH,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;gBAE3B,IAAI,GAAE,QAAa;IAO/B;;OAEG;IACH,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;CAGrF","sources":["packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/types.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/events.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/testSetup.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/userEventMaps.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/combobox.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/gridlist.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/listbox.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/menu.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/select.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/table.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/tabs.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/tree.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/user.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/index.ts","packages/@react-aria/test-utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {triggerLongPress} from './events';\nexport {installMouseEvent, installPointerEvent} from './testSetup';\nexport {pointerMap} from './userEventMaps';\nexport {User} from './user';\n\nexport type {UserOpts} from './types';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
1
|
+
{"mappings":";AAaA,iBAAwB,KAAK,GAAG,KAAK,CAAC;AAItC;IACE;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAIjD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC5D;AAED,wBAAgC,SAAQ,QAAQ;IAC9C,eAAe;IACf,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,wFAAwF;IACxF,IAAI,EAAE,WAAW,CAAA;CAClB;AAED,4BAAoC,SAAQ,cAAc;IACxD;;;OAGG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,WAAW,CAAA;CACtB;AAED,4BAAoC,SAAQ,cAAc;CAAG;AAE7D,2BAAmC,SAAQ,cAAc;IACvD;;OAEG;IACH,YAAY,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAA;CACxC;AAED,wBAAgC,SAAQ,cAAc;IACpD;;OAEG;IACH,IAAI,EAAE,WAAW,CAAC;IAClB;;OAEG;IACH,SAAS,C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,WAAW,GAC/B,CAAC,SAAS,MAAM,GAAG,UAAU,GAC7B,CAAC,SAAS,MAAM,GAAG,UAAU,GAC7B,KAAK,CAAC;AAER,gBAAgB,CAAC,IACf,CAAC,SAAS,UAAU,GAAG,kBAAkB,GACzC,CAAC,SAAS,UAAU,GAAG,kBAAkB,GACzC,CAAC,SAAS,SAAS,GAAG,iBAAiB,GACvC,CAAC,SAAS,MAAM,GAAG,cAAc,GACjC,CAAC,SAAS,QAAQ,GAAG,gBAAgB,GACrC,CAAC,SAAS,OAAO,GAAG,eAAe,GACnC,CAAC,SAAS,MAAM,GAAG,cAAc,GACjC,CAAC,SAAS,MAAM,GAAG,cAAc,GACjC,KAAK,CAAC;AAIR;IAEE;;;;OAIG;IACH,eAAe,EAAE,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAC7C;;OAEG;IACH,YAAY,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;gBAE3B,IAAI,GAAE,QAAa;IAO/B;;OAEG;IACH,YAAY,CAAC,CAAC,SAAS,YAAY,EAAE,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC;CAGrF","sources":["packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/types.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/events.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/testSetup.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/userEventMaps.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/combobox.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/gridlist.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/listbox.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/menu.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/select.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/table.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/tabs.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/tree.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/user.ts","packages/@react-aria/test-utils/src/packages/@react-aria/test-utils/src/index.ts","packages/@react-aria/test-utils/src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,"/*\n * Copyright 2023 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport {triggerLongPress} from './events';\nexport {installMouseEvent, installPointerEvent} from './testSetup';\nexport {pointerMap} from './userEventMaps';\nexport {User} from './user';\n\nexport type {UserOpts} from './types';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/dist/user.main.js
CHANGED
|
@@ -49,7 +49,7 @@ let $4168d511756883ff$var$keyToUtil = {
|
|
|
49
49
|
'Tabs': (0, $19633c03aff25ae5$exports.TabsTester),
|
|
50
50
|
'Tree': (0, $9c221bde173322ba$exports.TreeTester)
|
|
51
51
|
};
|
|
52
|
-
let $4168d511756883ff$var$defaultAdvanceTimer =
|
|
52
|
+
let $4168d511756883ff$var$defaultAdvanceTimer = (waitTime)=>new Promise((resolve)=>setTimeout(resolve, waitTime));
|
|
53
53
|
class $4168d511756883ff$export$1f44aaf2ec115b54 {
|
|
54
54
|
/**
|
|
55
55
|
* Creates an aria pattern tester, inheriting the options provided to the original user.
|
package/dist/user.main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,IAAI,kCAAY;IACd,UAA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],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ComboBoxTester} from './combobox';\nimport {\n ComboBoxTesterOpts,\n GridListTesterOpts,\n ListBoxTesterOpts,\n MenuTesterOpts,\n SelectTesterOpts,\n TableTesterOpts,\n TabsTesterOpts,\n TreeTesterOpts,\n UserOpts\n} from './types';\nimport {GridListTester} from './gridlist';\nimport {ListBoxTester} from './listbox';\nimport {MenuTester} from './menu';\nimport {pointerMap} from './';\nimport {SelectTester} from './select';\nimport {TableTester} from './table';\nimport {TabsTester} from './tabs';\nimport {TreeTester} from './tree';\nimport userEvent from '@testing-library/user-event';\n\nlet keyToUtil = {\n 'Select': SelectTester,\n 'Table': TableTester,\n 'Menu': MenuTester,\n 'ComboBox': ComboBoxTester,\n 'GridList': GridListTester,\n 'ListBox': ListBoxTester,\n 'Tabs': TabsTester,\n 'Tree': TreeTester\n} as const;\nexport type PatternNames = keyof typeof keyToUtil;\n\n// Conditional type: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html\ntype Tester<T> =\n T extends 'ComboBox' ? ComboBoxTester :\n T extends 'GridList' ? GridListTester :\n T extends 'ListBox' ? ListBoxTester :\n T extends 'Menu' ? MenuTester :\n T extends 'Select' ? SelectTester :\n T extends 'Table' ? TableTester :\n T extends 'Tabs' ? TabsTester :\n T extends 'Tree' ? TreeTester :\n never;\n\ntype TesterOpts<T> =\n T extends 'ComboBox' ? ComboBoxTesterOpts :\n T extends 'GridList' ? GridListTesterOpts :\n T extends 'ListBox' ? ListBoxTesterOpts :\n T extends 'Menu' ? MenuTesterOpts :\n T extends 'Select' ? SelectTesterOpts :\n T extends 'Table' ? TableTesterOpts :\n T extends 'Tabs' ? TabsTesterOpts :\n T extends 'Tree' ? TreeTesterOpts :\n never;\n\nlet defaultAdvanceTimer = (waitTime: number | undefined) => new Promise((resolve) => setTimeout(resolve, waitTime));\n\nexport class User {\n private user;\n /**\n * The interaction type (mouse, touch, keyboard) that the test util user will use when interacting with a component. This can be overridden\n * at the aria pattern util level if needed.\n * @default mouse\n */\n interactionType: UserOpts['interactionType'];\n /**\n * A function used by the test utils to advance timers during interactions. Required for certain aria patterns (e.g. table).\n */\n advanceTimer: UserOpts['advanceTimer'];\n\n constructor(opts: UserOpts = {}) {\n let {interactionType, advanceTimer} = opts;\n this.user = userEvent.setup({delay: null, pointerMap});\n this.interactionType = interactionType;\n this.advanceTimer = advanceTimer || defaultAdvanceTimer;\n }\n\n /**\n * Creates an aria pattern tester, inheriting the options provided to the original user.\n */\n createTester<T extends PatternNames>(patternName: T, opts: TesterOpts<T>): Tester<T> {\n return new (keyToUtil)[patternName]({interactionType: this.interactionType, advanceTimer: this.advanceTimer, ...opts, user: this.user}) as Tester<T>;\n }\n}\n"],"names":[],"version":3,"file":"user.main.js.map"}
|
package/dist/user.mjs
CHANGED
|
@@ -39,7 +39,7 @@ let $0d71b4e9cc4df40a$var$keyToUtil = {
|
|
|
39
39
|
'Tabs': (0, $e615c34a00448a49$export$f1539bff3fc7d485),
|
|
40
40
|
'Tree': (0, $962758aa2f16f1a4$export$4445864b14128396)
|
|
41
41
|
};
|
|
42
|
-
let $0d71b4e9cc4df40a$var$defaultAdvanceTimer =
|
|
42
|
+
let $0d71b4e9cc4df40a$var$defaultAdvanceTimer = (waitTime)=>new Promise((resolve)=>setTimeout(resolve, waitTime));
|
|
43
43
|
class $0d71b4e9cc4df40a$export$1f44aaf2ec115b54 {
|
|
44
44
|
/**
|
|
45
45
|
* Creates an aria pattern tester, inheriting the options provided to the original user.
|
package/dist/user.module.js
CHANGED
|
@@ -39,7 +39,7 @@ let $0d71b4e9cc4df40a$var$keyToUtil = {
|
|
|
39
39
|
'Tabs': (0, $e615c34a00448a49$export$f1539bff3fc7d485),
|
|
40
40
|
'Tree': (0, $962758aa2f16f1a4$export$4445864b14128396)
|
|
41
41
|
};
|
|
42
|
-
let $0d71b4e9cc4df40a$var$defaultAdvanceTimer =
|
|
42
|
+
let $0d71b4e9cc4df40a$var$defaultAdvanceTimer = (waitTime)=>new Promise((resolve)=>setTimeout(resolve, waitTime));
|
|
43
43
|
class $0d71b4e9cc4df40a$export$1f44aaf2ec115b54 {
|
|
44
44
|
/**
|
|
45
45
|
* Creates an aria pattern tester, inheriting the options provided to the original user.
|
package/dist/user.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,IAAI,kCAAY;IACd,UAAU,CAAA,GAAA,yCAAW;IACrB,SAAS,CAAA,GAAA,wCAAU;IACnB,QAAQ,CAAA,GAAA,yCAAS;IACjB,YAAY,CAAA,GAAA,yCAAa;IACzB,YAAY,CAAA,GAAA,yCAAa;IACzB,WAAW,CAAA,GAAA,yCAAY;IACvB,QAAQ,CAAA,GAAA,yCAAS;IACjB,QAAQ,CAAA,GAAA,yCAAS;AACnB;AA0BA,IAAI,4CAAsB,
|
|
1
|
+
{"mappings":";;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;;AAwBD,IAAI,kCAAY;IACd,UAAU,CAAA,GAAA,yCAAW;IACrB,SAAS,CAAA,GAAA,wCAAU;IACnB,QAAQ,CAAA,GAAA,yCAAS;IACjB,YAAY,CAAA,GAAA,yCAAa;IACzB,YAAY,CAAA,GAAA,yCAAa;IACzB,WAAW,CAAA,GAAA,yCAAY;IACvB,QAAQ,CAAA,GAAA,yCAAS;IACjB,QAAQ,CAAA,GAAA,yCAAS;AACnB;AA0BA,IAAI,4CAAsB,CAAC,WAAiC,IAAI,QAAQ,CAAC,UAAY,WAAW,SAAS;AAElG,MAAM;IAoBX;;GAEC,GACD,aAAqC,WAAc,EAAE,IAAmB,EAAa;QACnF,OAAO,IAAI,AAAC,+BAAU,CAAC,YAAY,CAAC;YAAC,iBAAiB,IAAI,CAAC,eAAe;YAAE,cAAc,IAAI,CAAC,YAAY;YAAE,GAAG,IAAI;YAAE,MAAM,IAAI,CAAC,IAAI;QAAA;IACvI;IAZA,YAAY,OAAiB,CAAC,CAAC,CAAE;QAC/B,IAAI,mBAAC,eAAe,gBAAE,YAAY,EAAC,GAAG;QACtC,IAAI,CAAC,IAAI,GAAG,CAAA,GAAA,8BAAQ,EAAE,KAAK,CAAC;YAAC,OAAO;wBAAM;QAAU;QACpD,IAAI,CAAC,eAAe,GAAG;QACvB,IAAI,CAAC,YAAY,GAAG,gBAAgB;IACtC;AAQF","sources":["packages/@react-aria/test-utils/src/user.ts"],"sourcesContent":["/*\n * Copyright 2024 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {ComboBoxTester} from './combobox';\nimport {\n ComboBoxTesterOpts,\n GridListTesterOpts,\n ListBoxTesterOpts,\n MenuTesterOpts,\n SelectTesterOpts,\n TableTesterOpts,\n TabsTesterOpts,\n TreeTesterOpts,\n UserOpts\n} from './types';\nimport {GridListTester} from './gridlist';\nimport {ListBoxTester} from './listbox';\nimport {MenuTester} from './menu';\nimport {pointerMap} from './';\nimport {SelectTester} from './select';\nimport {TableTester} from './table';\nimport {TabsTester} from './tabs';\nimport {TreeTester} from './tree';\nimport userEvent from '@testing-library/user-event';\n\nlet keyToUtil = {\n 'Select': SelectTester,\n 'Table': TableTester,\n 'Menu': MenuTester,\n 'ComboBox': ComboBoxTester,\n 'GridList': GridListTester,\n 'ListBox': ListBoxTester,\n 'Tabs': TabsTester,\n 'Tree': TreeTester\n} as const;\nexport type PatternNames = keyof typeof keyToUtil;\n\n// Conditional type: https://www.typescriptlang.org/docs/handbook/2/conditional-types.html\ntype Tester<T> =\n T extends 'ComboBox' ? ComboBoxTester :\n T extends 'GridList' ? GridListTester :\n T extends 'ListBox' ? ListBoxTester :\n T extends 'Menu' ? MenuTester :\n T extends 'Select' ? SelectTester :\n T extends 'Table' ? TableTester :\n T extends 'Tabs' ? TabsTester :\n T extends 'Tree' ? TreeTester :\n never;\n\ntype TesterOpts<T> =\n T extends 'ComboBox' ? ComboBoxTesterOpts :\n T extends 'GridList' ? GridListTesterOpts :\n T extends 'ListBox' ? ListBoxTesterOpts :\n T extends 'Menu' ? MenuTesterOpts :\n T extends 'Select' ? SelectTesterOpts :\n T extends 'Table' ? TableTesterOpts :\n T extends 'Tabs' ? TabsTesterOpts :\n T extends 'Tree' ? TreeTesterOpts :\n never;\n\nlet defaultAdvanceTimer = (waitTime: number | undefined) => new Promise((resolve) => setTimeout(resolve, waitTime));\n\nexport class User {\n private user;\n /**\n * The interaction type (mouse, touch, keyboard) that the test util user will use when interacting with a component. This can be overridden\n * at the aria pattern util level if needed.\n * @default mouse\n */\n interactionType: UserOpts['interactionType'];\n /**\n * A function used by the test utils to advance timers during interactions. Required for certain aria patterns (e.g. table).\n */\n advanceTimer: UserOpts['advanceTimer'];\n\n constructor(opts: UserOpts = {}) {\n let {interactionType, advanceTimer} = opts;\n this.user = userEvent.setup({delay: null, pointerMap});\n this.interactionType = interactionType;\n this.advanceTimer = advanceTimer || defaultAdvanceTimer;\n }\n\n /**\n * Creates an aria pattern tester, inheriting the options provided to the original user.\n */\n createTester<T extends PatternNames>(patternName: T, opts: TesterOpts<T>): Tester<T> {\n return new (keyToUtil)[patternName]({interactionType: this.interactionType, advanceTimer: this.advanceTimer, ...opts, user: this.user}) as Tester<T>;\n }\n}\n"],"names":[],"version":3,"file":"user.module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/test-utils",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.7",
|
|
4
4
|
"description": "Testing utils for react-aria patterns",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"@swc/helpers": "^0.5.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@testing-library/react": "^
|
|
28
|
+
"@testing-library/react": "^16.0.0",
|
|
29
29
|
"@testing-library/user-event": "^14.0.0",
|
|
30
|
-
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
30
|
+
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
31
|
+
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
31
32
|
},
|
|
32
33
|
"publishConfig": {
|
|
33
34
|
"access": "public"
|
|
34
35
|
},
|
|
35
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "9c77d4e8267ed39469c65f65da94ece7be509874"
|
|
36
37
|
}
|
package/src/combobox.ts
CHANGED
|
@@ -69,14 +69,14 @@ export class ComboBoxTester {
|
|
|
69
69
|
/**
|
|
70
70
|
* Set the interaction type used by the combobox tester.
|
|
71
71
|
*/
|
|
72
|
-
setInteractionType(type: UserOpts['interactionType']) {
|
|
72
|
+
setInteractionType(type: UserOpts['interactionType']): void {
|
|
73
73
|
this._interactionType = type;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
/**
|
|
77
77
|
* Opens the combobox dropdown. Defaults to using the interaction type set on the combobox tester.
|
|
78
78
|
*/
|
|
79
|
-
async open(opts: ComboBoxOpenOpts = {}) {
|
|
79
|
+
async open(opts: ComboBoxOpenOpts = {}): Promise<void> {
|
|
80
80
|
let {triggerBehavior = 'manual', interactionType = this._interactionType} = opts;
|
|
81
81
|
let trigger = this.trigger;
|
|
82
82
|
let combobox = this.combobox;
|
|
@@ -143,7 +143,7 @@ export class ComboBoxTester {
|
|
|
143
143
|
* Selects the desired combobox option. Defaults to using the interaction type set on the combobox tester. If necessary, will open the combobox dropdown beforehand.
|
|
144
144
|
* The desired option can be targeted via the option's node, the option's text, or the option's index.
|
|
145
145
|
*/
|
|
146
|
-
async selectOption(opts: ComboBoxSelectOpts) {
|
|
146
|
+
async selectOption(opts: ComboBoxSelectOpts): Promise<void> {
|
|
147
147
|
let {option, triggerBehavior, interactionType = this._interactionType} = opts;
|
|
148
148
|
if (!this.combobox.getAttribute('aria-controls')) {
|
|
149
149
|
await this.open({triggerBehavior});
|
|
@@ -188,7 +188,7 @@ export class ComboBoxTester {
|
|
|
188
188
|
/**
|
|
189
189
|
* Closes the combobox dropdown.
|
|
190
190
|
*/
|
|
191
|
-
async close() {
|
|
191
|
+
async close(): Promise<void> {
|
|
192
192
|
let listbox = this.listbox;
|
|
193
193
|
if (listbox) {
|
|
194
194
|
act(() => this.combobox.focus());
|
package/src/events.ts
CHANGED
|
@@ -22,7 +22,7 @@ export const DEFAULT_LONG_PRESS_TIME = 500;
|
|
|
22
22
|
* @param opts.advanceTimer - Function that when called advances the timers in your test suite by a specific amount of time(ms).
|
|
23
23
|
* @param opts.pointeropts - Options to pass to the simulated event. Defaults to mouse. See https://testing-library.com/docs/dom-testing-library/api-events/#fireevent for more info.
|
|
24
24
|
*/
|
|
25
|
-
export async function triggerLongPress(opts: {element: HTMLElement, advanceTimer: (time
|
|
25
|
+
export async function triggerLongPress(opts: {element: HTMLElement, advanceTimer: (time: number) => unknown | Promise<unknown>, pointerOpts?: Record<string, any>}): Promise<void> {
|
|
26
26
|
// TODO: note that this only works if the code from installPointerEvent is called somewhere in the test BEFORE the
|
|
27
27
|
// render. Perhaps we should rely on the user setting that up since I'm not sure there is a great way to set that up here in the
|
|
28
28
|
// util before first render. Will need to document it well
|
|
@@ -57,8 +57,8 @@ export async function triggerLongPress(opts: {element: HTMLElement, advanceTimer
|
|
|
57
57
|
fireEvent.click(element, {detail: 1, ...pointerOpts});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
|
|
61
|
-
export async function pressElement(user, element: HTMLElement, interactionType: UserOpts['interactionType']) {
|
|
60
|
+
// Docs cannot handle the types that userEvent actually declares, so hopefully this sub set is okay
|
|
61
|
+
export async function pressElement(user: {click: (element: Element) => Promise<void>, keyboard: (keys: string) => Promise<void>, pointer: (opts: {target: Element, keys: string}) => Promise<void>}, element: HTMLElement, interactionType: UserOpts['interactionType']): Promise<void> {
|
|
62
62
|
if (interactionType === 'mouse') {
|
|
63
63
|
await user.click(element);
|
|
64
64
|
} else if (interactionType === 'keyboard') {
|
package/src/gridlist.ts
CHANGED
|
@@ -34,7 +34,7 @@ export class GridListTester {
|
|
|
34
34
|
/**
|
|
35
35
|
* Set the interaction type used by the gridlist tester.
|
|
36
36
|
*/
|
|
37
|
-
setInteractionType(type: UserOpts['interactionType']) {
|
|
37
|
+
setInteractionType(type: UserOpts['interactionType']): void {
|
|
38
38
|
this._interactionType = type;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -64,6 +64,11 @@ export class GridListTester {
|
|
|
64
64
|
if (targetIndex === -1) {
|
|
65
65
|
throw new Error('Option provided is not in the gridlist');
|
|
66
66
|
}
|
|
67
|
+
|
|
68
|
+
if (document.activeElement !== this._gridlist || !this._gridlist.contains(document.activeElement)) {
|
|
69
|
+
act(() => this._gridlist.focus());
|
|
70
|
+
}
|
|
71
|
+
|
|
67
72
|
if (document.activeElement === this._gridlist) {
|
|
68
73
|
await this.user.keyboard('[ArrowDown]');
|
|
69
74
|
} else if (this._gridlist.contains(document.activeElement) && document.activeElement!.getAttribute('role') !== 'row') {
|
|
@@ -85,7 +90,7 @@ export class GridListTester {
|
|
|
85
90
|
/**
|
|
86
91
|
* Toggles the selection for the specified gridlist row. Defaults to using the interaction type set on the gridlist tester.
|
|
87
92
|
*/
|
|
88
|
-
async toggleRowSelection(opts: GridListToggleRowOpts) {
|
|
93
|
+
async toggleRowSelection(opts: GridListToggleRowOpts): Promise<void> {
|
|
89
94
|
let {
|
|
90
95
|
row,
|
|
91
96
|
needsLongPress,
|
|
@@ -139,7 +144,7 @@ export class GridListTester {
|
|
|
139
144
|
/**
|
|
140
145
|
* Triggers the action for the specified gridlist row. Defaults to using the interaction type set on the gridlist tester.
|
|
141
146
|
*/
|
|
142
|
-
async triggerRowAction(opts: GridListRowActionOpts) {
|
|
147
|
+
async triggerRowAction(opts: GridListRowActionOpts): Promise<void> {
|
|
143
148
|
let {
|
|
144
149
|
row,
|
|
145
150
|
needsDoubleClick,
|
|
@@ -161,10 +166,6 @@ export class GridListTester {
|
|
|
161
166
|
return;
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
if (document.activeElement !== this._gridlist || !this._gridlist.contains(document.activeElement)) {
|
|
165
|
-
act(() => this._gridlist.focus());
|
|
166
|
-
}
|
|
167
|
-
|
|
168
169
|
await this.keyboardNavigateToRow({row});
|
|
169
170
|
await this.user.keyboard('[Enter]');
|
|
170
171
|
} else {
|
package/src/listbox.ts
CHANGED
|
@@ -58,7 +58,7 @@ export class ListBoxTester {
|
|
|
58
58
|
/**
|
|
59
59
|
* Set the interaction type used by the listbox tester.
|
|
60
60
|
*/
|
|
61
|
-
setInteractionType(type: UserOpts['interactionType']) {
|
|
61
|
+
setInteractionType(type: UserOpts['interactionType']): void {
|
|
62
62
|
this._interactionType = type;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -93,10 +93,12 @@ export class ListBoxTester {
|
|
|
93
93
|
throw new Error('Option provided is not in the listbox');
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
if (document.activeElement
|
|
97
|
-
|
|
96
|
+
if (document.activeElement !== this._listbox || !this._listbox.contains(document.activeElement)) {
|
|
97
|
+
act(() => this._listbox.focus());
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
await this.user.keyboard('[ArrowDown]');
|
|
101
|
+
|
|
100
102
|
// TODO: not sure about doing same while loop that exists in other implementations of keyboardNavigateToOption,
|
|
101
103
|
// feels like it could break easily
|
|
102
104
|
if (document.activeElement?.getAttribute('role') !== 'option') {
|
|
@@ -119,7 +121,7 @@ export class ListBoxTester {
|
|
|
119
121
|
/**
|
|
120
122
|
* Toggles the selection for the specified listbox option. Defaults to using the interaction type set on the listbox tester.
|
|
121
123
|
*/
|
|
122
|
-
async toggleOptionSelection(opts: ListBoxToggleOptionOpts) {
|
|
124
|
+
async toggleOptionSelection(opts: ListBoxToggleOptionOpts): Promise<void> {
|
|
123
125
|
let {option, needsLongPress, keyboardActivation = 'Enter', interactionType = this._interactionType} = opts;
|
|
124
126
|
|
|
125
127
|
if (typeof option === 'string' || typeof option === 'number') {
|
|
@@ -135,10 +137,6 @@ export class ListBoxTester {
|
|
|
135
137
|
return;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
if (document.activeElement !== this._listbox || !this._listbox.contains(document.activeElement)) {
|
|
139
|
-
act(() => this._listbox.focus());
|
|
140
|
-
}
|
|
141
|
-
|
|
142
140
|
await this.keyboardNavigateToOption({option});
|
|
143
141
|
await this.user.keyboard(`[${keyboardActivation}]`);
|
|
144
142
|
} else {
|
|
@@ -157,7 +155,7 @@ export class ListBoxTester {
|
|
|
157
155
|
/**
|
|
158
156
|
* Triggers the action for the specified listbox option. Defaults to using the interaction type set on the listbox tester.
|
|
159
157
|
*/
|
|
160
|
-
async triggerOptionAction(opts: ListBoxOptionActionOpts) {
|
|
158
|
+
async triggerOptionAction(opts: ListBoxOptionActionOpts): Promise<void> {
|
|
161
159
|
let {
|
|
162
160
|
option,
|
|
163
161
|
needsDoubleClick,
|
|
@@ -179,10 +177,6 @@ export class ListBoxTester {
|
|
|
179
177
|
return;
|
|
180
178
|
}
|
|
181
179
|
|
|
182
|
-
if (document.activeElement !== this._listbox || !this._listbox.contains(document.activeElement)) {
|
|
183
|
-
act(() => this._listbox.focus());
|
|
184
|
-
}
|
|
185
|
-
|
|
186
180
|
await this.keyboardNavigateToOption({option});
|
|
187
181
|
await this.user.keyboard('[Enter]');
|
|
188
182
|
} else {
|