-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Regression with v0.5.26 #161
Comments
I am definitely interested in the specific use case for having each subsequent I'm not 100% sure how to replicate that older behavior, support Ember 2.7.0-beta.1, and avoid leaking... |
How do you observe this appending? I believe that calling
FWIW, I do not think it is silly. We added the |
@rwjblue Absolutely! For some of our integration tests we have boilerplate components that must be rendered to test the end-to-end aspects of the integration. We render these boilerplate components in the An example of that is our upload manager. We have a moduleForComponent('service:modal', name, {
integration: true,
beforeEach() {
this.render(hbs`{{upload-status}}`);
}
}
test('Test Upload-Button', function(assert) {
this.render(hbs`{{upload-button}}`);
/* ... MOCK UPLOAD ... */
/* TEST {{upload-status}} state */
}); So instead of rendering We had originally tried to implement a function helper that would basically concat the two templates and call This is also just a one line trivial example. Doing |
Gotcha. Thank you for explaining. I agree that this is a useful scenario to solve. I think I might do something like: moduleForComponent('service:modal', name, {
integration: true,
beforeEach() {
this.header = `{{upload-status}}`;
}
}
test('Test Upload-Button', function(assert) {
this.render(hbs(`${this.header}{{upload-button}}`));
/* ... MOCK UPLOAD ... */
/* TEST {{upload-status}} state */
}); Or possibly: moduleForComponent('service:modal', name, {
integration: true,
beforeEach() {
this.renderWrappedTemplate = (template) => {
this.render(hbs(`{{upload-status}}${template}`));
};
}
}
test('Test Upload-Button', function(assert) {
this.renderWrappedTemplate(`{{upload-button}}`);
/* ... MOCK UPLOAD ... */
/* TEST {{upload-status}} state */
}); But of course that avoids the issue of this being a breaking change between 0.5.24 and 0.5.25/26, which is both annoying and unfortunate... |
Hmmm. I am not certain that those snippets work work actually. Since the |
@rwjblue Yeap, they will not work. We tried that too. It must be evaluated at preprocessor time. |
Oh yuck. I had it in my head this was related to ember-beta. But now it seems to be happening for me even with Ember 2.5 (our current version). I think I'll just add |
Yeah, we use the same underlying implementation for 1.13 and above (we use the same implementation as 0.5.24 for < 1.13). |
I'm struggling on coming up with a way forward here. The prior system (used in ember-test-helpers@0.5.24 and prior) which simply appended DOM into the
In ember-test-helpers@0.5.25+ the underlying implementation that we are using now is to treat the rendered templates like a normal route template, and use the outlet rendering system to render things. The solves both of the issues listed above, but unfortunately makes it so that you cannot combine In theory, I could add support for something similar by allowing Definitely open to suggestions here... |
@workmanw - One possible solution for your scenario might be: moduleForComponent('service:modal', name, {
integration: true,
beforeEach() {
this.register('template:components/x-header', hbs`{{upload-status}}`);
}
}
test('Test Upload-Button', function(assert) {
this.render(hbs`{{x-header}}{{upload-button}}`);
/* ... MOCK UPLOAD ... */
/* TEST {{upload-status}} state */
}); That still allows for things to be a bit more DRY, and avoids the need for runtime concatenation. Thoughts? |
@rwjblue Yea I did read through the commits and I think I understand what you're saying. I'm in complete agreement that appending the way it use to was wrong. And having the test suit try to act like an old After reflecting on this, I really feel like the real problem here is not that I can't call moduleForComponent('service:modal', name, {
integration: true,
beforeEach() {
this.register('template:components/x-header', hbs`{{upload-status}}`);
this.__orig__render = this.render;
this.render = function(str) {
this.__orig__render(hbs`{{x-header}}${str}`);
}
},
afterEach() {
this.render = this.__orig__render;
this.__orig__render = null;
}
}
test('Test Upload-Button', function(assert) {
this.render(hbs`{{x-header}}{{upload-button}}`);
/* ... MOCK UPLOAD ... */
/* TEST {{upload-status}} state */
}); I know that probably looks hacky ... but for some of our tests, we implement our own test modules that extend Just talking it out here ... using this.render = function(template) {
this.register('template:x-body', template);
this.__render(hbs`{{x-header}} {{partial "x-body"}}`);
} I wonder if the registry / container would cache that @rwjblue At this point, I'm okay with closing this issue if you are. I very much understand every piece of functionality cannot be completely maintained. I would not at all be upset if this was deemed as one of those things that's just low ROI and won't fix. |
@rwjblue et al -- Circling back around on some of my open issues and ran back into this guy. My solution was actually to use a partial in just the way I described above. Overriding the |
Thanks @workmanw |
We were alerted to some test failures this week with ember-beta (2.7.0-beta.1). After diving in I discovered the cause was actually due to a change with ember-test-helpers.
Prior to this latest release, if you called
this.render
more than once in a single test it would append the rendered component. Now if you callthis.render
more than once it replaces that component.So you could argue that calling
this.render
multiple times in a single test is silly and we should restructure our tests. I can happily explain my use case if anyone is interested. But regardless this caused some test failures for us, I would expect it to do the same for others.The regression was introduced with: 696da08 . CC: @rwjblue
The text was updated successfully, but these errors were encountered: