mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[AAE-3908] - fix clear value icon on card view text item (#6269)
This commit is contained in:
parent
072f910452
commit
80fc239461
@ -34,7 +34,7 @@
|
||||
*ngIf="isEditable"
|
||||
mat-icon-button
|
||||
aria-label="Clear"
|
||||
(click)="editedValue=''">
|
||||
(click)="clearValue()">
|
||||
<mat-icon>cancel</mat-icon>
|
||||
</button>
|
||||
<mat-icon matSuffix
|
||||
|
@ -393,6 +393,25 @@ describe('CardViewTextItemComponent', () => {
|
||||
fixture.detectChanges();
|
||||
expect(clipboardService.copyContentToClipboard).toHaveBeenCalledWith('myValueToCopy', 'CORE.METADATA.ACCESSIBILITY.COPY_TO_CLIPBOARD_MESSAGE');
|
||||
});
|
||||
|
||||
it('should clear value when clear value icon is clicked', async () => {
|
||||
component.property.value = 'testValue';
|
||||
component.property.icon = 'FAKE_ICON';
|
||||
component.property.clickable = true;
|
||||
component.property.editable = true;
|
||||
component.editable = true;
|
||||
component.property.isValid = () => true;
|
||||
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
fixture.detectChanges();
|
||||
const clickEl = fixture.debugElement.query(By.css(`.adf-property-clear-value`));
|
||||
clickEl.triggerEventHandler('click', new MouseEvent('click'));
|
||||
|
||||
fixture.detectChanges();
|
||||
const elementValue = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-value-${component.property.key}"]`));
|
||||
expect(elementValue.nativeElement.textContent).toEqual('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Update', () => {
|
||||
|
@ -175,6 +175,7 @@ export class CardViewTextItemComponent extends BaseCardView<CardViewTextItemMode
|
||||
|
||||
clearValue() {
|
||||
this.editedValue = '';
|
||||
this.textInput.setValue('');
|
||||
}
|
||||
|
||||
copyToClipboard(valueToCopy: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user