Skip to content

Commit

Permalink
add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
johsunds committed Feb 3, 2022
1 parent ea0f85f commit b2600ee
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/mui-material/src/Select/Select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1297,4 +1297,17 @@ describe('<Select />', () => {
expect(getByTestId('root')).to.have.class('bar');
});
});

it('should not focus select when clicking an arbitrary element with id="undefined"', () => {
const { getByRole, getByTestId } = render(
<React.Fragment>
<div id="undefined" data-testid="test-element" />
<Select value="" />
</React.Fragment>,
);

fireEvent.click(getByTestId('test-element'));

expect(getByRole('button')).not.toHaveFocus();
});
});

0 comments on commit b2600ee

Please sign in to comment.