-
-
Notifications
You must be signed in to change notification settings - Fork 259
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
Add support for integration: 'legacy'
#115
Conversation
@rwjblue here's a PR for that Thanks. |
This semantics of the `integration` flag have changed in a backwards-incompatible way since v0.4.3. This corresponds to an ember upgrade (using ember-cli) between v1.12 and v1.13. In order to ease this upgrade path for ember-cli users, `integration: 'legacy'` will set up a component test with v0.4.3 semantics. Of course, newer tests would still be encouraged to be written with `integration: true`.
0c48794
to
a02630b
Compare
Now the tests even pass! As an aside the test failures indicate that this feature will not work with ember 2.0, which seems fine to me. thoughts? |
Obviously this commit is never intended to be merged to master: just here until emberjs/ember-test-helpers#115 is merged.
This is just a temporary commit so we can install while waiting for emberjs/ember-test-helpers#115.
What was the semantic change for the integration flag? |
@ef4 There are two things that impacted tests I had written.
|
But those semantics are literally the original definition of Prior to the introduction of that flag, all tests were unit tests, and they used |
@ef4 whatever the intended semantics, on version 0.4.3 with ember 1.12, you could use ie on version 0.4.3 you could write tests like moduleForComponent('my-component', {
integration: true, // no need to specify `needs` now
});
test("my-component has this flag set after you click a thing", function () {
const component = this.subject();
this.render();
Ember.run(function () {
component.$('button').click();
});
equal(component.get('flagB'), true, 'flagB is now set');
}); |
@ef4 - |
Specifically, the chain of events (as far as I can track down) is:
So from 0.3.6 through 0.4.3 you could use tldr; I really mucked things up 😞 |
} | ||
}, | ||
|
||
setupLegacyComponentTest: function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this differ from https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/test-module-for-component.js#L72-L120? It seems that these are essentially duplicated...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/test-module.js#L129-L135 determines if the container that is being used is isolated or has the full resolver (note how we clobber the underlying resolver
here after manually resolving all of the needs
specified items).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for beating around the bush so much here. I think that legacy mode should only need to do the following:
- Change the conditional https://github.com/switchfly/ember-test-helpers/blob/master/lib/ember-test-helpers/test-module.js#L129-L135 to just use
_setupIntegratedContainer
for legacy mode. - Use
setupComponentUnitTest
when in legacy mode.
The combination of those two changes, essentially sets us back to the behavior of ember-test-helpers 0.3.6 - 0.4.3.
@hjdivad -- Let me know if you have any questions about my last few comments here... |
Closing for now, happy to reopen if you want to pick this back up. |
@rwjblue hey sorry it took so long to find time to try this out again. I've redone the branch with the changes you mentioned and our test suite passes. The only other change I had to make was this one: https://github.com/hjdivad/ember-test-helpers/blob/integration-legacy/lib/ember-test-helpers/test-module-for-component.js#L202-L204 to prevent Should be good to reopen or I can open a new PR if you'd prefer. |
This is just a temporary commit so we can install while waiting for emberjs/ember-test-helpers#115.
Weird, apparently I can only reopen if there hasn't been a force push to the branch the closed PR was submitted from (which seems kinda dumb/weird). |
Submitted #121 to replace |
@rwjblue that is a strange restriction. |
D'OH!! The comment above was about the GH restriction of reopening PR's. 🤦 |
This semantics of the
integration
flag have changed in abackwards-incompatible way since v0.4.3. This corresponds to an ember upgrade
(using ember-cli) between v1.12 and v1.13.
In order to ease this upgrade path for ember-cli users,
integration: 'legacy'
will set up a component test with v0.4.3 semantics. Of course, newer tests
would still be encouraged to be written with
integration: true
.