mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-02 17:53:30 +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"
|
||||
[ngClass]="{ 'adf-property-read-only': isReadonlyProperty }"
|
||||
[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-label
|
||||
|
||||
+24
@@ -510,6 +510,30 @@ describe('CardViewTextItemComponent', () => {
|
||||
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 () => {
|
||||
const cardViewUpdateService = TestBed.inject(CardViewUpdateService);
|
||||
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') {
|
||||
this.property.clickCallBack();
|
||||
} else {
|
||||
this.cardViewUpdateService.clicked(this.property);
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
clearValue() {
|
||||
|
||||
Reference in New Issue
Block a user