Skip to content

Conversation

@brenocota-hotmart
Copy link
Contributor

What:
As mentioned in this issue, when we have a list, the tool does not show us other possible query options.

Example:
image

Why:
To improve the developer experience, the following function was added, basically we check if there is any valid query, if there is none, it works with the previous implementation.

function checkQuery(queries) {
  const suggestions = Object.values(queries).filter(Boolean);
  const suggestion = Object.values(queries).find(Boolean);
  
  const anotherSuggestion = suggestions.find(
    (query) =>
      query?.queryName && !query.snippet?.startsWith('// sorry, I failed'),
  );

  return anotherSuggestion ? anotherSuggestion : suggestion;
}

Print screen:
image

As it maintains the order of the elements, the best query will be used

How:
Implementation is complete and tests continue to pass

Checklist:

  • Tests
  • Ready to be merged

@brenocota-hotmart
Copy link
Contributor Author

Hi, @smeijer how are you? You could review this PR?

@smeijer
Copy link
Member

smeijer commented Sep 20, 2022

Thanks! Looks good to me. We can merge as soon as the tests finish.

@smeijer smeijer merged commit d85b47a into testing-library:develop Sep 20, 2022
smeijer added a commit that referenced this pull request Sep 20, 2022
* fix: sandbox not render another queries
smeijer added a commit that referenced this pull request Mar 2, 2023
* fix: sandbox not render another queries (#349)

* fix: sandbox not render another queries

* fixup! fix: sandbox not render another queries

* re-trigger github workflow

Co-authored-by: Breno Cota <brenogcota@gmail.com>

* chore: remove broken link to Firefox Extension (#359)

* chore: remove link to a closed roadmap (#354)

Co-authored-by: Luís Soares <lsoares@newstore.com>

* chore: remove roadmap link from specs (#361)

---------

Co-authored-by: Breno Cota <106157862+brenocota-hotmart@users.noreply.github.com>
Co-authored-by: Breno Cota <brenogcota@gmail.com>
Co-authored-by: lx4r <lx4r@users.noreply.github.com>
Co-authored-by: Luís Soares <lsoares@gmail.com>
Co-authored-by: Luís Soares <lsoares@newstore.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants