I have a <div>
element that has a (click)
event attached to it which toggles some class variable, like the following:
<div (click)="some-variable-name = !some-variable-name"></div>
For testing the click event first I have to grab the div
event by its CSS class, something like this:
let some-var = fixture.debugElement.query(By.css('.css-class-name'));
So is there a way by which I can spy on the class variable some-variable-name
and check if it changes on the click event while testing, with something like this:
let switch-some-variable-name = component.some-variable-name;
some-var.nativeElement.click();
fixture.whenStable().then(() => {
expect(component.some-variable-name).toEqual(!switch-some-variable-name);