MOBILE-3947 behat: Fix RTE behat setField

main
Pau Ferrer Ocaña 2023-12-13 15:31:42 +01:00
parent b73e2c874b
commit d912d9d9af
2 changed files with 9 additions and 2 deletions

View File

@ -6,7 +6,7 @@
</div>
<ion-textarea [hidden]="rteEnabled" #textarea class="core-textarea" role="textbox" [attr.name]="name" ngControl="control"
[placeholder]="placeholder" [attr.aria-label]="placeholder" (ionChange)="onChange()" (ionFocus)="showToolbar($event)"
[placeholder]="placeholder" [attr.aria-labelledby]="ariaLabelledBy" (ionChange)="onChange()" (ionFocus)="showToolbar($event)"
(ionBlur)="hideToolbar($event)" />
<div class="core-rte-info-message" *ngIf="infoMessage">

View File

@ -231,11 +231,18 @@ export class CoreEditorRichTextEditorComponent implements OnInit, AfterViewInit,
return;
}
const updateArialabelledBy = () => this.ariaLabelledBy = label.getAttribute('id') ?? undefined;
const updateArialabelledBy = () => {
this.ariaLabelledBy = label.getAttribute('id') ?? undefined;
};
this.labelObserver = new MutationObserver(updateArialabelledBy);
this.labelObserver.observe(label, { attributes: true, attributeFilter: ['id'] });
// Usually the label won't have an id, so we need to add one.
if (!label.getAttribute('id')) {
label.setAttribute('id', 'rte-'+CoreUtils.getUniqueId('CoreEditorRichTextEditor'));
}
updateArialabelledBy();
}