Skip to content

Commit

Permalink
test: adds more tests on empty placeholder scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Balduini authored and Arthur Balduini committed May 16, 2024
1 parent a2bc2be commit 442c3ec
Showing 1 changed file with 49 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,18 +138,57 @@ describe('<DesktopDatePicker /> - Field', () => {
Component: DesktopDatePicker,
});

it('should allow to override the placeholder (v6 only)', () => {
renderWithProps({
enableAccessibleFieldDOMStructure: false,
slotProps: {
textField: {
placeholder: 'Custom placeholder',
describe('Placeholder override (v6 only)', () => {
it('should allow to override the placeholder', () => {
renderWithProps({
enableAccessibleFieldDOMStructure: false,
slotProps: {
textField: {
placeholder: 'Custom placeholder',
},
},
},
});

const input = getTextbox();
expectFieldPlaceholderV6(input, 'Custom placeholder');
});

it('should show blank placeholder when prop is an empty string', () => {
renderWithProps({
enableAccessibleFieldDOMStructure: false,
slotProps: {
textField: {
placeholder: '',
},
},
});

const input = getTextbox();
expectFieldPlaceholderV6(input, '');
});

it('should show blank placeholder when prop is undefined', () => {
renderWithProps({
enableAccessibleFieldDOMStructure: false,
slotProps: {
textField: {
placeholder: undefined,
},
},
});

const input = getTextbox();
expectFieldPlaceholderV6(input, '');
});

it('should show default placeholder when no prop is received', () => {
renderWithProps({
enableAccessibleFieldDOMStructure: false,
});

const input = getTextbox();
expectFieldPlaceholderV6(input, 'MM/DD/YYYY');
});

const input = getTextbox();
expectFieldPlaceholderV6(input, 'Custom placeholder');
});
});

Expand Down

0 comments on commit 442c3ec

Please sign in to comment.