I have been working on unit testing for an Angular app, specifically trying to access styles from a .css file within the unit test. I will share with you what I have attempted so far.
component.listedIps.length=0;
fixture.detectChanges();
let whitelistipsdiv=fixture.debugElement.query(By.css('.divAllAllowedIPs'));
//Unit test for style: checking background-color to be green
expect(whitelistipsdiv.nativeElement.style.backgroundColor).toEqual('green');// Expected darkgreen but it's null
.css file
.divAllAllowedIPs {
background-color: green;
}