fix(settings): lint, size and test follow-ups for the date format

The admin reset link is a component of its own instead of one made during render, the version line of the plugin panels moved into small modules, the new settings rows hand their save on as void, the date picker takes an accessible name for fields without a visible label (the Vacay hire date), the Vacay and poll tests type through the shared picker, and the theme, size and lint baselines are lowered to what the files hold now.
This commit is contained in:
Maurice
2026-11-03 22:08:54 +01:00
parent 44c6fbf372
commit adbe3a40f6
19 changed files with 188 additions and 99 deletions
@@ -53,8 +53,13 @@ function wsHandler() {
return calls[calls.length - 1][0]
}
function deadlineInput(): HTMLInputElement {
return document.querySelector('input[type="datetime-local"]') as HTMLInputElement
// The deadline is the shared date and time picker (#2971): the day typed in its
// manual field, the time left at the noon it starts from.
function setDeadline(day: string) {
fireEvent.click(screen.getByRole('button', { name: /enterManually|Enter date manually/ }))
const input = screen.getByRole('textbox', { name: /enterManually|Enter date manually/ })
fireEvent.change(input, { target: { value: day } })
fireEvent.keyDown(input, { key: 'Enter' })
}
describe('MCollabPolls', () => {
@@ -335,7 +340,7 @@ describe('MCollabPolls', () => {
fireEvent.change(screen.getByPlaceholderText('collab.polls.optionPlaceholder:1'), { target: { value: 'Ryokan' } })
fireEvent.change(screen.getByPlaceholderText('collab.polls.optionPlaceholder:2'), { target: { value: ' Capsule ' } })
fireEvent.click(screen.getByRole('button', { name: 'collab.polls.multiChoice' }))
fireEvent.change(deadlineInput(), { target: { value: '2026-08-01T12:00' } })
setDeadline('2030-08-01')
fireEvent.click(screen.getByRole('button', { name: 'collab.polls.create' }))
await waitFor(() => expect(createPoll).toHaveBeenCalledWith(1, {
@@ -343,7 +348,7 @@ describe('MCollabPolls', () => {
options: ['Ryokan', 'Capsule'],
multiple: true,
multiple_choice: true,
deadline: new Date('2026-08-01T12:00').toISOString(),
deadline: new Date('2030-08-01T12:00').toISOString(),
}))
expect(await screen.findByText('Which hotel?')).toBeInTheDocument()
})
@@ -381,10 +386,9 @@ describe('MCollabPolls', () => {
fireEvent.click(screen.getAllByRole('button', { name: 'common.delete' })[0])
expect(screen.queryByPlaceholderText('collab.polls.optionPlaceholder:3')).not.toBeInTheDocument()
fireEvent.change(deadlineInput(), { target: { value: '2026-08-01T12:00' } })
expect(deadlineInput()).toHaveValue('2026-08-01T12:00')
setDeadline('2030-08-01')
fireEvent.click(screen.getByRole('button', { name: 'collab.polls.clearDeadline' }))
expect(deadlineInput()).toHaveValue('')
expect(screen.queryByRole('button', { name: 'collab.polls.clearDeadline' })).not.toBeInTheDocument()
})
it('FE-MOB-POLLS-025: keeps the form open and toasts when creating fails', async () => {
@@ -69,6 +69,19 @@ async function waitForCountries() {
await waitFor(() => expect(screen.getAllByRole('option', { name: 'Germany' }).length).toBeGreaterThan(0));
}
// The hire date is the shared date picker (#2971): typed through its manual
// field, cleared from its calendar.
function typeDate(trigger: HTMLElement, value: string) {
fireEvent.click(within(trigger.parentElement as HTMLElement).getByRole('button', { name: /enterManually|Enter date manually/ }))
const input = screen.getByRole('textbox', { name: /enterManually|Enter date manually/ })
fireEvent.change(input, { target: { value } })
fireEvent.keyDown(input, { key: 'Enter' })
}
function clearDate(trigger: HTMLElement) {
fireEvent.click(trigger)
fireEvent.click(screen.getByRole('button', { name: /clearDate|Clear date/ }))
}
describe('MVacaySettingsSheet', () => {
it('FE-MOB-MVACSET-001: renders nothing without a plan', () => {
useVacayStore.setState({ plan: null });
@@ -217,15 +230,15 @@ describe('MVacaySettingsSheet', () => {
});
renderSheet();
const hire = screen.getByLabelText('Hire date');
expect(hire).toHaveValue('2020-09-14');
const hire = () => screen.getByRole('button', { name: /^Hire date: / });
expect(hire()).toHaveAccessibleName(/2020/);
fireEvent.change(hire, { target: { value: '2021-03-02' } });
typeDate(hire(), '2021-03-02');
expect(updateYearSettings).toHaveBeenLastCalledWith({
year_type: 'anniversary', year_start_month: 1, year_start_day: 1, hire_date: '2021-03-02',
});
fireEvent.change(hire, { target: { value: '' } });
clearDate(hire());
expect(updateYearSettings).toHaveBeenLastCalledWith({
year_type: 'anniversary', year_start_month: 1, year_start_day: 1, hire_date: null,
});