diff --git a/packages/mui-material/src/OutlinedInput/OutlinedInput.js b/packages/mui-material/src/OutlinedInput/OutlinedInput.js index 1b4c9fcf574295..2f8700425494dc 100644 --- a/packages/mui-material/src/OutlinedInput/OutlinedInput.js +++ b/packages/mui-material/src/OutlinedInput/OutlinedInput.js @@ -155,11 +155,26 @@ const OutlinedInput = React.forwardRef(function OutlinedInput(inProps, ref) { states: ['required'], }); + const ownerState = { + ...props, + color: fcs.color || 'primary', + disabled: fcs.disabled, + error: fcs.error, + focused: fcs.focused, + formControl: muiFormControl, + fullWidth, + hiddenLabel: fcs.hiddenLabel, + multiline, + size: fcs.size, + type, + }; + return ( ( ', () => { ); expect(document.querySelector('[data-test=test]')).toHaveComputedStyle({ marginTop: '10px' }); }); + + it('should have ownerState in the theme style overrides', () => { + expect(() => + render( + ({ + // test that ownerState is not undefined + ...(ownerState.disabled && {}), + }), + }, + }, + }, + })} + > + + , + ), + ).not.to.throw(); + }); });