From d447a4a670c6fad9161d8454fb0044cefab39438 Mon Sep 17 00:00:00 2001 From: leMaik Date: Sun, 24 Feb 2019 14:14:07 +0100 Subject: [PATCH] Add sizeMedium class and more tests --- packages/material-ui/src/IconButton/IconButton.js | 4 +++- .../material-ui/src/IconButton/IconButton.test.js | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/material-ui/src/IconButton/IconButton.js b/packages/material-ui/src/IconButton/IconButton.js index ebff951c08f997..a21965de3d0979 100644 --- a/packages/material-ui/src/IconButton/IconButton.js +++ b/packages/material-ui/src/IconButton/IconButton.js @@ -77,6 +77,8 @@ export const styles = theme => ({ minWidth: 24, fontSize: 18, }, + /* Styles applied to the root element if `size="medium"`. */ + sizeMedium: {}, }); /** @@ -93,8 +95,8 @@ const IconButton = React.forwardRef(function IconButton(props, ref) { { [classes[`color${capitalize(color)}`]]: color !== 'default', [classes.disabled]: disabled, - [classes.sizeSmall]: size === 'small', }, + classes[`size${capitalize(size)}`], className, )} centerRipple diff --git a/packages/material-ui/src/IconButton/IconButton.test.js b/packages/material-ui/src/IconButton/IconButton.test.js index 53ba0fdea352ab..f47056b566ed04 100644 --- a/packages/material-ui/src/IconButton/IconButton.test.js +++ b/packages/material-ui/src/IconButton/IconButton.test.js @@ -88,6 +88,19 @@ describe('', () => { it('should render with sizeSmall class when prop size="small" provided', () => { const wrapper = shallow(book); assert.strictEqual(wrapper.hasClass(classes.sizeSmall), true); + assert.strictEqual(wrapper.hasClass(classes.sizeMedium), false); + }); + + it('should render with sizeMedium class when prop size="medium" provided', () => { + const wrapper = shallow(book); + assert.strictEqual(wrapper.hasClass(classes.sizeSmall), false); + assert.strictEqual(wrapper.hasClass(classes.sizeMedium), true); + }); + + it('should render with sizeMedium class when no size is provided', () => { + const wrapper = shallow(book); + assert.strictEqual(wrapper.hasClass(classes.sizeSmall), false); + assert.strictEqual(wrapper.hasClass(classes.sizeMedium), true); }); describe('prop: disabled', () => {