Skip to content
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

Merged
merged 16 commits into from
Nov 21, 2022

Conversation

jannuk59
Copy link
Contributor

@jannuk59 jannuk59 commented Nov 8, 2022

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:

  • Written unit tests against changes
  • Written functional tests against the component and/or NewsKit site
  • Updated relevant documentation

I have tested manually:

  • The feature's functionality is working as expected on Chrome, Firefox, Safari and Edge
  • The screen reader reads and flows through the elements as expected.
  • There are no new errors in the browser console coming from this PR.
  • When visual test is not added, it renders correctly on different browsers and mobile viewports (Safari, Firefox, small mobile viewport, tablet)
  • The Playground feature is working as expected

Before:

After:

Who should review this PR:

How to test:

@github-actions github-actions bot added the feature This change contains a new feature label Nov 8, 2022
@jannuk59 jannuk59 marked this pull request as ready for review November 14, 2022 07:26
@jannuk59 jannuk59 changed the title Feat/ppdsc 2396 textaera set max length docs(PPDSC-2449): Add support to TextArea & TextField for users going over the set max length Nov 14, 2022
);
};

CharacterCountExceedMaxLength.storyName = 'MaxLength over limit';
Copy link
Contributor

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

Suggested change
CharacterCountExceedMaxLength.storyName = 'MaxLength over limit';
CharacterCountExceedMaxLength.storyName = 'Max Length over limit';

mutebg
mutebg previously approved these changes Nov 16, 2022
mstuartf
mstuartf previously approved these changes Nov 17, 2022
mutebg
mutebg previously approved these changes Nov 18, 2022
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'}`;
Copy link
Contributor

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:

  1. diff > 1
  2. diff === 1
  3. diff === -1
  4. diff < -1

You can check this by running the unit tests locally and looking at the coverage report generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do that @mstuartf

Copy link
Contributor Author

@jannuk59 jannuk59 Nov 18, 2022

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.

@jannuk59 jannuk59 dismissed stale reviews from mutebg and mstuartf via 8dc82f8 November 18, 2022 15:06
@jannuk59 jannuk59 merged commit 5d476bc into main Nov 21, 2022
@jannuk59 jannuk59 deleted the feat/PPDSC-2396-textaera-set-max-length branch November 21, 2022 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This change contains a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants