Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -465,3 +465,51 @@
value: undefined
});
});

it('correctly unsets the date when month is deselected', async () => {

Check failure on line 469 in packages/es-components/src/components/patterns/dateInput/DateInput.specs.tsx

View workflow job for this annotation

GitHub Actions / ESLint Report Analysis

packages/es-components/src/components/patterns/dateInput/DateInput.specs.tsx#L469

[jest/no-identical-title] Test title is used multiple times in the same describe block
const onChange = jest.fn();
const props = {
onChange
};

renderWithTheme(
<TestDateInput {...props}>
<DateInput.Month aria-label="month" selectOptionText="Select a Month" />
<DateInput.Day aria-label="day" />
<DateInput.Year aria-label="year" />
</TestDateInput>
);

await userEvent.selectOptions(
screen.getByRole('combobox', { name: /month/ }),
'January'
);
await typeFresh(await screen.findByRole('spinbutton', { name: /day/ }), '15');
await typeFresh(
await screen.findByRole('spinbutton', { name: /year/ }),
'2025'
);
expect(onChange).toHaveBeenLastCalledWith({
isInRange: true,
rawValues: {
day: '15',
month: '1',
year: '2025'
},
value: new Date('2025/1/15')
});

await userEvent.selectOptions(
screen.getByRole('combobox', { name: /month/ }),
'Select a Month'
);
expect(onChange).toHaveBeenLastCalledWith({
isInRange: false,
rawValues: {
day: '15',
month: '',
year: '2025'
},
value: undefined
});
});
Loading