Skip to content

Commit

Permalink
Ignore disableSelected
Browse files Browse the repository at this point in the history
  • Loading branch information
eps1lon committed Mar 21, 2020
1 parent 052613d commit 7a735fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions packages/material-ui-lab/src/TreeItem/TreeItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,13 @@ const TreeItem = React.forwardRef(function TreeItem(props, ref) {
}, [focused]);

let ariaSelected;
if (!selectionDisabled) {
if (multiSelect) {
ariaSelected = selected;
} else if (selected) {
ariaSelected = true;
}
if (multiSelect) {
ariaSelected = selected;
} else if (selected) {
// single-selection trees unset aria-selected
ariaSelected = true;
}

return (
<li
className={clsx(classes.root, className, {
Expand Down
4 changes: 2 additions & 2 deletions packages/material-ui-lab/src/TreeItem/TreeItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,14 @@ describe('<TreeItem />', () => {
expect(getByTestId('test')).to.have.attribute('aria-selected', 'true');
});

it('should not have the attribute `aria-selected` if disableSelection is true', () => {
it('should have the attribute `aria-selected` if disableSelection is true', () => {
const { getByTestId } = render(
<TreeView multiSelect disableSelection>
<TreeItem nodeId="test" label="test" data-testid="test" />
</TreeView>,
);

expect(getByTestId('test')).to.not.have.attribute('aria-selected');
expect(getByTestId('test')).to.have.attribute('aria-selected', 'false');
});
});
});
Expand Down

0 comments on commit 7a735fe

Please sign in to comment.