question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

find and findAll helpers do not use HTML element context properly

See original GitHub issue

It seems that both the find and findAll helpers do not properly use context if you pass in an HTML element. For example:

find('.my-selector', myHTMLElement); // I want to look for .my-selector within myHTMLElement

Instead of looking within myHTMLElement, the helpers seem to look within the first element with myHTMLElement’s selector. When I switch back to using find from ember-native-dom-helpers, the above code works properly.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
rwjbluecommented, Jan 24, 2019

If Ember team wants to push away from jQuery towards using native querySelector/querySelectorAll, why is there even an effort to create find/findAll helpers? Shouldn’t the native way also be the one to use in tests?

Yes! That is exactly what I said in https://github.com/emberjs/ember-test-helpers/issues/351#issuecomment-456881507 above, in both of the RFCs (emberjs/rfcs#268 and emberjs/rfcs#232) and in https://github.com/emberjs/ember-test-helpers/issues/278.

0reactions
rwjbluecommented, Jan 24, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to query by text string which contains html tags using ...
This solution can work in simple scenarios, however if it produced the error "Found multiple elements with the text: (_, node) => node....
Read more >
Automation in Selenium: Page Object Model and Page Factory
Proper test automation is the key to quality software. Explore maintainable test automation in Selenium, including Page Object model and Page Factory.
Read more >
xml.etree.ElementTree — The ElementTree XML API ...
Element.findall() finds only elements with a tag which are direct children of the current element. Element.find() finds the first child with a particular ......
Read more >
Parsing HTML: a guide to select the right library
We are not going to see libraries for more specific tasks, ... a visitor and then the parser will call the proper function...
Read more >
Leadfoot docs: Source: compat.js - Intern
@deprecated Use the standard Leadfoot APIs. ... elementId) {; warn('Command#' + fromMethod + '(element)', 'Command#find then Command#' + fromMethod + ' ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found