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

[Glimmer2] Migrating log helper #13131

Merged
merged 1 commit into from
Mar 19, 2016
Merged

Conversation

green-arrow
Copy link
Contributor

This commit migrates the log helper to Glimmer2 and moves the tests over as well.
Tests located in debug_test.js in ember-htmlbars have been removed, as they are duplicates.
Currently, these tests do not pass under ember-glimmer, because the helper renders
'undefined' as opposed to no text like in ember-htmlbars

@green-arrow
Copy link
Contributor Author

@chancancode - I can either make these htmlbars only tests for now, or I can try and fix the underlying issue of 'undefined' being output by a helper if someone can point me in the right direction.

}
});

QUnit.test('should be able to log multiple properties', function() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handled by @test correctly logs multiple arguments

Copy link
Member

Choose a reason for hiding this comment

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

👍

constructor() {
super();

originalLog = Logger.log;
Copy link
Member

Choose a reason for hiding this comment

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

nit: now that we have a class, we can just put it on the instance (this.originalLogs and this.logCalls)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix. As soon as I looked back over this commit I knew I should have done that.

@chancancode
Copy link
Member

Looks great to me besides some minor nit picks!

or I can try and fix the underlying issue of 'undefined' being output by a helper if someone can point me in the right direction.

Let's get this merged asap and tackle that anther time. Either making the entire module @htmlbars or return ""; // FIXME: ... in the helper seems fine to me.

The underlying problem requires some thinking, but having the primitive rendering test (my "Basic Rendering Test" checklist item) as @htmlbars would be quite helpful for that.

constructor(assert) {
super(...arguments);

this.assert = assert;
Copy link
Member

Choose a reason for hiding this comment

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

I would just do this in the super (super super super) class. I think having this.assert just makes sense for all the subclasses.

@green-arrow
Copy link
Contributor Author

@chancancode - All PR comments should be addressed now, just waiting on the builds to finish.

@chancancode
Copy link
Member

👍 can you squash your commits while we wait?

@green-arrow
Copy link
Contributor Author

Squashed

constructor(assert) {
super();

this.assert = QUnit.assert;
Copy link
Member

Choose a reason for hiding this comment

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

@rwjblue informed me that QUnit.Assert is not what we want here. Apparently we should be doing this.assert = QUnit.config.current.assert instead.

Also, I think I confused you. I was saying that we can do this line in the constructor in the super super super super class (TestCase) since it just makes sense to do it for everyone.

As you pointed out, there is a let assert = QUnit.assert; in the abstract-test-case file, which would also be wrong according to Robert. However, if we have this.assert available all the time, we can just update the other helpers in that file to use that instead.

Does that make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chancancode - ah yes, that makes more sense. Let me make those changes real quick.

@green-arrow
Copy link
Contributor Author

@chancancode - Most recent commit has these changes. If those look good to you, I'll go ahead and squash again 😄

} else if (name.indexOf(packageTag) === 0) {
QUnit.test(name.slice(packageTag.length), assert => context[name](assert));
QUnit.test(name.slice(packageTag.length), assert => context[name](context.assert));
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 this part is not really necessary (this is the assert that you get in your normal test function, and that's supposed to be identical to the QUnit current thing we did in the other place

Copy link
Member

Choose a reason for hiding this comment

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

Otherwise seems great! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify, are you saying we should pass QUnit.config.current.assert here instead of the one on the context?

Edit: Nevermind, didn't grok that it was already passed in

Copy link
Member

Choose a reason for hiding this comment

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

the original code is fine - the assert actually comes as a method argument from the caller (the QUnit runner), not from the global scope. The es6 arrow function syntax probably made that a bit too hidden :)

@homu
Copy link
Contributor

homu commented Mar 19, 2016

☔ The latest upstream changes (presumably #13129) made this pull request unmergeable. Please resolve the merge conflicts.

This commit migrates the log helper to Glimmer2 and moves the tests over as well.
Tests located in debug_test.js in ember-htmlbars have been removed, as they are duplicates.

There is a 'FIXME' in the log helper that will need to be fixed once
basic component rendering has been addressed.
@green-arrow
Copy link
Contributor Author

@chancancode - Fixed assert passed to each test and rebased / squashed
@homu - Merge conflicts resolved

wycats added a commit that referenced this pull request Mar 19, 2016
[Glimmer2] Migrating log helper
@wycats wycats merged commit afc5c54 into emberjs:master Mar 19, 2016
@chancancode
Copy link
Member

Thanks!

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.

5 participants