Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
flaviendelangle committed Jul 2, 2024
1 parent 47f5326 commit f7a4bbe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/x-tree-view/src/TreeItem/useTreeItemState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export function useTreeItemState(itemId: string) {
instance.selectItem({ event, itemId, keepExistingSelection: true });
}
} else {
instance.selectItem({ event, itemId, isSelected: true });
instance.selectItem({ event, itemId, shouldBeSelected: true });
}
}
};
Expand All @@ -74,7 +74,7 @@ export function useTreeItemState(itemId: string) {
event,
itemId,
keepExistingSelection: multiSelect,
isSelected: event.target.checked,
shouldBeSelected: event.target.checked,
});
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const useTreeItem2Utils = ({
instance.selectItem({ event, itemId, keepExistingSelection: true });
}
} else {
instance.selectItem({ event, itemId, isSelected: true });
instance.selectItem({ event, itemId, shouldBeSelected: true });
}
};

Expand All @@ -107,7 +107,7 @@ export const useTreeItem2Utils = ({
event,
itemId,
keepExistingSelection: multiSelect,
isSelected: event.target.checked,
shouldBeSelected: event.target.checked,
});
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const useTreeViewKeyboardNavigation: TreeViewPlugin<
event,
itemId,
keepExistingSelection: params.multiSelect,
isSelected: params.multiSelect ? undefined : true,
shouldBeSelected: params.multiSelect ? undefined : true,
});
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,7 @@ describeTreeView<[UseTreeViewSelectionSignature, UseTreeViewExpansionSignature]>

describe('selectItem api method', () => {
describe('single selection', () => {
it('should select un-selected item when isSelected is not defined', () => {
it('should select un-selected item when shouldBeSelected is not defined', () => {
const response = render({
items: [{ id: '1' }, { id: '2' }],
});
Expand All @@ -809,7 +809,7 @@ describeTreeView<[UseTreeViewSelectionSignature, UseTreeViewExpansionSignature]>
expect(response.isItemSelected('1')).to.equal(true);
});

it('should un-select selected item when isSelected is not defined', () => {
it('should un-select selected item when shouldBeSelected is not defined', () => {
const response = render({
items: [{ id: '1' }, { id: '2' }],
defaultSelectedItems: ['1'],
Expand Down Expand Up @@ -851,7 +851,7 @@ describeTreeView<[UseTreeViewSelectionSignature, UseTreeViewExpansionSignature]>
});

describe('multi selection', () => {
it('should select un-selected item and remove other selected items when isSelected is not defined', () => {
it('should select un-selected item and remove other selected items when shouldBeSelected is not defined', () => {
const response = render({
items: [{ id: '1' }, { id: '2' }],
defaultSelectedItems: ['2'],
Expand All @@ -865,7 +865,7 @@ describeTreeView<[UseTreeViewSelectionSignature, UseTreeViewExpansionSignature]>
expect(response.getSelectedTreeItems()).to.deep.equal(['1']);
});

it('should select un-selected item and keep other selected items when isSelected is not defined and keepExistingSelection is true', () => {
it('should select un-selected item and keep other selected items when shouldBeSelected is not defined and keepExistingSelection is true', () => {
const response = render({
items: [{ id: '1' }, { id: '2' }],
defaultSelectedItems: ['2'],
Expand Down

0 comments on commit f7a4bbe

Please sign in to comment.