-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[BUGFIX] {{link-to}} before application boot #11639
Conversation
This was initially targeted at the beta channel because @tomdale was not super confident with this change. I'm not opposed to pulling it into stable, but he should definitely chime in... |
The consequence of leaving this as a 2.0-only solution is that we can't have any tests of components with {{link-to}} inside of 1.13. I'm actually surprised that there hasn't been a more-general revolt about the inability to test components with links in them in 1.13... and if that means very few people are moving to 1.13 yet, or they aren't testing... |
c60583f
to
287a0a0
Compare
Previously, {{link-to}} would work even if the application had not been booted completely. This behavior is relied on by test harnesses like ember-qunit, since an “integration test” of a component may include a template that uses {{link-to}}. Many people have discovered that they would like to test a component that has a link without booting the entire app. > You wanted a banana but what you got was a gorilla holding the banana > and the entire jungle. –Joe Armstrong During the Glimmer work, we refactored the interface between the LinkComponent and the router into a service. Unfortunately, this caused a regression where rendering the link before the router was completely initialized would raise an exception. This commit adds a very stupid guard to ensure that we have enough router state to determine if a link is active or not. This whole path could be significantly cleaned up, and in particular, we should move towards using a stubbed routing service in tests that encapsulates all of these concerns. Conflicts: packages/ember/tests/helpers/link_to_test.js
287a0a0
to
b96d097
Compare
Tests are coming separately based on my self-destructing reproduction so that I can more easily land them in both master and stable. |
👍 |
dd4f0f5
to
e60c73e
Compare
Assuming tests pass this is good to land now, it includes a test for the last scenario. I don't believe that an acceptance test for this is required at this point. |
Restarted sauce labs job. |
[BUGFIX] {{link-to}} before application boot
Previously, {{link-to}} would work even if the application had not been
booted completely. This behavior is relied on by test harnesses like
ember-qunit, since an “integration test” of a component may include a
template that uses {{link-to}}. Many people have discovered that they
would like to test a component that has a link without booting the
entire app.
During the Glimmer work, we refactored the interface between the
LinkComponent and the router into a service. Unfortunately, this
caused a regression where rendering the link before the router was
completely initialized would raise an exception.
This commit adds a very stupid guard to ensure that we have enough
router state to determine if a link is active or not. This whole path
could be significantly cleaned up, and in particular, we should move
towards using a stubbed routing service in tests that encapsulates all
of these concerns.
Conflicts:
packages/ember/tests/helpers/link_to_test.js