Skip to content

Commit

Permalink
[TextField] Fix floating label positon
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Feb 21, 2023
1 parent 17f9fc6 commit 1e793e5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/mui-material/src/OutlinedInput/OutlinedInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ const OutlinedInput = React.forwardRef(function OutlinedInput(inProps, ref) {
label != null && label !== '' && fcs.required ? (
<React.Fragment>
{label}
&nbsp;{'*'}
&thinsp;{'*'}
</React.Fragment>
) : (
label
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('<OutlinedInput />', () => {
/>,
);
const notchOutlined = container.querySelector('.notched-outlined legend');
expect(notchOutlined).to.have.text('label\xa0*');
expect(notchOutlined).to.have.text('label\u2009*');
});

it('should forward classes to InputBase', () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/mui-material/src/TextField/TextField.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ describe('<TextField />', () => {
const [, fakeLabel] = getAllByTestId('label');
const notch = container.querySelector('.notch legend');
expect(notch).to.contain(fakeLabel);
expect(notch).to.have.text('label\u00a0*');
expect(notch).to.have.text('label\u2009*');
});

it('should set shrink prop on outline from label', () => {
Expand All @@ -127,7 +127,7 @@ describe('<TextField />', () => {
);

const notch = container.querySelector('.notch legend');
expect(notch).to.have.text('0\u00a0*');
expect(notch).to.have.text('0\u2009*');
});

it('should not set padding for empty, null or undefined label props', function test() {
Expand Down

0 comments on commit 1e793e5

Please sign in to comment.