-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Labels
area: testingIssues related to Angular testing features, such as TestBedIssues related to Angular testing features, such as TestBed
Description
I'm running RC6 and want to test a component templateUrl behaviour,
I.e Loading templates using TemplateUrl
There seems to be a fix for this as in #6601. However the code below doesn't work. Fundamentally it doesn't load the temple via templateUrl.
There is a lot of discrepancy around where to use inject, fakeAsync or aysnc.
There a solution to use a karma plugin and use a redirect for the templeUrl but I am not keen on this.
import { Component, Input, OnInit} from "@angular/core";
import { TooltipService } from "./tooltip.service";
@Component({
selector: "tooltip",
templateUrl: "./tooltip.component.html",
providers: [TooltipService]
})
export class TooltipComponent {}
const INITIAL_QUESTIONS: any = { step: {
questions: [
{
key: "q1",
questionId: "question1",
displayText: "Question 1's value",
answerChoices: [
{ answerId: "abc$def", displayText: "Answer 1", selected: true },
{ answerId: "123$def", displayText: "Answer 2", selected: false }
]
}
]
}};
fdescribe("ToolTipComponent", () => {
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [
TooltipComponent
],
providers: [
{ provide: TooltipService, useClass: MockToolTipService }
]
});
this.fixture = TestBed.createComponent(TooltipComponent);
});
it("should render the template", async(() => {
this.fixture.whenStable().then(() => {
let element = this.fixture.nativeElement;
this.fixture.detectChanges();
expect(element.querySelectorAll("div").length).toBe(1);
});
}));
});
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area: testingIssues related to Angular testing features, such as TestBedIssues related to Angular testing features, such as TestBed