[ACS-8467] Removed duplicated dialog after clicking label in folder rules creation dialog (#12088)

This commit is contained in:
AleksanderSklorz
2026-07-24 13:38:40 +02:00
committed by GitHub
parent 3f2c767d43
commit ba814fd6ec
3 changed files with 27 additions and 2 deletions
@@ -107,7 +107,7 @@
class="adf-textitem-clickable" class="adf-textitem-clickable"
[ngClass]="{ 'adf-property-read-only': isReadonlyProperty }" [ngClass]="{ 'adf-property-read-only': isReadonlyProperty }"
[attr.data-automation-id]="'card-textitem-toggle-' + property.key" [attr.data-automation-id]="'card-textitem-toggle-' + property.key"
(click)="clicked()" (click)="clicked($event)"
> >
<mat-form-field class="adf-property-field adf-card-textitem-field"> <mat-form-field class="adf-property-field adf-card-textitem-field">
<mat-label <mat-label
@@ -510,6 +510,30 @@ describe('CardViewTextItemComponent', () => {
expect(callBackSpy).toHaveBeenCalled(); expect(callBackSpy).toHaveBeenCalled();
}); });
it('should call preventDefault on event when label of clickable input is clicked', () => {
component.property.clickable = true;
component.ngOnChanges({});
fixture.detectChanges();
const clickEvent = new MouseEvent('click', { bubbles: true });
spyOn(clickEvent, 'preventDefault');
testingUtils.getByDataAutomationId(`card-textitem-label-${component.property.key}`).nativeElement.dispatchEvent(clickEvent);
fixture.detectChanges();
expect(clickEvent.preventDefault).toHaveBeenCalled();
});
it('should call preventDefault on event when button wrapper of clickable input is clicked', () => {
component.property.clickable = true;
component.ngOnChanges({});
fixture.detectChanges();
const clickEvent = new MouseEvent('click');
spyOn(clickEvent, 'preventDefault');
testingUtils.getByDataAutomationId(`card-textitem-toggle-${component.property.key}`).nativeElement.dispatchEvent(clickEvent);
fixture.detectChanges();
expect(clickEvent.preventDefault).toHaveBeenCalled();
});
it('should click event to the event stream when clickable property enabled', async () => { it('should click event to the event stream when clickable property enabled', async () => {
const cardViewUpdateService = TestBed.inject(CardViewUpdateService); const cardViewUpdateService = TestBed.inject(CardViewUpdateService);
spyOn(cardViewUpdateService, 'clicked').and.stub(); spyOn(cardViewUpdateService, 'clicked').and.stub();
@@ -203,12 +203,13 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
} }
} }
clicked(): void { clicked(event: MouseEvent): void {
if (typeof this.property.clickCallBack === 'function') { if (typeof this.property.clickCallBack === 'function') {
this.property.clickCallBack(); this.property.clickCallBack();
} else { } else {
this.cardViewUpdateService.clicked(this.property); this.cardViewUpdateService.clicked(this.property);
} }
event.preventDefault();
} }
clearValue() { clearValue() {