I am new on Angular and I have been trying to test this component:
<ng-container *ngIf="parentProps" >
<div *ngIf="parentProps.editMode === 1" >
<br />
<form class="detalhes-container">
<ng-container *ngFor="let info of parentProps.applicationsData; let i = index; trackBy: trackByFn">
<div
class="detalhes-bloco"
*ngIf="parentProps.activeStepIndexSkills === i"
[formGroup]="parentProps.masterFormEdit[i]"
>
<p class="teste" >teste</p>
<div
class="detalhes-conhecimento-container"
formGroupName="conhecimento"
></div>
</div>
</ng-container>
</form>
</div>
</ng-container>
It is working great, but when it comes to test it I just don't get how to do.
The only thing I need here is to reach the p element with the class teste, however I always get this error: Error: formGroup expects a FormGroup instance. Please pass one in.
It seems that I have to instantiate the formGroup and I tried to do that in the spec.ts file, but it just doesn't change anything.
Maybe it is worth mentioning, parentProps.masterFormEdit is an array with a undetermined number of objects and each index (i) is a form. I am receiving it through @input.
I have read and watched a bunch of tutorials, but none of them could give me the answer I need, or maybe they did, but since I am a beginner I may just not have seen.
Anyways, anyone could help me, please? I am going crazy with that already.
Thank you!
Aucun commentaire:
Enregistrer un commentaire