1. 9
    Get Elements With a Matching Display Value Using the byDisplayValue Query
    35s

Get Elements With a Matching Display Value Using the byDisplayValue Query

Daniel Afonso
InstructorDaniel Afonso
Share this video with your friends

Social Share Links

Send Tweet
Published 8 months ago
Updated 6 months ago

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.

egghead
egghead
~ 18 minutes ago

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

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

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!

Markdown supported.
Become a member to join the discussionEnroll Today