aurelia / aurelia/documentation
Testing > DI dependencies
- Dominant language
- No language data
- Stars
- 104
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Description
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
```
import {StageComponent} from 'aurelia-testing';
import {bootstrap} from 'aurelia-bootstrapper';
import {MyComponent} from 'src/my-component';
import {Container} from 'aurelia-dependency-injection';
import {MyService} from 'src/my-service';
describe('MyAttribute', () => {
let component;
let container;
let viewModel;
let myService;
beforeEach(() => {
container = new Container();
myService = container.get(MyService);
viewModel = container.get(MyComponent);
component = StageComponent
.withResources('src/my-attribute')
.inView('
.boundTo(viewModel);
});
//...
});
```
Shouldn't the `.get` calls be `.registerInstance` instead?
How does `StageComponent` know about the newly created Container?
Contributor guide
Research direction
Start with the “A Custom Attribute Test with Real Parent View-model and DI dependencies” example at the linked testing documentation page. Verify how Container, StageComponent, and the two container calls interact, then update the example or its explanation so the dependency setup is correct and the container relationship is clear.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100