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

Support jQuery >= 3.0.0 #122

Merged
merged 1 commit into from
Mar 20, 2016
Merged

Support jQuery >= 3.0.0 #122

merged 1 commit into from
Mar 20, 2016

Conversation

mgol
Copy link
Contributor

@mgol mgol commented Aug 25, 2015

I need some help here. I tried to mimick when config; when I run npm run test-browser-jquery, I get 3 failures (much better than >100 of them with jQuery 2.1.4 but still):
screen shot 2015-08-25 at 21 53 47
screen shot 2015-08-25 at 21 53 57

First of them is in lib/chai-as-promised.js#L308 where args is set to "test it" and should be an array-like.

What's the expected definition of global.waitAll? Test results didn't change when I removed it; is it needed?

I wasn't sure what version you want to include so I used the link to the latest master one as I believe that's what you have for when. I can change it to 3.0.0-alpha1 if you prefer it to be more deterministic.

There are two bugs related to jQuery Deferreds that I linked in the adapter file (they should both be fixed before the final 3.0.0) but they're both with jQuery.when, not thenable.then; the latter should work.

@domenic
Copy link
Collaborator

domenic commented Sep 8, 2015

What's the expected definition of global.waitAll? Test results didn't change when I removed it; is it needed?

This is used in configurable-asserter-args.coffee. It should be set to the library's equivalent of Promise.all.

Not really sure about the failures otherwise.

@mgol mgol changed the title WIP: Support jQuery >= 3.0.0 Support jQuery >= 3.0.0 Mar 14, 2016
@mgol
Copy link
Contributor Author

mgol commented Mar 14, 2016

This now passes all the tests with jQuery 3.0.0-beta1. I had to add one more global as jQuery Deferreds have a promise method, not a static property.

@@ -25,5 +25,8 @@ exports.adapter = """
return deferred.promise;
};
global.defer = when.defer;
global.getPromise = function (deferred) {
return deferred.promise;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't test these changes as they're currently broken even on master.

@domenic
Copy link
Collaborator

domenic commented Mar 14, 2016

Please don't add a new global. Instead, have defer return an object that follows the standard deferred pattern, instead of just aliasing it to jQuery.Deferred.

@mgol
Copy link
Contributor Author

mgol commented Mar 15, 2016

@domenic Done.

@domenic domenic merged commit c642b72 into chaijs:master Mar 20, 2016
@mgol mgol deleted the jquery-support branch March 20, 2016 22:51
@domenic
Copy link
Collaborator

domenic commented Mar 20, 2016

Thanks!

@mgol
Copy link
Contributor Author

mgol commented Mar 20, 2016

Thanks for landing!

It would be sweet if you could update the header at your popular post at https://blog.domenic.me/youre-missing-the-point-of-promises/; specifically the part "they will forever remain broken" is no longer true.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants