Navigating a form with a bunch of elements with filled-in values can be a way to refer to certain elements.
In this lesson, we will look at another one of the queries that are part of the queries accessible to everyone's family and helpful when querying for filled-in form values the byDisplayValue query.
Instructor: [0:00] When you have a page with filled-in values, you might want to query for them. In this scenario, the byDisplayValue is the query that belongs to the queries accessible to everyone's family. That should help you.
[0:10] Looking at our component, we can see that we have an input with a defaultValue of 9001. This means that when this element renders, it will have a value of 9001. We can use this value to query for this element.
[0:20] Let's destructure the getByDisplayValue query from render. Then, let's call it and pass the value which our input should have, which in this scenario was 9001. Once we have our input, let's assert it is in the document and run our test. You should now see that our test has passed.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!