Skip to content
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

fix: use getSuggestedQuery from @testing-library/dom #134

Closed
smeijer opened this issue Jun 11, 2020 · 6 comments · Fixed by #150
Closed

fix: use getSuggestedQuery from @testing-library/dom #134

smeijer opened this issue Jun 11, 2020 · 6 comments · Fixed by #150
Labels
bug Something isn't working

Comments

@smeijer
Copy link
Member

smeijer commented Jun 11, 2020

#113 already implemented this partially. But I noticed that it isn't applied yet in the ResultSuggestions component (the blue buttons on the bottom left)

suggestions

@smeijer smeijer changed the title feat: use getSuggestedQuery from @testing-library/dom fix: use getSuggestedQuery from @testing-library/dom Jun 11, 2020
@smeijer smeijer added the bug Something isn't working label Jun 11, 2020
@marcosvega91
Copy link
Member

marcosvega91 commented Jun 13, 2020

I'll fix it :)

to do this I think we need to call makeSuggestion function of @testing-library/dom but it is not exported. Do you had another idea? @smeijer

@smeijer
Copy link
Member Author

smeijer commented Jun 13, 2020

Wait for this one: testing-library/dom-testing-library#627 😇

@smeijer
Copy link
Member Author

smeijer commented Jun 13, 2020

Well, you didn't need to wait long. 😁🎉

@marcosvega91
Copy link
Member

Hahahaha ok. I'll update the library and fix the code

@marcosvega91
Copy link
Member

marcosvega91 commented Jun 13, 2020

Do you have any idea how to solve problem with contentWindow that is null? When I call getSuggestedQuery I have an error because the element is inaccessible.
The target element is taken from iframe. We need a way to replace it with the one from Preview component. Do you have any idea?

@smeijer
Copy link
Member Author

smeijer commented Jun 13, 2020

I think we shouldn't be taking it from the iframe. Instead, we can create an in memory div, and simulate the environment there.

The element can be selected with the cssPath.

(from my phone)

const view = document.createElement('div');
view.innerHTML = markup;
const target = view.querySelector(el.cssPath.toString());

const query = getSuggestedQuery(target, 'get', ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants