For my unit test, I am trying to retrieve the value of [class.editable].
<div class="coolcomponent layout horizontal center" [class.editable]=editable>
.....
</div>
When using
fixture.nativeElement.querySelector('editable');
, my editableEl variable is always null. The same goes for fixture.nativeElement.querySelector('class.editable')
.
This is part of my unit test script:
hostComponent.editable = true;
fixture.detectChanges();
expect(hostComponent.testComponent.ngOnChanges).toHaveBeenCalled();
const editableEl = fixture.nativeElement.querySelector('class.editable');
expect(editableEl).toBe(true);
Is my selector incorrect, or do I need to further debug in my unit test? Thank you for any assistance!