-
-
Notifications
You must be signed in to change notification settings - Fork 177
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
SpectatorWithHost resetting inputs when detectChanges is set to true #31
Comments
I'm not sure this is the problem. As you can see here, it should work. Can you create a demo so that I can investigate more, please? |
@NetanelBasal I debugged this a bit, and it seems like this line is causing the issue (i.e. the inputs are set fine before it). You can find a repro for the complexInputs issue, forked from the StackBlitz you linked here: https://stackblitz.com/edit/spectator-9gg3yx?file=app/hello.component.spec.ts |
can you move this line to 101 and check, please? |
spectatorWithHost.hostFixture.detectChanges(); |
if(detectChanges) {
spectatorWithHost.hostFixture.detectChanges();
}
if (initialInputs) {
spectatorWithHost.setInput(initialInputs);
}
if (detectChanges) {
/** Detect changes on the component - useful for onPushComponents */
spectatorWithHost.detectComponentChanges();
} |
@NetanelBasal Seems like that works, but I'm not sure how you can run changeDetection before you set the inputs - after all, you want the detection to run on the component with the changes. |
Yes, but the actual component is: You moved the line of the host. |
@NetanelBasal I actually just checked this again against a real component I have and it seems like there's still some issue in this regard. I'll try and make a more exact repro on StackBlitz and add it when done. |
Already publish 1.8.1 with the fix. Let me know. |
@NetanelBasal FYI there's already a v1.11. Why not 1.11.1? |
I am using an automatic tool, and it was doing some crazy things. |
we will be aligned in v2.0 |
So 1.8.1 includes everything that 1.11 includes? At any rate, I suggest publishing a 1.11.1 (even if it's === 1.8.1), since no one will see the new fix otherwise (until the next version), and if you install 1.8.1, upgrading to an actual "lower" version is easily possible. @NetanelBasal This actually just bit us at work, we had |
Let me check. |
I need to revert the whole thing; there was a mistake. |
You can't unpublish a package on npm, just deprecate it. Please post an update when a new version's published, I'll update our projects. |
Why are you not upgrading to 1.11? |
OK, so published 1.11.1 as it supposed to be and deprecated 1.8.1. Excuse me for the mess. |
I upgraded to 1.11 originally, but it had the bug I faced that caused 1.8.1 to be released. I'll give it a try tomorrow. Thanks for the hard work! |
Thank you. |
This change broke some of our tests. |
Given the following component:
And the following test code:
The test
'input test'
fails, andsomeInput
isundefined
.passing
false
as thedetectChanges
parameter (tocreateHost
) results insomeInput
beingtrue
, but as soon as you run a changeDetection (viaspectator.detectChanges()
to check the DOM, the values reset.The text was updated successfully, but these errors were encountered: