Skip to content

Commit 4085523

Browse files
committed
fix(date-picker): update date schema to use z.coerce.date and enhance story assertions
- Changed date validation in form schema to use z.coerce.date for better handling of date inputs. - Added assertion to check for the presence of submission confirmation text in the story.
1 parent 3b4a49b commit 4085523

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apps/docs/src/remix-hook-form/date-picker.stories.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { z } from 'zod';
99
import { withReactRouterStubDecorator } from '../lib/storybook/react-router-stub';
1010

1111
const formSchema = z.object({
12-
date: z.date({
12+
date: z.coerce.date({
1313
required_error: 'Please select a date',
1414
}),
1515
});
@@ -166,6 +166,8 @@ export const Default: Story = {
166166
// Check if this is the date picker button
167167
expect(updatedPickerButton.getAttribute('aria-haspopup')).toBe('dialog');
168168

169+
expect(canvas.getByText('Submitted with date:')).toBeInTheDocument();
170+
169171
// Verify the button's text is no longer just "Select a date"
170172
const buttonText = updatedPickerButton.textContent || '';
171173
expect(buttonText).not.toContain('Select a date');

0 commit comments

Comments
 (0)