-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Initial aria test util docs and listbox/tabs/tree utils #7145
base: main
Are you sure you want to change the base?
Conversation
category: Concepts | ||
--- | ||
|
||
# Testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually this testing page will have more than just documenting the aria test utils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
open to any suggestion as to the structure of this page and how in-depth the documentation should be. I figure it is easier and clearer to document each individual tester api in the RAC/RSP component page itself but happy to field opinions
|
||
See below for the full definition of the `User` object. | ||
|
||
<ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.User} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | ||
* The index of the row to toggle selection for. | ||
*/ | ||
index?: number, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if an index isn't supplied?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if it's either text OR index, maybe overloads would be more suitable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'll give overloads a shot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to instead unify index/label selection into a single option along with allowing users to directly provide a node as well. Felt simpler to do
TODO: JSDOCs |
using a single unified option for simplicity
* adding listbox test utils and clean up of other utils * check that util works in tests * add docs * test listbox util get options section scoping * tabs test utils * add tests for tab test utils * add docs for tabs testing * update jsdoc and adding version badge * pulling in tree utils from s2-treeview branch modified some of the utils for consistency, but otherwise kept most of it the same. Changes to be discussed * update docs and use the utils in the spectrum tests * making things more consistent * fix tests temporarily * fix keyboard navigation if row is disabled
## API Changes
@react-aria/test-utils/@react-aria/test-utils:User User {
advanceTimer: UserOpts['advanceTimer']
constructor: (UserOpts) => void
- createTester: (T, ObjectOptionsTypes<T>) => ObjectType<T>
- interactionType: UserOpts['interactionType']
- user: any
+ createTester: (T, TesterOpts<T>) => Tester<T>
+ interactionType: UserOpts['interactionType'] = mouse
} /@react-aria/test-utils:UserOpts UserOpts {
advanceTimer?: (number) => void | Promise<unknown>
- interactionType?: 'mouse' | 'touch' | 'keyboard'
+ interactionType?: 'mouse' | 'touch' | 'keyboard' = mouse
} @react-spectrum/test-utils/@react-spectrum/test-utils:User User {
advanceTimer: UserOpts['advanceTimer']
constructor: (UserOpts) => void
- createTester: (T, ObjectOptionsTypes<T>) => ObjectType<T>
- interactionType: UserOpts['interactionType']
- user: any
+ createTester: (T, TesterOpts<T>) => Tester<T>
+ interactionType: UserOpts['interactionType'] = mouse
} /@react-spectrum/test-utils:UserOpts UserOpts {
advanceTimer?: (number) => void | Promise<unknown>
- interactionType?: 'mouse' | 'touch' | 'keyboard'
+ interactionType?: 'mouse' | 'touch' | 'keyboard' = mouse
} |
If you want to look at the new utils aka tabs/listbox/tree (thanks @snowystinger!) more closely feel free to look at #7505. That PR also had a bunch of consistency updates and stuff so I just merged it in |
Closes
✅ Pull Request Checklist:
📝 Test Instructions:
🧢 Your Project:
RSP