-
Notifications
You must be signed in to change notification settings - Fork 2
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: use autocomplete web component in FindProperty #887
Conversation
Removed vultr server and associated DNS entries |
expect(screen.getByTestId("autocomplete-input")).toBeInTheDocument; | ||
expect( | ||
screen.getByTestId("autocomplete-input").getAttribute("postcode") | ||
).toEqual("SE5 0HU"); |
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.
Learned an important thing about web components here: it's going to render <address-autocomplete .../>
in the document during testing, not the full shadow DOM as if you were inspecting the live service.
Therefore, we can't actually test typing input, selecting an option from the dropdown, etc. This feels a bit weaker overall, but we can still test valuable things like if the "postcode" prop has updated as a result of a new postcode being typed in.
Going forward, I think the answer will be to add these types of behavior tests directly in the web component repo (using https://open-wc.org/docs/testing/helpers/ maybe?) & then test for correctly setting props here. Does that make sense?
🤞 🤞 🤞 Co-authored-by: Dafydd Llŷr Pearson <DafyddLlyr@gmail.com>
replacing material ui autocomplete (which continues to fail a11y audit) with gov-uk's accessible-autocomplete wrapped in a Lit web component that additionally handles fetching addresses from OS Places API
https://887.planx.pizza/opensystemslab/test/preview
changes / todos:
most recent accessibility feedback to keep in mind while testing:
future:
not using
<postcode-search />
web component yet (that MUI input is not failing a11y audit, so will introduce in future PR), but on first try noticed that we'll probably want to dispatch an event on every input change, rather than only on validated postcode. currently, we lack a signal to know when to re-hide/clear address autocomplete if postcode is changing after the first validation.