Skip to content

Conversation

buberdds
Copy link
Contributor

@buberdds buberdds commented Sep 6, 2022

What does this PR do?

For Select component with multiple selection nextValue is an object (array) and we want to trigger change event in this situation to trigger a validation.

Where should the reviewer start?

Select.js

What testing has been done on this PR?

Manual and unit tests

How should this be manually tested?

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

#6303

Screenshots (if appropriate)

Do the grommet docs need to be updated?

Should this PR be mentioned in the release notes?

Is this change backwards compatible or is it a breaking change?

@@ -1,3 +1,5 @@
global.scrollTo = jest.fn();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we just add this to the tests that need it instead of the global test setup file?

@@ -931,4 +938,83 @@ describe('Form controlled', () => {
// lastName should not trigger required validation onMount
expect(screen.queryAllByText('required')).toHaveLength(0);
});

test('validate select with multiple selection', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for adding a jest test!

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants