-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(TMR-1134): refactor form input logic #895
Conversation
When input is optional and also empty don’t show valid styles. Instead leave neutral.
You can preview these changes on: |
src/form/form-input.tsx
Outdated
isRequired: boolean | undefined, | ||
hasContent: boolean, | ||
) => { | ||
if (!isRequired && !hasContent && state === 'valid') return undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this line a bit more descriptive? maybe assigning a new variable for the expression ?
src/form/__tests__/form.test.tsx
Outdated
@@ -478,6 +478,75 @@ describe('Form', () => { | |||
}); | |||
expect(fragment).toMatchSnapshot(); | |||
}); | |||
|
|||
test('render optional textfield correctly', async () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename the test to something more descriptive like 'render optional textfield without vlidation icons' or something like this
Empty textfields have validation in forms even when they are optional:
This ticket updates the logic so when the text field input is not required and empty no validation visuals are visible.
Before:
After:
What
I have done:
I have tested manually:
Before:
After:
Who should review this PR:
How to test: