Skip to content

[Glimmer 2] Differentiate between bound class and classNames#13372

Merged
chancancode merged 1 commit intoemberjs:masterfrom
chadhietala:failing-sexpr-if
Apr 21, 2016
Merged

[Glimmer 2] Differentiate between bound class and classNames#13372
chancancode merged 1 commit intoemberjs:masterfrom
chadhietala:failing-sexpr-if

Conversation

@chadhietala
Copy link
Contributor

@chadhietala chadhietala commented Apr 19, 2016

This fixes a behavior where a bound class can mutate, where as bound classNames are const'd post creation. Also migrating some of the attr_node tests that were testing class behavior.

@chadhietala chadhietala changed the title [WIP Glimmer 2] Different behavior with inline #if [Glimmer 2] Differentiate between bound class and className Apr 19, 2016
@chadhietala chadhietala changed the title [Glimmer 2] Differentiate between bound class and className [Glimmer 2] Differentiate between bound class and classNamea Apr 19, 2016
@chadhietala chadhietala changed the title [Glimmer 2] Differentiate between bound class and classNamea [Glimmer 2] Differentiate between bound class and classNames Apr 19, 2016
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 should be an EmptyObject (not a dictionary) since we do not need delete from it.

Copy link
Member

Choose a reason for hiding this comment

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

See the comments in these two files for a relatively good explanation:

ember-metal/dictionary (when used with null parent) creates an EmptyObject then adds an item and deletes it to force the runtime into keeping it in dictionary mode. Since we don't need this object to be a dictionary, we can just use new EmptyObject() directly.

Copy link
Member

Choose a reason for hiding this comment

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

We probably don't need it to be an actual dict since we know all the fields (like meta). We can just make an actual class for it

Copy link
Member

Choose a reason for hiding this comment

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

The object is not exposed to users either, so it's probably not very important for it to be an empty object either

Copy link
Member

Choose a reason for hiding this comment

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

We do want the object to have a fixed shape though even when some of those meta info are not present.

Copy link
Member

Choose a reason for hiding this comment

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

👍 to using a class for this...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@chadhietala
Copy link
Contributor Author

chadhietala commented Apr 20, 2016

This is going to fail until we bump glimmer but figured I would post it.

update: Glimmer has been bumped.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Hm, the original test explicitly claim to care about ordering – and the new test does not (via the classes helper which sorts them). Like I mentioned above, I don't think we have a reason to care, but if for some reason we have I think the test will still pass (you would use a string instead of classes which does an exact match). @rwjblue can we drop this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

✔️

@chadhietala chadhietala force-pushed the failing-sexpr-if branch 2 times, most recently from 9f52d57 to 1b36258 Compare April 21, 2016 00:13
@chadhietala
Copy link
Contributor Author

I would like to 💣 that whole test file as I don't believe the first test is valid any more as it's testing View context stuff.

@chadhietala chadhietala force-pushed the failing-sexpr-if branch 2 times, most recently from 4ff61a9 to e12cc37 Compare April 21, 2016 17:11
Copy link
Contributor Author

@chadhietala chadhietala Apr 21, 2016

Choose a reason for hiding this comment

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

Migrated. But maybe this can be 💣

Copy link
Member

Choose a reason for hiding this comment

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

✔️

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.

3 participants