diff --git a/packages/material-ui/src/Select/Select.js b/packages/material-ui/src/Select/Select.js
index 7a66fbb4001fbf..a16d4fc67bb268 100644
--- a/packages/material-ui/src/Select/Select.js
+++ b/packages/material-ui/src/Select/Select.js
@@ -4,6 +4,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import SelectInput from './SelectInput';
import withStyles from '../styles/withStyles';
+import mergeClasses from '../styles/mergeClasses';
import ArrowDropDownIcon from '../internal/svg-icons/ArrowDropDown';
import Input from '../Input';
import { styles as nativeSelectStyles } from '../NativeSelect/NativeSelect';
@@ -32,19 +33,15 @@ function Select(props) {
} = props;
const inputComponent = native ? NativeSelectInput : SelectInput;
- const inputNativeProps = {
- children,
- classes,
- IconComponent,
- type: undefined, // We render a select. We can ignore the type provided by the `Input`.
- };
return React.cloneElement(input, {
// Most of the logic is implemented in `SelectInput`.
// The `Select` component is a simple API wrapper to expose something better to play with.
inputComponent,
inputProps: {
- ...inputNativeProps,
+ children,
+ IconComponent,
+ type: undefined, // We render a select. We can ignore the type provided by the `Input`.
...(native
? {}
: {
@@ -59,6 +56,13 @@ function Select(props) {
SelectDisplayProps,
}),
...inputProps,
+ classes: inputProps
+ ? mergeClasses({
+ baseClasses: classes,
+ newClasses: inputProps.classes,
+ Component: Select,
+ })
+ : classes,
...(input ? input.props.inputProps : {}),
},
...other,
diff --git a/packages/material-ui/src/Select/Select.test.js b/packages/material-ui/src/Select/Select.test.js
index e18af1c8eb3cc1..7870def8b3ed82 100644
--- a/packages/material-ui/src/Select/Select.test.js
+++ b/packages/material-ui/src/Select/Select.test.js
@@ -9,14 +9,14 @@ describe('', () => {
let shallow;
let classes;
let mount;
- const props = {
+ const defaultProps = {
input: ,
children: [, ],
};
before(() => {
shallow = createShallow({ dive: true });
- classes = getClasses();
+ classes = getClasses();
mount = createMount();
});
@@ -25,18 +25,35 @@ describe('', () => {
});
it('should render a correct top element', () => {
- const wrapper = shallow();
+ const wrapper = shallow();
assert.strictEqual(wrapper.type(), Input);
});
it('should provide the classes to the input component', () => {
- const wrapper = shallow();
+ const wrapper = shallow();
assert.deepEqual(wrapper.props().inputProps.classes, classes);
});
+ describe('prop: inputProps', () => {
+ it('should be able to provide a custom classes property', () => {
+ const wrapper = shallow(
+ ,
+ );
+ assert.deepEqual(wrapper.props().inputProps.classes, {
+ ...classes,
+ root: `${classes.root} root`,
+ });
+ });
+ });
+
it('should be able to mount the component', () => {
const wrapper = mount(
-