Description
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
In my tests I use the beforeEach-Hook to create the component-fixture. This worked in the past but with the latest changes I'm unable to get that working again. Trying to do it like this:
beforeEach(async(inject([TestComponentBuilder, TaskService],
(_tcb:TestComponentBuilder, _taskService:TaskService) => {
return _tcb
.overrideDirective(TaskListComponent, RouterLinkWithHref, DummyRouterLink)
.overrideDirective(TaskItemComponent, RouterLinkWithHref, DummyRouterLink)
.createAsync(TaskListComponent)
.then(_fixture => {
fixture = _fixture;
console.log("fixture", fixture);
});
})));
doesn't wait for the component to be created (the fixture is printed but after the test fails)
Trying to use (done) callback from jasmine also doesn't work. In this case the inject-function is not called/executed at all:
beforeEach((done) => {
inject([TestComponentBuilder, TaskService],
(_tcb:TestComponentBuilder, _taskService:TaskService) => {
taskService = _taskService;
_tcb
.overrideDirective(TaskListComponent, RouterLinkWithHref, DummyRouterLink)
.overrideDirective(TaskItemComponent, RouterLinkWithHref, DummyRouterLink)
.createAsync(TaskListComponent)
.then(_fixture => {
fixture = _fixture;
console.log("fixture", fixture);
done();
});
})
});
this leads to:
Chrome 48.0.2564 (Linux 0.0.0) TaskList Component should call deleteTask when clicking the trash-bin FAILED Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
Expected/desired behavior
beforeEach callback should wait for returned promises / should be able to work with done-function
What is the motivation / use case for changing the behavior?
being able to initialize the component under test in beforeEach-Hook
Please tell us about your environment:
- Angular version: 2.0.0-rc.4
- Browser: [all ]
- Language: [TS]