Checking if multiple elements are rendering using jasmine

The solution for “Checking if multiple elements are rendering using jasmine” can be found here. The following code will assist you in solving the problem.

it(‘should check if all div are appearing which are dependent on a common condition’, () => {
component.someCommonCondition = true;
fixture.detectChanges();
// now the prob lies in line below since it only gets the first element of the mentioned class
const contentChecks = fixture.debugElement.queryAll(By.css(‘.someClass’))
expect(contentChecks.length).toBe(3);
})

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

0
inline scripts encapsulated in