Open baerrach opened 4 years ago
The container will auto-register services if you call get
and there’s not a prior registration. However, the fact that the testing helper is able to access them from a container instance that doesn’t appear to be related is odd. I know how this is working (it’s kind of a bad design we have in the framework that we’ve eliminated for vNext) but that doesn’t make it particularly easy to understand.
@bigopon @zewa666 What do you guys think? Can we make some improvement here? Intuitively, one would expect the StageComponent API to receive an instance of the custom container. I can’t recall if we have a way to do that or not though. If we do, it would probably be clearer if we updated this example to use that.
https://aurelia.io/docs/testing/components#using-a-real-parent-view-model
In "A Custom Attribute Test with Real Parent View-model and DI dependencies"
The example is
Shouldn't the
.get
calls be.registerInstance
instead? How doesStageComponent
know about the newly created Container?