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

Replacement for this.$() #327

Closed
nlfurniss opened this issue Feb 21, 2018 · 7 comments
Closed

Replacement for this.$() #327

nlfurniss opened this issue Feb 21, 2018 · 7 comments
Labels

Comments

@nlfurniss
Copy link
Contributor

Currently, there isn't a great replacement for this.$() in integration tests. What you have to do now is find(.class, this.element || this_element) (depending on our version of ember-qunit). Additionally, the ember-test-helpers-codemod does not handle this case, which makes switching away from the jQuery helpers tedious and a lot more work.

What do you think about adding a findInComponent integration helper?

@Turbo87
Copy link
Member

Turbo87 commented Feb 21, 2018

you can do this.element.querySelector() instead

@nlfurniss
Copy link
Contributor Author

Well I'd have to do this._element since we're ember-qunit@2. And then when we want to upgrade, we'd have to find/replace everything.

But my larger concern is being able to code-mod these changes. We're going to have to change 10K tests, and the code-mod has been a sanity-saver. Having to run the code-mod, clean up the code, then adding an extra step of doing my own find/replace with this._element.querySelector makes removing jQuery that much more difficult.

@Turbo87
Copy link
Member

Turbo87 commented Feb 21, 2018

if you're using ember-qunit@2 you can't use @ember/test-helpers anyways 🤔

I would recommend to use https://github.com/simplabs/qunit-dom for assertions, which should work with both variants. see also ember-cli/rfcs#116

@nlfurniss
Copy link
Contributor Author

We're using ember-native-dom-helpers currently, but since this is more or less a port of that, once we move to ember-qunit@3 then utilizing this addon will be simple.

Thats a totally different library, and would be a much larger change than running a code-mod over a lot of tests.

Can you help me better understand your reticence to something like findInComponent?

@Turbo87
Copy link
Member

Turbo87 commented Feb 21, 2018

we already have find and this.element.querySelector(). I just don't see a reason to add yet another API for the same thing.

@nlfurniss
Copy link
Contributor Author

@Turbo87 if you're using ember-qunit@2 you can't use @ember/test-helpers anyways 🤔

Why is that? And is it documented anywhere?

@Turbo87
Copy link
Member

Turbo87 commented Feb 21, 2018

because emberjs/ember-qunit@98f6bbc added the dependency and the first release to include this was v3.0.0-beta.3

@Turbo87 Turbo87 closed this as completed Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants