Last active
April 13, 2020 02:59
-
-
Save ManuelDeLeon/029d1e4649e839a376032226c47c9edd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
it("Displays each message in messages", () => { | |
const messagesService = TestBed.get(MessageService); | |
messagesService.messages = ["Alan", "Brito"]; | |
fixture.detectChanges(); | |
const divs: Array<HTMLDivElement> = fixture.debugElement | |
// The first div is the wrapper for the test component (e.g. <div _ngcontent-a-c1>) | |
.queryAll(By.css("div div div")) | |
.map((e) => e.nativeElement); | |
expect(divs.length).toBe(2); | |
expect(divs[0].textContent).toContain("Alan"); | |
expect(divs[1].textContent).toContain("Brito"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment