-
-
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 beta] {{link-to}} before application boot #11522
Conversation
registry.register('component-lookup:main', ComponentLookup); | ||
|
||
let component = Ember.Component.extend({ | ||
layout: compile('{{#link-to "about"}}Go to About{{/link-to}}'), |
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.
wacky double space after link-to
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.
Actually @mixonic this is intentional. Many people see code as a dead thing, cold symbols to instruct the unfeeling machine what to do. However, the truth is that code, like any living being, is coursing with energy and its own sense of purpose. Here, I could intuitively feel that the {{link-to}}
helper was feeling constrained by being forced into such close proximity with the argument, badly damaging the feng shui of this file.
lol j/k I fixed it
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.
LOL
lgtm! |
// This test is designed to simulate the context of an ember-qunit/ember-test-helpers component integration test, | ||
// so the container is available but it does not boot the entire app | ||
QUnit.test('Using {{link-to}} does not cause an exception if it is rendered before the router has started routing', function(assert) { | ||
Router.map(function(match) { |
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.
Not using match AFAICT
👍 /cc @nathanhammond |
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.
378dce8
to
c9dbecb
Compare
[BUGFIX beta] {{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.
Fixes #11150.