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

[CLEANUP] Change resolver function deprecations in to assert #15911

Merged

Conversation

gowthamrm
Copy link

No description provided.

@gowthamrm gowthamrm mentioned this pull request Dec 1, 2017
34 tasks
@rwjblue
Copy link
Member

rwjblue commented Dec 1, 2017

Can you create a corresponding PR (or issue that links back here) at https://github.com/emberjs/ember-2-legacy?

@rwjblue
Copy link
Member

rwjblue commented Dec 1, 2017

@thoov - Do you think we need to ENV flag guard this one? How would we implement the legacy addon implementation otherwise?

@@ -24,10 +24,6 @@ export default class Registry {
this.fallback = options.fallback || null;
this.resolver = options.resolver || null;

if (typeof this.resolver === 'function') {
Copy link
Member

Choose a reason for hiding this comment

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

I think we are going to have to put an ENV guard around this. Here is an example of how I just did a similar thing.

Copy link
Member

Choose a reason for hiding this comment

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

Also here is an example of adding the config to ember-2-legacy

Copy link
Author

@gowthamrm gowthamrm Dec 1, 2017

Choose a reason for hiding this comment

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

@thoov @rwjblue I have updated the PR with the ENV guard and created a PR in ember-2-legacy to update the config with the ENV.

Please have a look.

@thoov
Copy link
Member

thoov commented Dec 1, 2017

@rwjblue Yes I think the simplest approach is to wrap it in an ENV. The only other ways would been to extend the registry past the point of it being worth the work.

@gowthamrm gowthamrm force-pushed the remove-resolver-function-in-registry branch from f37b492 to 6ca9e60 Compare December 1, 2017 21:35
@gowthamrm gowthamrm changed the title [CLEANUP] Remove the usage of resolver as function in registry [CLEANUP] Change resolver function deprecations in to assert Dec 1, 2017
@gowthamrm gowthamrm force-pushed the remove-resolver-function-in-registry branch 3 times, most recently from 872d4b1 to db3f7c8 Compare December 2, 2017 06:11
@gowthamrm
Copy link
Author

@rwjblue @thoov Can you check this out? Is there anything else need to be added?

expect(2);

ENV._ENABLE_RESOLVER_FUNCTION_SUPPORT = true;
Copy link
Member

@thoov thoov Dec 4, 2017

Choose a reason for hiding this comment

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

We will want to better reset this value. You can look at this example for how I was reseting the ENV properties in tests (https://github.com/emberjs/ember.js/pull/15903/files#diff-7c1b00291152c89da72c8940b7305c1a)

@thoov
Copy link
Member

thoov commented Dec 4, 2017

@gowthamrm One final thing then it looks good for me. Thanks!

@gowthamrm gowthamrm force-pushed the remove-resolver-function-in-registry branch from db3f7c8 to fb9a715 Compare December 4, 2017 08:32
@gowthamrm
Copy link
Author

@thoov Thanks for your comments, I have updated the test now. 👍

Copy link
Member

@rwjblue rwjblue left a comment

Choose a reason for hiding this comment

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

Looking good, thank you for working on this!

@@ -489,6 +503,20 @@ QUnit.test('A registry can be created with a deprecated `resolver` function inst
equal(registry.resolve('foo:bar'), 'foo:bar-resolved', '`resolve` still calls the deprecated function');
});

QUnit.test('A registry created with `resolver` function instead of an object throws assertion', function() {
Copy link
Member

Choose a reason for hiding this comment

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

do you mind updating to use the newer style with an assert argument here, and then assert.expect(1) below?


let registry;

throws(() => {
Copy link
Member

Choose a reason for hiding this comment

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

This should be swapped to use expectAssertion (so that it works properly in production builds since Ember.assert does not throw there).

@gowthamrm gowthamrm force-pushed the remove-resolver-function-in-registry branch from fb9a715 to 32fa778 Compare December 4, 2017 22:11
@gowthamrm
Copy link
Author

@rwjblue Thank you, I have updated the test with the suggested changes, Please have a look.

@rwjblue rwjblue merged commit 4906f0c into emberjs:master Dec 6, 2017
@rwjblue
Copy link
Member

rwjblue commented Dec 6, 2017

Thank you!

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.

4 participants