mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-15 12:23:51 +00:00
feat(rundown): clear a mixed field explicitly, cover both fixes with tests
Emptying a field which holds different values across the selection does not submit, otherwise focusing it and tabbing away would wipe every entry. That left no way to clear such a field, so text fields now offer an explicit Clear action, shown only while the entries disagree. Once they agree the field can be emptied by hand and the action is withdrawn. Both of the fixes which multi edit depends on were unguarded, so the logic moves into pure helpers alongside the existing hook helper convention: - shouldSubmitValue covers an unknown initial value being submitted as an empty string - applyPatchToEvents covers the optimistic batch update, whose signature now makes the original mistake of spreading the request body unrepresentable, and pins the custom field merge Both tests were confirmed to fail against the original behaviour. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PDETGBrhwgAqgTHjmrmJGJ
This commit is contained in:
@@ -50,6 +50,16 @@ test('Editing multiple events', async ({ page }) => {
|
||||
await expect(page.getByTestId('entry-1').getByTestId('entry__title')).toHaveValue('first');
|
||||
await expect(page.getByTestId('entry-2').getByTestId('entry__title')).toHaveValue('second');
|
||||
|
||||
// a mixed field cannot be cleared by emptying it, so an explicit action is offered
|
||||
const clearTitle = editor.getByRole('button', { name: 'Clear', exact: true }).first();
|
||||
await expect(clearTitle).toBeVisible();
|
||||
await clearTitle.click();
|
||||
await expect(page.getByTestId('entry-1').getByTestId('entry__title')).toHaveValue('');
|
||||
await expect(page.getByTestId('entry-2').getByTestId('entry__title')).toHaveValue('');
|
||||
|
||||
// the events now agree, so the field can be cleared by hand and the action is withdrawn
|
||||
await expect(editor.getByLabel('Title', { exact: true })).not.toHaveAttribute('placeholder', 'Mixed');
|
||||
|
||||
// editing a field applies it to the whole selection
|
||||
await title.fill('shared title');
|
||||
await title.press('Enter');
|
||||
|
||||
Reference in New Issue
Block a user