-
-
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] Fix link-to throwing in integration tests #15902
Conversation
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.
To add a test I think we would need to have a test module that extends from rendering test (but not application test).
Something like what you linked, but slightly different:
import { moduleFor, RenderingTest } from '../../utils/test-case';
moduleFor('Link-to component', class extends RenderingTest {
['@test should be able to be inserted in DOM when the router is not present - block']() {
this.addTemplate('application', `{{#link-to 'index'}}Go to Index{{/link-to}}`);
this.render(`{{#link-to 'index'}}Go to Index{{/link-to}}`);
this.assertText('Go to Index');
}
['@test should be able to be inserted in DOM when the router is not present - inline']() {
this.addTemplate('application', `{{#link-to 'index'}}Go to Index{{/link-to}}`);
this.render(`{{link-to 'Go to Index' 'index'}}`);
this.assertText('Go to Index');
}
});
You can add ^ to the same file, just below the current moduleFor
...
@@ -48,13 +48,16 @@ export default Service.extend({ | |||
}, | |||
|
|||
generateURL(routeName, models, queryParams) { | |||
let router = get(this, 'router'); | |||
if (!router._routerMicrolib) { return; } |
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.
Can you add a comment above this to explain why its needed?
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.
done
6f47b09
to
3f46b8b
Compare
Thanks, that was very helpful! The |
Fixes emberjs#15831 Fixes a regression introduced by emberjs#15788 by returning early again from `routing.generateURL()` when `router._routerMicrolib` is not present.
3f46b8b
to
a0ace45
Compare
Merging here should auto publish the fix for |
FWIW this PR was targeting beta, but I see it has been cherry-picked to master already... |
Ya, I missed that while reviewing + merging on mobile (apparently GH's mobile view doesn't show the target branch?!!?!?). @kategengler fixed it for us though. |
@rwjblue just for clarification/learning: isn't a |
Fixes #15831
Fixes a regression introduced by #15788 by returning early again from
routing.generateURL()
whenrouter._routerMicrolib
is not present. This is the line that got lost during the refactoring.Was not able to write a regression test for this, as e.g. in this test
_routerMicrolib
is correctly setup, so was not able to write a failing test. If there is a way to setup the router in the same state as in integration tests (i.e. without_routerMicrolib
), then I would be happy for any hint! 😉Would be nice to get this into a minor beta release, as this is causing failing tests in ember-try scenarios for ember-beta now (was already failing for canary, but these were "allowed" failures. Now that canary has been promoted to beta, this is causing failed builds).
cc @rwjblue @bekzod