simonihmig / ember-native-dom-helpers-codemod

Codemod to transform your jQuery based ember tests to use ember-native-dom-helpers
MIT License
27 stars 9 forks source link

$() is transformed to find('*') #42

Open XuluWarrior opened 6 years ago

XuluWarrior commented 6 years ago

Currently the empty selector is transformed to ''. This does not return the same node(s). e.g. find() would return the context node. `find('')` will return the first child of the context.

wagenet commented 6 years ago

I believe getRootElement is the correct replacement.

XuluWarrior commented 6 years ago

I don't believe it is. The testing "root" is not the same as the document root. If no context is provided then find() prepends settings.rootElement to the selector

  if (contextEl instanceof HTMLElement) {
    result = contextEl.querySelector(selectorOrElement);
  } else {
    result = document.querySelector(`${settings.rootElement} ${selectorOrElement}`);
  }
wagenet commented 6 years ago

@XuluWarrior you are correct, I was mistaken.