-
-
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
FactoryFor does not trigger didReceiveAttrs
hook anymore
#17534
Comments
@mades-g thanks for the code examples, the next step will be create a working reproduction of the issue, perhaps we can make with with ember-twiddle.com |
@mades-g I don't think this is a bug in Ember, however I think the way you test for the failure may need to change. I'll post an attempt to test it. |
@mades-g See this test https://github.com/ember-triage/issues-17534/blob/master/tests/unit/components/x-foo-test.js#L7-L17 test('didReceiveAttrs throws', function(assert) {
let component = this.owner.factoryFor('component:x-foo').create();
assert.ok(component);
assert.throws(
() => {
component.didReceiveAttrs();
},
/fooBar should not be empty/
);
}); |
@pixelhandler Thanks for the feed back, the test type for this specific issue, is |
Edit: Just saw your comment comment, I know what you did works, but I wonder why it was passing in 3.1.2 🤔 |
didReceiveAttrs used to be called from inside the constructor, and now it isn’t. The change was done intentionally (and helped with other overall objectives), so I doubt we’d want to revert... In general it’s best to test rendering related things by actually rendering (e.g. |
Cheers for the clarification everyone. |
I ran into this issue too, and was wondering what's going on. Thanks for clarifying @rwjblue. I saw 2cd6e2f#diff-7536fca9f7b528326424427194fd9ac2 explains the rationale. |
Same test, different emberjs versions, on
[email protected]
this "tests" would pass but recently upgraded to[email protected]
and now the "test" is failing.Previously [email protected]
Currently [email protected]
[email protected]
[email protected]
e.g test module
Same test different emberjs versions, on
[email protected]
this "tests" would pass but recently upgrade to[email protected]
and now the "test" is failing.The solution was to trigger the desirable hook (
didReceiveAttrs
) with in assert.throw:e.g
The text was updated successfully, but these errors were encountered: