Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
snowystinger committed Jan 15, 2025
1 parent 11ddb5d commit d5c2b1c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/@react-spectrum/s2/test/Tree.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ AriaTreeTests({
</TreeView>
),
singleSelection: () => render(
<TreeView aria-label="test tree" selectionMode="single" disabledKeys={['school']}>
<TreeView aria-label="test tree" selectionMode="single" disabledKeys={['school']} disabledBehavior="selection">
<TreeViewItem id="Photos" textValue="Photos">
<Text>Photos</Text>
<Folder />
Expand Down
6 changes: 3 additions & 3 deletions packages/@react-spectrum/tree/test/TreeView.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ describe('Tree', () => {
await user.click(row);
expect(row).toHaveAttribute('data-focused');

rerender(tree, <StaticTree treeProps={{selectionMode: 'multiple', disabledKeys: ['Projects']}} />);
rerender(tree, <StaticTree treeProps={{selectionMode: 'multiple', disabledKeys: ['Projects'], disabledBehavior: 'selection'}} />);
row = tree.getAllByRole('row')[0];
expect(row).not.toHaveAttribute('data-focus-visible');

Expand Down Expand Up @@ -1191,7 +1191,7 @@ describe('Tree', () => {

it('should add a tab index to the chevron if the row isnt completely disabled', () => {
let tree = render(
<TreeView aria-label="test tree" selectionMode="multiple">
<TreeView aria-label="test tree" selectionMode="multiple" disabledBehavior="selection">
<TreeViewItem id="Test" textValue="Test" hasChildItems>
<Text>Test</Text>
</TreeViewItem>
Expand All @@ -1203,7 +1203,7 @@ describe('Tree', () => {

rerender(
tree,
<TreeView aria-label="test tree" selectionMode="multiple" disabledKeys={['Test']}>
<TreeView aria-label="test tree" selectionMode="multiple" disabledKeys={['Test']} disabledBehavior="selection">
<TreeViewItem id="Test" textValue="Test" hasChildItems>
<Text>Test</Text>
</TreeViewItem>
Expand Down
10 changes: 5 additions & 5 deletions packages/react-aria-components/test/Tree.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ describe('Tree', () => {
});

it('should not update the press state if the row is not interactive', () => {
let {getAllByRole, rerender} = render(<StaticTree treeProps={{selectionMode: 'none'}} rowProps={{className: ({isPressed}) => isPressed ? 'pressed' : ''}} />);
let {getAllByRole, rerender} = render(<StaticTree treeProps={{selectionMode: 'none', disabledBehavior: 'selection'}} rowProps={{className: ({isPressed}) => isPressed ? 'pressed' : ''}} />);

let row = getAllByRole('row')[0];
expect(row).not.toHaveAttribute('data-pressed');
Expand Down Expand Up @@ -557,7 +557,7 @@ describe('Tree', () => {
});

it('should support focus', async () => {
let {getAllByRole, rerender} = render(<StaticTree treeProps={{selectionMode: 'multiple', disabledKeys: ['projects']}} rowProps={{className: ({isFocused}) => isFocused ? 'focus' : ''}} />);
let {getAllByRole, rerender} = render(<StaticTree treeProps={{selectionMode: 'multiple', disabledKeys: ['projects'], disabledBehavior: 'selection'}} rowProps={{className: ({isFocused}) => isFocused ? 'focus' : ''}} />);

let row = getAllByRole('row')[0];
expect(row).not.toHaveAttribute('data-focused');
Expand All @@ -567,7 +567,7 @@ describe('Tree', () => {
expect(row).toHaveAttribute('data-focused');
expect(row).toHaveClass('focus');

rerender(<StaticTree treeProps={{selectionMode: 'multiple', disabledKeys: ['projects']}} rowProps={{className: ({isFocusVisible}) => isFocusVisible ? 'focus-visible' : ''}} />);
rerender(<StaticTree treeProps={{selectionMode: 'multiple', disabledKeys: ['projects'], disabledBehavior: 'selection'}} rowProps={{className: ({isFocusVisible}) => isFocusVisible ? 'focus-visible' : ''}} />);
row = getAllByRole('row')[0];
expect(row).not.toHaveAttribute('data-focus-visible');
expect(row).not.toHaveClass('focus-visible');
Expand Down Expand Up @@ -1211,7 +1211,7 @@ AriaTreeTests({
</UNSTABLE_Tree>
),
singleSelection: () => render(
<UNSTABLE_Tree aria-label="test tree" selectionMode="single" disabledKeys={['school']}>
<UNSTABLE_Tree aria-label="test tree" selectionMode="single" disabledKeys={['school']} disabledBehavior="selection">
<StaticTreeItem id="Photos" textValue="Photos">Photos</StaticTreeItem>
<StaticTreeItem id="projects" textValue="Projects" title="Projects">
<StaticTreeItem id="projects-1" textValue="Projects-1" title="Projects-1">
Expand Down Expand Up @@ -1341,7 +1341,7 @@ AriaTreeTests({
<ControlledDynamicTree />
),
singleSelection: () => render(
<ControlledDynamicTree disabledKeys={['reports']} selectionMode="single" />
<ControlledDynamicTree disabledKeys={['reports']} selectionMode="single" disabledBehavior="selection" />
),
allInteractionsDisabled: () => render(
<ControlledDynamicTree disabledKeys={['reports']} selectionMode="single" disabledBehavior="all" />
Expand Down

0 comments on commit d5c2b1c

Please sign in to comment.