-
Notifications
You must be signed in to change notification settings - Fork 166
LG-8330: Allow user to select USPS location when search box is empty #7760
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3820b29
user can't proceed past empty textbox, but no validation error displa…
eileen-nava 946b08b
disable search input field when user selects a location
eileen-nava e659cbb
clean up unneeded changes
eileen-nava 7a3f978
changelog: Bug Fixes, In-person proofing, allow user to select USPS l…
eileen-nava 925989f
test that user can select location when search box is empty
eileen-nava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -368,4 +368,38 @@ describe('InPersonLocationStep', () => { | |
| expect(moreResults).to.be.empty(); | ||
| }); | ||
| }); | ||
|
|
||
| context('user deletes text from searchbox after location results load', () => { | ||
| beforeEach(() => { | ||
| server.use( | ||
| rest.post(ADDRESS_SEARCH_URL, (_req, res, ctx) => | ||
| res(ctx.json(DEFAULT_RESPONSE), ctx.status(200)), | ||
| ), | ||
| rest.post(LOCATIONS_URL, (_req, res, ctx) => res(ctx.json([{ name: 'Baltimore' }]))), | ||
| ); | ||
| }); | ||
|
|
||
| it('allows user to select a location', async () => { | ||
| const { findAllByText, findByLabelText, findByText, queryByText } = render( | ||
| <InPersonLocationPostOfficeSearchStep {...DEFAULT_PROPS} />, | ||
| { wrapper }, | ||
| ); | ||
| await userEvent.type( | ||
| await findByLabelText('in_person_proofing.body.location.po_search.address_search_label'), | ||
| 'Evergreen Terrace Springfield', | ||
| ); | ||
|
|
||
| await userEvent.click( | ||
| await findByText('in_person_proofing.body.location.po_search.search_button'), | ||
| ); | ||
|
|
||
| await userEvent.clear( | ||
| await findByLabelText('in_person_proofing.body.location.po_search.address_search_label'), | ||
| ); | ||
|
Comment on lines
+396
to
+398
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably would move this and related prereq steps to the |
||
|
|
||
| await userEvent.click(findAllByText('in_person_proofing.body.location.location_button')[0]); | ||
|
|
||
| expect(await queryByText('in_person_proofing.body.location.inline_error')).to.be.null(); | ||
| }); | ||
| }); | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Interesting... how does this fix the issue? Does the FormSteps stuff ignore disabled fields even after invalidation?
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.
@NavaTim I'm just curious — how does this work/fix the bug?
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.
@allthesignals: I think this answers what you're asking, but please say so if I missed your q. @eileen-nava filled me in on the inner workings here. The form steps component is just a standard form element, so when you pass an attribute of 'disabled' to that form field, it does not validate that field. TIL: MDN Disabled Overview
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.
Oh, great! I assumed FormSteps was doing validation... sounds like it's being done natively!
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.
@allthesignals The
ValidatedFieldElementhooks into theinvalidevent, which doesn't trigger when the element is disabled.Relevant spec sections:
Source
Note that the
invalidevent in the above source is mentioned as being triggered by the constraint validation API.Source
Source
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.
Fascinating. Thank you Tim!