December 2017
Beginner
372 pages
10h 32m
English
In this test case, we will see how we test end-to-end from component to the template. The purpose of this test is to have a couple of boards and then we check if the boards are available on the user interface and also in the component property.
The following is the code for this test case:
it('should have 2 boards', () => { component.boards= new Array(); component.boards.push({ id:1, task:[], title:'Board 1' }, { id:2, task:[], title:'Board 2' }) fixture.detectChanges(); const compiled = fixture.debugElement.nativeElement; let title = compiled.querySelectorAll('.title') ; expect(title[1].textContent).toContain('Board 2'); expect(component.boards.length).toBe(2);});
The first thing we do is create ...
Read now
Unlock full access