New Rule: Use ember test-helper util function in tests instead of native window method
See original GitHub issueID: prefer-ember-test-helpers
Overview:
We would like to add a lint rule to assist in users writing tests in Ember using @ember/test-helpers
to ensure they are using the correct method, in particular with async calls.
A complete list of Window native methods are here: https://developer.mozilla.org/en-US/docs/Web/API/Window#Methods These are the methods in ember-test-helpers (notably the DOM related sections): https://github.com/emberjs/ember-test-helpers/blob/master/API.md
This is the list we’ve identified already that have overlap, please call out others if missing 😃
- blur
- find
- focus
Background:
In writing tests I discovered that a focus()
call was being made without an import from @ember/test-helpers
. This meant that it was actually the native focus()
method on window
being used, so trying to await
did not have the right behavior, nor were there any errors or warnings thrown since it’s a legitimate native method call.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
Sounds good! I’ll find some time in the next week to work on it and get back to you all. Thanks for the responses! ❤️
We can proceed with this issue, I closed #258.