-
Notifications
You must be signed in to change notification settings - Fork 1.4k
docs: Testing docs #9164
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
docs: Testing docs #9164
Changes from 46 commits
edeaa2f
8a1f97e
28eb788
457c59a
a15c24f
819c076
3b991ea
42b0406
36f1a6f
e2b29c9
4c94cd0
83262ef
5d2b172
980d3d6
59e9400
a414886
0b2751d
4ef4996
b04b7af
807beb0
68a66e0
432f702
78fb92b
620ebd7
6fdf671
c051a8c
159e76b
50c9e07
5a10ff0
5b9fda5
6db86ef
0c6ac3f
a3d57a9
30bab22
44b0d8d
5084b6b
34ad8cc
6bf1724
6e508f2
73626ea
e799a04
f8ec2fb
4b38f98
2e13868
6f69d9e
cad6874
10d231d
2189b24
e2a12f3
c1833f4
27bd54a
1bd0429
ec28c4a
5ce4479
e5ee79d
26d9594
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,66 @@ | ||||||||||||||||||||
| import {Layout} from '../../../src/Layout'; | ||||||||||||||||||||
| export default Layout; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| import {InlineAlert, Heading, Content} from '@react-spectrum/s2'; | ||||||||||||||||||||
| import testUtilDocs from 'docs:@react-aria/test-utils'; | ||||||||||||||||||||
| import {InstallCommand} from '../../../src/InstallCommand'; | ||||||||||||||||||||
| import {PatternTestingFAQ} from '../../../src/PatternTestingFAQ'; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| export const isSubpage = true; | ||||||||||||||||||||
| export const tags = ['testing', 'checkboxgroup', 'test-utils']; | ||||||||||||||||||||
| export const description = 'Testing CheckboxGroup with React Aria test utils'; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| # Testing CheckboxGroup | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ## Test utils | ||||||||||||||||||||
|
|
||||||||||||||||||||
| `@react-aria/test-utils` offers common checkbox group interaction utilities which you may find helpful when writing tests. To install, simply | ||||||||||||||||||||
| add it to your dev dependencies via your preferred package manager. | ||||||||||||||||||||
|
||||||||||||||||||||
| `@react-aria/test-utils` offers common checkbox group interaction utilities which you may find helpful when writing tests. To install, simply | |
| add it to your dev dependencies via your preferred package manager. | |
| `@react-aria/test-utils` offers common checkbox group interaction testing utilities. Install it with your preferred package manager. |
Outdated
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.
| Once installed, you can access the `User` that `@react-aria/test-utils` provides in your test file as shown below. This user only needs to be initialized once and then can be used to generate | |
| the `CheckboxGroup` tester in your test cases. This gives you access to `CheckboxGroup` specific utilities that you can then call within your test to query for specific subcomponents or simulate common interactions. | |
| The example test case below shows how you might go about setting up the `CheckboxGroup` tester, use it to simulate checkbox selection, and verify the checkbox group's state after each interaction. | |
| Initialize a `User` object at the top of your test file, and use it to create a `CheckboxGroup` tester in your test cases. The tester has methods that you can call within your test to query for specific subcomponents or simulate common interactions. |
Outdated
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.
| let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime}); | |
| let testUtilUser = new User({ | |
| interactionType: 'mouse', | |
| advanceTimer: jest.advanceTimersByTime | |
| }); |
Outdated
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.
| See below for the full definition of the `User` and the `CheckboxGroup` tester. | |
| ## API |
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.
| <ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.User} /> | |
| <ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.CheckboxGroupTester} /> | |
| ### User | |
| <ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.User} /> | |
| ### CheckboxGroupTester | |
| <ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.CheckboxGroupTester} /> |
also do we need to repeat the User API on each test page? People can also refer to it in the testing guide if needed.
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.
thats true but I felt it would be easier to have the information on each page so people didn't have to switch back and forth or if they found these testing pages via the search first
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.
OK. I do think we need the headings above the ClassAPIs. It's difficult to tell what the APIs are for on the rendered page, or that there's two different ones.
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.
Do we want this repeated on each page or added to the testing guide?
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.
same reasoning as the above, figured having all the info available on each page would help with discoverability
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.
this won't have been released yet either, does that matter?
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.
yeah this I'm not going to put into the docs deploy. But in the final release these new testers will be made available so I'll merge that in then