-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Polyfilled test selector optimizations #949
Conversation
9db459d
to
8278757
Compare
Thanks, @izelnakri. Would you mind rebasing/resolving conflicts? |
8278757
to
50358bf
Compare
@scalvert rebased 👍 |
Thanks! One thing I like better about this approach than the first PRs is that once we eventually drop support for IE11, we can just delete the polyfills. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I worry a little bit about automatically polyfilling these array methods. If a consuming app that intends to support IE11 adds some usage in their app of [].find
(for example) the tests will pass (even if they are testing against IE11) but when deployed the app will throw/fail.
🤔
This is a good point i think but bit rare case. We could make them exported find() and/or toArray() from the same module name, thats an option. Solves both issues, what do you think @rwjblue? export function find(array, func) {
return array?.find?.(func) || findFunction(array, func);
// or:
return Array.prototype.find ? array.find(func) : findFunction(array, func); // this is probably more performant / i like this more
}
export function toArray(array, func) {
} |
Ya, that seems good to me @izelnakri. Thank you! |
e124cb2
to
94c6873
Compare
@rwjblue updated the changes. In the CI tests are passing, however for other CI actions there is a weird broccoli specific error that I couldn't understand. It doesn't seem to be related to the changes, would appreciate if you take a look: https://github.com/emberjs/ember-test-helpers/pull/949/checks?check_run_id=1542886060#step:5:121 |
@izelnakri this was a bug in ember-auto-import if I'm not mistaken. I think there's been a fix that's shipped already. It looks like it was released in 1.9.0 of that package. |
@izelnakri if you rebase this branch onto master I think you should be g2g. |
94c6873
to
9fb88fb
Compare
@scalvert done, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome, thanks for working through this @izelnakri!
Array.from
andArray.prototype.find
.findAll()
andwaitFor
to useArray.from
triggerKeyEvent
to usearray.find()
instead ofarray.filter(predicate)[0]
;