-
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
docs(PPDSC-2449): Add support to TextArea & TextField for users going over the set max length #465
Conversation
You can preview these changes on: |
); | ||
}; | ||
|
||
CharacterCountExceedMaxLength.storyName = 'MaxLength over limit'; |
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.
Just change the name of the story, the rest is pretty good
CharacterCountExceedMaxLength.storyName = 'MaxLength over limit'; | |
CharacterCountExceedMaxLength.storyName = 'Max Length over limit'; |
return `You have ${diff} character${diff === 1 ? '' : 's'} remaining`; | ||
return `You have ${Math.abs(diff)} character${ | ||
diff === 1 || diff === -1 ? '' : 's' | ||
} ${diff >= 0 ? 'remaining' : 'too many'}`; |
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.
I think you're unit test coverage check is failing because you have added branching logic here.
There are four scenarios that need tests:
- diff > 1
- diff === 1
- diff === -1
- diff < -1
You can check this by running the unit tests locally and looking at the coverage report generated.
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.
will do that @mstuartf
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.
@mstuartf diff > 1
and diff === 1
test scenarios already in place. So, I have done with the tests for diff === -1
and diff < -1
. Checked the test coverages as well and its passing 100%. Please have a look at it and let me know yours thoughts if any.
PPDSC-2449
Added support to the users going over the MaxLength on set.
Users are not restricted from entering more information, allowing for editing down their input so it falls within the set limit. Users can input characters or copy and paste them even if they exceed the set character count.
I have done:
I have tested manually:
Before:
After:
Who should review this PR:
How to test: