mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-8467] Removed duplicated dialog after clicking label in folder rules creation dialog (#12088)
This commit is contained in:
+1
-1
@@ -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
|
||||||
|
|||||||
+24
@@ -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();
|
||||||
|
|||||||
+2
-1
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user