Skip to content

Add queryOptions to labelText and hintText #1193

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

Conversation

ShaswatPrabhat
Copy link
Contributor

Changes for PR

Copy link
Collaborator

@AugustinLF AugustinLF left a comment

Choose a reason for hiding this comment

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

@ShaswatPrabhat
Copy link
Contributor Author

Have added the tests @AugustinLF

Some label text tests are still failing though. Will appreciate some help there as well, thanks.

Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

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

@ShaswatPrabhat looks good, pls also update documentation in Queries.md

@mdjastrzebski
Copy link
Member

@ShaswatPrabhat looks like there are some CircleCI issues. Are the tests are passing locally on your machine?

@ShaswatPrabhat
Copy link
Contributor Author

ShaswatPrabhat commented Oct 21, 2022

Some tests for Label are failing even on my local @mdjastrzebski, hence needed help. Wondering what I did wrong for the tests to start failing.

Seems after my change it is not picking labels from all 3 components:

image

Please find screenshot of the failure below:

image

@ShaswatPrabhat
Copy link
Contributor Author

ShaswatPrabhat commented Oct 21, 2022

The earlier matchStringProp method:

 return prop.match(matcher) != null;

But the matches.ts method:

 return matcher.test(normalizedText);

And hence the delta.

@mdjastrzebski
Copy link
Member

I've fixed the failing tests. There was a rather obscure bug connected with the fact that RegExp.test() is stateful with global queries, and you need to reset the regex state in order to work correctly 🤦🏻‍♂️

Happy that you stumbled upon it, because it could impact our other queries as well 🎉

@ShaswatPrabhat
Copy link
Contributor Author

@mdjastrzebski Thank you. Is it good to merge the changes ?

Copy link
Collaborator

@AugustinLF AugustinLF left a comment

Choose a reason for hiding this comment

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

You also need to update the flow types :)

Apart from that and my other comment, looks good to me.

@ShaswatPrabhat
Copy link
Contributor Author

Have pushed some changes for both observations @AugustinLF . Please have a look whenever possible. Thanks.

@mdjastrzebski
Copy link
Member

Since findByLabelText and findByPlaceholderText now use 2nd parameter for query options, pushing waitForOptions to 3rd parameter, I had to bring back deprecated wait for parsing from the past to avoid triggering breaking change.

@mdjastrzebski mdjastrzebski force-pushed the Feat/textmatcherOptions_for_label_and_hint branch from f126b50 to 9252947 Compare October 31, 2022 09:18
@codecov
Copy link

codecov bot commented Oct 31, 2022

Codecov Report

Base: 93.90% // Head: 94.04% // Increases project coverage by +0.14% 🎉

Coverage data is based on head (363da3c) compared to base (8e5c9f9).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1193      +/-   ##
==========================================
+ Coverage   93.90%   94.04%   +0.14%     
==========================================
  Files          41       41              
  Lines        2706     2773      +67     
  Branches      410      418       +8     
==========================================
+ Hits         2541     2608      +67     
  Misses        165      165              
Impacted Files Coverage Δ
src/matches.ts 100.00% <100.00%> (ø)
src/queries/hintText.ts 100.00% <100.00%> (ø)
src/queries/labelText.ts 100.00% <100.00%> (ø)
src/queries/makeQueries.ts 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@mdjastrzebski mdjastrzebski 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 for me!

@ShaswatPrabhat I've added hacktoberfest-accepted tag to mark it eligible for hacktoberfest despite not being merged yet.

@AugustinLF could you take a look if everything is fine for you?

@mdjastrzebski
Copy link
Member

Seems like we still need to update docs

@mdjastrzebski
Copy link
Member

I've updated docs

@mdjastrzebski mdjastrzebski merged commit 52222b4 into callstack:main Oct 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants