Skip to content

[Glimmer2] Move willDestroyElement tests.#13156

Closed
krisselden wants to merge 1 commit intomasterfrom
will-destroy-element
Closed

[Glimmer2] Move willDestroyElement tests.#13156
krisselden wants to merge 1 commit intomasterfrom
will-destroy-element

Conversation

@krisselden
Copy link
Contributor

This is more a direct port, I'd rather test all the lifecycle hooks, (at least do didInsertElement along with willDestroyElement) for built-ins that can add/remove components.

@krisselden krisselden force-pushed the will-destroy-element branch from d4c9f4a to c477447 Compare March 21, 2016 23:40
let willDestroyElementCount = 0;
let FooBarComponent = Component.extend({
didInsertElement() {
assert.notEqual(this.element.parentNode, null, 'precond component is in DOM');
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you moved the assertion into here (as opposed to have the hooks set an outer var and assert as part of the testing flow)? If the hook did not fire, it won't fail the test. The willDestroyElement hook happens to not have this problem because of the counter, but it seems easy for future contributors to accidentally mess that up. The previous "set an outer var" approach seemed better to me

@chancancode
Copy link
Member

This was merged into our branch in #13168 👍

@chancancode chancancode deleted the will-destroy-element branch March 26, 2016 15:17
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.

2 participants