Skip to content

Commit

Permalink
[IconButton] Add unit tests for color classes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetta56 committed Nov 26, 2022
1 parent 0b9f72c commit aef41cc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/mui-material/src/IconButton/IconButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,25 @@ describe('<IconButton />', () => {
});
});

describe('prop: color', () => {
const colors = {
primary: classes.colorPrimary,
secondary: classes.colorSecondary,
error: classes.colorError,
info: classes.colorInfo,
success: classes.colorSuccess,
warning: classes.colorWarning,
};

Object.entries(colors).forEach(([colorType, colorClass]) => {
it(`should render the ${colorType} class`, () => {
const { getByRole } = render(<IconButton color={colorType}>book</IconButton>);
const button = getByRole('button');
expect(button).to.have.class(colorClass);
});
});
});

it('should raise a warning about onClick in children because of Firefox', () => {
expect(() => {
PropTypes.checkPropTypes(
Expand Down

0 comments on commit aef41cc

Please sign in to comment.