mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-20282 fix submit button enabled when required people/groups widget empty (#9334)
This commit is contained in:
@@ -130,6 +130,23 @@ describe('GroupCloudWidgetComponent', () => {
|
||||
|
||||
expect(element.querySelector('.adf-invalid')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should be invalid after deselecting all groups', async () => {
|
||||
widget.onChangedGroup([{id: 'test-id', name: 'test-name'}]);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(element.querySelector('.adf-error-text')).toBeFalsy();
|
||||
|
||||
const removeGroupIcon = element.querySelector('[data-automation-id="adf-cloud-group-chip-remove-icon-test-name"]');
|
||||
removeGroupIcon.dispatchEvent(new Event('click'));
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(element.querySelector('.adf-error-text')).toBeTruthy();
|
||||
expect(element.querySelector('.adf-error-text').textContent).toContain('ADF_CLOUD_GROUPS.ERROR.NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when is readOnly', () => {
|
||||
|
@@ -89,13 +89,13 @@ export class GroupCloudWidgetComponent extends WidgetComponent implements OnInit
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
ngOnDestroy(): void {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onChangedGroup(groups) {
|
||||
this.field.value = [...groups];
|
||||
onChangedGroup(groups: IdentityGroupModel[]): void {
|
||||
this.field.value = groups?.length ? [...groups] : null;
|
||||
this.onFieldChanged(this.field);
|
||||
}
|
||||
|
||||
|
@@ -158,6 +158,23 @@ describe('PeopleCloudWidgetComponent', () => {
|
||||
|
||||
expect(element.querySelector('.adf-invalid')).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should be invalid after deselecting all people', async () => {
|
||||
widget.onChangedUser([{id: 'test-id', username: 'test-name'}]);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(element.querySelector('.adf-error-text')).toBeFalsy();
|
||||
|
||||
const removeGroupIcon = element.querySelector('[data-automation-id="adf-people-cloud-chip-remove-icon-test-name"]');
|
||||
removeGroupIcon.dispatchEvent(new Event('click'));
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(element.querySelector('.adf-error-text')).toBeTruthy();
|
||||
expect(element.querySelector('.adf-error-text').textContent).toContain('ADF_CLOUD_USERS.ERROR.NOT_FOUND');
|
||||
});
|
||||
});
|
||||
|
||||
describe('when is readOnly', () => {
|
||||
|
@@ -99,13 +99,13 @@ export class PeopleCloudWidgetComponent extends WidgetComponent implements OnIni
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
ngOnDestroy(): void {
|
||||
this.onDestroy$.next(true);
|
||||
this.onDestroy$.complete();
|
||||
}
|
||||
|
||||
onChangedUser(users) {
|
||||
this.field.value = [...users];
|
||||
onChangedUser(users: IdentityUserModel[]): void {
|
||||
this.field.value = users?.length ? [...users] : null;
|
||||
this.onFieldChanged(this.field);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user