Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
edeaa2f
add FAQ and other sections
LFDanLu Oct 23, 2025
8a1f97e
add section for creating custom components
LFDanLu Oct 23, 2025
28eb788
initial stab at extracting types from style macro
LFDanLu Oct 24, 2025
457c59a
testing sizing properties
LFDanLu Oct 24, 2025
a15c24f
Merge branch 'main' of github.com:adobe/react-spectrum into reference…
LFDanLu Oct 24, 2025
819c076
revert export of theme object since it was breaking inference
LFDanLu Oct 24, 2025
3b991ea
adding more values
LFDanLu Oct 28, 2025
42b0406
reorg
LFDanLu Oct 28, 2025
36f1a6f
add the rest of the properties and double check them
LFDanLu Oct 28, 2025
e2b29c9
add more type links
LFDanLu Oct 28, 2025
4c94cd0
add mdn links for common types and specific css properties
LFDanLu Oct 29, 2025
83262ef
add relative links so basecolors and various dimension strings link b…
LFDanLu Oct 29, 2025
5d2b172
add descriptions to table and get rid of unessasary isRelative
LFDanLu Oct 30, 2025
980d3d6
add short hand and condition tables
LFDanLu Oct 30, 2025
59e9400
add subpage for reference and advanced style macro section
LFDanLu Oct 30, 2025
a414886
support subpage list under the ToC
LFDanLu Oct 31, 2025
0b2751d
forgot to move last bit of content
LFDanLu Oct 31, 2025
4ef4996
update FAQ, add mobile related pages, link from RAC styling
LFDanLu Oct 31, 2025
b04b7af
Merge branch 'main' of github.com:adobe/react-spectrum into style_mac…
LFDanLu Oct 31, 2025
807beb0
fix mobile styling
LFDanLu Oct 31, 2025
68a66e0
initial react aria testing docs
LFDanLu Oct 13, 2025
432f702
pare down content for readability
LFDanLu Oct 13, 2025
78fb92b
adding S2 testing docs
LFDanLu Oct 13, 2025
620ebd7
add sample subpage content
LFDanLu Oct 21, 2025
6fdf671
add style for blockquote
LFDanLu Oct 21, 2025
c051a8c
add new test util docs to old website
LFDanLu Oct 24, 2025
159e76b
add examples to new docs
LFDanLu Oct 24, 2025
50c9e07
clean up old code, no more switcher
LFDanLu Oct 31, 2025
5a10ff0
refactor test util content so it is in each page
LFDanLu Oct 31, 2025
5b9fda5
debug why subpage why failing
LFDanLu Oct 31, 2025
6db86ef
move to subpages
LFDanLu Nov 1, 2025
0c6ac3f
review comments
LFDanLu Nov 3, 2025
a3d57a9
fix build links?
LFDanLu Nov 3, 2025
30bab22
rename mdx file to fix all links
LFDanLu Nov 3, 2025
44b0d8d
Merge branch 'main' of github.com:adobe/react-spectrum into style_mac…
LFDanLu Nov 3, 2025
5084b6b
small fixes
LFDanLu Nov 3, 2025
34ad8cc
move reference out of subpage and merge styling page
LFDanLu Nov 3, 2025
6bf1724
make icons page lowercase and fix shorthands link
LFDanLu Nov 4, 2025
6e508f2
whoops forgot to make git track the capitalization rename
LFDanLu Nov 4, 2025
73626ea
Merge branch 'style_macro_docs' of github.com:adobe/react-spectrum in…
LFDanLu Nov 4, 2025
e799a04
use isSubPage and update to detect parent link
LFDanLu Nov 4, 2025
f8ec2fb
export only the type
LFDanLu Nov 4, 2025
4b38f98
addressing feedback from quarry team
LFDanLu Nov 4, 2025
2e13868
Merge branch 'main' of github.com:adobe/react-spectrum into style_mac…
LFDanLu Nov 4, 2025
6f69d9e
Merge branch 'style_macro_docs' of github.com:adobe/react-spectrum in…
LFDanLu Nov 4, 2025
cad6874
update subpage back button logic
LFDanLu Nov 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/@react-aria/test-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,16 @@ export {triggerLongPress} from './events';
export {installMouseEvent, installPointerEvent} from './testSetup';
export {pointerMap} from './userEventMaps';
export {User} from './user';
export type {CheckboxGroupTester} from './checkboxgroup';
Copy link
Member

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?

Copy link
Member Author

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

export type {ComboBoxTester} from './combobox';
export type {DialogTester} from './dialog';
export type {GridListTester} from './gridlist';
export type {ListBoxTester} from './listbox';
export type {MenuTester} from './menu';
export type {RadioGroupTester} from './radiogroup';
export type {SelectTester} from './select';
export type {TableTester} from './table';
export type {TabsTester} from './tabs';
export type {TreeTester} from './tree';

export type {UserOpts} from './types';
43 changes: 42 additions & 1 deletion packages/@react-spectrum/checkbox/docs/CheckboxGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {Layout} from '@react-spectrum/docs';
export default Layout;

import docs from 'docs:@react-spectrum/checkbox';
import checkboxgroupUtil from 'docs:@react-aria/test-utils/src/checkboxgroup.ts';
import packageData from '@react-spectrum/checkbox/package.json';
import {HeaderInfo, PropTable, PageDescription} from '@react-spectrum/docs';
import {HeaderInfo, PropTable, PageDescription, VersionBadge, ClassAPI} from '@react-spectrum/docs';

```jsx import
import {Checkbox, CheckboxGroup} from '@react-spectrum/checkbox';
Expand Down Expand Up @@ -332,3 +333,43 @@ See the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/
<Checkbox value="basketball">Basketball</Checkbox>
</CheckboxGroup>
```

## Testing

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common checkbox group interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the checkbox group tester and a sample of how you could use it in your test suite.

```ts
// CheckboxGroup.test.ts
import {render} from '@testing-library/react';
import {theme} from '@react-spectrum/theme-default';
import {User} from '@react-spectrum/test-utils';

let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime});
// ...

it('CheckboxGroup can select multiple checkboxes', async function () {
// Render your test component/app and initialize the checkbox group tester
let {getByTestId} = render(
<Provider theme={defaultTheme}>
<CheckboxGroup data-testid="test-checkboxgroup">
...
</CheckboxGroup>
</Provider>
);
let checkboxGroupTester = testUtilUser.createTester('CheckboxGroup', {root: getByTestId('test-checkboxgroup')});
expect(checkboxGroupTester.selectedCheckboxes).toHaveLength(0);

await checkboxGroupTester.toggleCheckbox({checkbox: 0});
expect(checkboxGroupTester.checkboxes[0]).toBeChecked();
expect(checkboxGroupTester.selectedCheckboxes).toHaveLength(1);

await checkboxGroupTester.toggleCheckbox({checkbox: 4});
expect(checkboxGroupTester.checkboxes[4]).toBeChecked();
expect(checkboxGroupTester.selectedCheckboxes).toHaveLength(2);
});
```

<ClassAPI links={checkboxgroupUtil.links} class={checkboxgroupUtil.exports.CheckboxGroupTester} />
2 changes: 1 addition & 1 deletion packages/@react-spectrum/combobox/docs/ComboBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -996,7 +996,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common combobox interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common combobox interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the combobox tester and a sample of how you could use it in your test suite.

```ts
Expand Down
43 changes: 42 additions & 1 deletion packages/@react-spectrum/dialog/docs/Dialog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export default Layout;

import DialogAnatomy from './images/DialogAnatomy.svg';
import docs from 'docs:@react-spectrum/dialog';
import {Image, HeaderInfo, PropTable, PageDescription} from '@react-spectrum/docs';
import dialogUtil from 'docs:@react-aria/test-utils/src/dialog.ts';
import {Image, HeaderInfo, PropTable, PageDescription, VersionBadge, ClassAPI} from '@react-spectrum/docs';
import packageData from '@react-spectrum/dialog/package.json';
import styles from '@react-spectrum/docs/src/docs.css';

Expand Down Expand Up @@ -398,3 +399,43 @@ respectively for container sizing considerations. Modal sizes on mobile devices
)}
</DialogTrigger>
```

## Testing

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common dialog interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the dialog tester and a sample of how you could use it in your test suite.

```ts
// Dialog.test.ts
import {render} from '@testing-library/react';
import {theme} from '@react-spectrum/theme-default';
import {User} from '@react-spectrum/test-utils';

let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime});
// ...

it('Dialog can be opened and closed', async function () {
// Render your test component/app and initialize the dialog tester
let {getByTestId, getByRole} = render(
<Provider theme={defaultTheme}>
<DialogTrigger>
<ActionButton>Trigger</ActionButton>
<Dialog>
...
</Dialog>
</DialogTrigger>
</Provider>
);
let button = getByRole('button');
let dialogTester = testUtilUser.createTester('Dialog', {root: button, overlayType: 'modal'});
await dialogTester.open();
let dialog = dialogTester.dialog;
expect(dialog).toBeVisible();
await dialogTester.close();
expect(dialog).not.toBeInTheDocument();
});
```

<ClassAPI links={dialogUtil.links} class={dialogUtil.exports.DialogTester} />
2 changes: 1 addition & 1 deletion packages/@react-spectrum/list/docs/ListView.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common gridlist interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common gridlist interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the gridlist tester and a sample of how you could use it in your test suite.

```ts
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/listbox/docs/ListBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common listbox interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common listbox interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the listbox tester and a sample of how you could use it in your test suite.

```ts
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/menu/docs/MenuTrigger.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common menu interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common menu interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the menu tester and a sample of how you could use it in your test suite.

```ts
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/picker/docs/Picker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common select interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common select interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the select tester and a sample of how you could use it in your test suite.

```ts
Expand Down
43 changes: 42 additions & 1 deletion packages/@react-spectrum/radio/docs/RadioGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import {Layout} from '@react-spectrum/docs';
export default Layout;

import docs from 'docs:@react-spectrum/radio';
import radiogroupUtil from 'docs:@react-aria/test-utils/src/radiogroup.ts';
import packageData from '@react-spectrum/radio/package.json';
import {HeaderInfo, PropTable, PageDescription} from '@react-spectrum/docs';
import {HeaderInfo, PropTable, PageDescription, VersionBadge, ClassAPI} from '@react-spectrum/docs';

```jsx import
import {Radio, RadioGroup} from '@react-spectrum/radio';
Expand Down Expand Up @@ -306,3 +307,43 @@ See the [MDN docs](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/
<Radio value="dragon">Dragon</Radio>
</RadioGroup>
```

## Testing

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common radio group interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the radio group tester and a sample of how you could use it in your test suite.

```ts
// RadioGroup.test.ts
import {render} from '@testing-library/react';
import {theme} from '@react-spectrum/theme-default';
import {User} from '@react-spectrum/test-utils';

let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime});
// ...

it('RadioGroup can switch the selected radio', async function () {
// Render your test component/app and initialize the radiogroup tester
let {getByRole} = render(
<Provider theme={defaultTheme}>
<RadioGroup>
...
</RadioGroup>
</Provider>
);

let radioGroupTester = testUtilUser.createTester('RadioGroup', {root: getByRole('radiogroup')});
let radios = radioGroupTester.radios;
expect(radioGroupTester.selectedRadio).toBeFalsy();

await radioGroupTester.triggerRadio({radio: radios[0]});
expect(radioGroupTester.selectedRadio).toBe(radios[0]);

await radioGroupTester.triggerRadio({radio: radios[1]});
expect(radioGroupTester.selectedRadio).toBe(radios[1]);
});
```

<ClassAPI links={radiogroupUtil.links} class={radiogroupUtil.exports.RadioGroupTester} />
2 changes: 1 addition & 1 deletion packages/@react-spectrum/s2/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const iconSizes = {

export function iconStyle(this: MacroContext | void, options: IconStyle): StyleString<Exclude<keyof IconStyle, 'color' | 'size'>> {
let {size = 'M', color, ...styles} = options;

if (color) {
styles['--iconPrimary'] = {
type: 'fill',
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/table/docs/TableView.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1964,7 +1964,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common table interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common table interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the table tester and a sample of how you could use it in your test suite.

```ts
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/tabs/docs/Tabs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ Tabs features automatic tab collapse behavior and may need specific mocks to tes
[React Spectrum's test suite](https://github.com/adobe/react-spectrum/blob/326f48154e301edab425c8198c5c3af72422462b/packages/%40react-spectrum/tabs/test/Tabs.test.js#L58-L62) if you
run into any issues with your tests.

`@react-spectrum/test-utils` offers common tabs interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common tabs interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the tabs tester and a sample of how you could use it in your test suite.

```ts
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/tree/docs/TreeView.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ isn't sufficient when resolving issues in your own test cases.

### Test utils <VersionBadge version="beta" style={{marginLeft: 4, verticalAlign: 'bottom'}} />

`@react-spectrum/test-utils` offers common tree interaction utilities which you may find helpful when writing tests. See [here](../react-aria/testing.html#react-aria-test-utils) for more information on how to setup these utilities
`@react-spectrum/test-utils` offers common tree interaction utilities which you may find helpful when writing tests. See [here](./testing.html#react-spectrum-test-utils) for more information on how to setup these utilities
in your tests. Below is the full definition of the tree tester and a sample of how you could use it in your test suite.

```ts
Expand Down
6 changes: 6 additions & 0 deletions packages/dev/docs/pages/react-aria/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,20 @@ See below for the full definition of the `User` object.
Below is a list of the ARIA patterns testers currently supported by `createTester`. See the accompanying component testing docs pages for a sample of how to use
the testers in your test suite.

- [CheckboxGroup](CheckboxGroup.html#test-utils)

- [ComboBox](ComboBox.html#test-utils)

- [Dialog](Dialog.html#test-utils)

- [GridList](GridList.html#test-utils)

- [ListBox](ListBox.html#test-utils)

- [Menu](Menu.html#test-utils)

- [RadioGroup](RadioGroup.html#test-utils)

- [Select](Select.html#test-utils)

- [Table](Table.html#test-utils)
Expand Down
6 changes: 6 additions & 0 deletions packages/dev/docs/pages/react-spectrum/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -395,14 +395,20 @@ See below for the full definition of the `User` object.
Below is a list of the ARIA patterns testers currently supported by `createTester`. See the accompanying component testing docs pages for a sample of how to use
the testers in your test suite.

- [CheckboxGroup](CheckboxGroup.html#test-utils)

- [ComboBox](ComboBox.html#test-utils)

- [Dialog](Dialog.html#test-utils)

- [ListView](ListView.html#test-utils)

- [ListBox](ListBox.html#test-utils)

- [MenuTrigger](MenuTrigger.html#test-utils)

- [RadioGroup](RadioGroup.html#test-utils)

- [Picker](Picker.html#test-utils)

- [TableView](TableView.html#test-utils)
Expand Down
4 changes: 4 additions & 0 deletions packages/dev/s2-docs/pages/react-aria/CheckboxGroup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ import docs from 'docs:react-aria-components';
import vanillaDocs from 'docs:vanilla-starter/CheckboxGroup';
import '../../tailwind/tailwind.css';
import Anatomy from '@react-aria/checkbox/docs/checkboxgroup-anatomy.svg';
import {InlineAlert, Heading, Content} from '@react-spectrum/s2'

export const tags = ['input'];
export const relatedPages = [
{title: 'Testing', url: './CheckboxGroup/testing.html'}
];

# CheckboxGroup

Expand Down
66 changes: 66 additions & 0 deletions packages/dev/s2-docs/pages/react-aria/CheckboxGroup/testing.mdx
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.

<InstallCommand pkg="@react-aria/test-utils" flags="--dev" />

<InlineAlert variant="notice">
<Heading>Requirements</Heading>
<Content>Please note that this library uses [@testing-library/react@16](https://www.npmjs.com/package/@testing-library/react) and [@testing-library/user-event@14](https://www.npmjs.com/package/@testing-library/user-event). This means that you need to be on React 18+ in order for these utilities to work.</Content>
</InlineAlert>

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.

```ts
// CheckboxGroup.test.ts
import {render} from '@testing-library/react';
import {User} from '@react-aria/test-utils';

let testUtilUser = new User({interactionType: 'mouse', advanceTimer: jest.advanceTimersByTime});
// ...

it('CheckboxGroup can select multiple checkboxes', async function () {
// Render your test component/app and initialize the checkbox group tester
let {getByTestId} = render(
<CheckboxGroup data-testid="test-checkboxgroup">
...
</CheckboxGroup>
);
let checkboxGroupTester = testUtilUser.createTester('CheckboxGroup', {root: getByTestId('test-checkboxgroup')});
expect(checkboxGroupTester.selectedCheckboxes).toHaveLength(0);

await checkboxGroupTester.toggleCheckbox({checkbox: 0});
expect(checkboxGroupTester.checkboxes[0]).toBeChecked();
expect(checkboxGroupTester.selectedCheckboxes).toHaveLength(1);

await checkboxGroupTester.toggleCheckbox({checkbox: 4});
expect(checkboxGroupTester.checkboxes[4]).toBeChecked();
expect(checkboxGroupTester.selectedCheckboxes).toHaveLength(2);
});
```

See below for the full definition of the `User` and the `CheckboxGroup` tester.

<ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.User} />
<ClassAPI links={testUtilDocs.links} class={testUtilDocs.exports.CheckboxGroupTester} />

## Testing FAQ

<PatternTestingFAQ patternName="checkbox group" />
4 changes: 4 additions & 0 deletions packages/dev/s2-docs/pages/react-aria/ComboBox.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ import {ComboBox as VanillaComboBox, ComboBoxItem} from 'vanilla-starter/ComboBo
import vanillaDocs from 'docs:vanilla-starter/ComboBox';
import '../../tailwind/tailwind.css';
import Anatomy from 'react-aria-components/docs/ComboBoxAnatomy.svg';
import {InlineAlert, Heading, Content} from '@react-spectrum/s2'

export const tags = ['autocomplete', 'search', 'typeahead', 'input'];
export const relatedPages = [
{title: 'Testing', url: './ComboBox/testing.html'}
];

# ComboBox

Expand Down
Loading