[ACS-8468] Add copy icon functionality (#12079)

* [ACS-9106] Make the descendants false iin data column component

* [ACS-8468] Add copy icon

* [ACS-8468] Remove change from data column

* [ACS-8468] Use if instead of *ngIf

* [ACS-8468] Revert to double click functionality

* [ACS-8468] Make copy button toggable and make it icon

* [ACS-8468] Add unit test for copy icons

* [ACS-8468] Add unit test for mat registry

* [ACS-8468] Remove deprecated component

* [ACS-8468] Align the styling with dropdown menu

* [ACS-8468] Fix sonar cloud issue

* [ACS-8468] Remove deprecated component

* [ACS-8468] Remove svg icon and use material icon

* [ACS-8468] Fix styling and remove mat-form-field-icon-suffix selector

* [ACS-8468] Make copy to clipboard icon property true

* [ACS-8468] Add unit tests and remove unused class

* [ACS-8468] Add unitTestingUtils

* [ACS-8468] use with args instead of callFake

* [ACS-8468] remove jasmine.spy
This commit is contained in:
Shivangi Shree
2026-08-07 10:32:42 +05:30
committed by GitHub
parent e717189430
commit 4cbe97c12c
25 changed files with 312 additions and 11 deletions
@@ -8,6 +8,7 @@
[multi]="multi"
[displayAspect]="displayAspect"
[copyToClipboardAction]="copyToClipboardAction"
[displayCopyToClipboardIcon]="displayCopyToClipboardIcon"
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
[displayTags]="false"
[displayCategories]="false"
@@ -73,6 +73,10 @@ export class PropertiesViewerWrapperComponent implements OnInit, OnChanges {
@Input()
copyToClipboardAction: boolean;
/** Toggles the visibility of the copy to clipboard icon */
@Input()
displayCopyToClipboardIcon: boolean;
/** Toggles chips for multivalued properties. */
@Input()
useChipsForMultiValueProperty: boolean;
@@ -19,6 +19,7 @@
[multi]="properties?.multi !== undefined ? properties?.multi : false"
[displayAspect]="properties?.displayAspect !== undefined ? properties?.displayAspect : null"
[copyToClipboardAction]="properties?.copyToClipboardAction !== undefined ? properties?.copyToClipboardAction : true"
[displayCopyToClipboardIcon]="properties?.displayCopyToClipboardIcon ?? true"
[useChipsForMultiValueProperty]="properties?.useChipsForMultiValueProperty !== undefined ? properties?.useChipsForMultiValueProperty : true"
(nodeContentLoaded)="onNodeContentLoaded($event)"
/>
@@ -16,8 +16,9 @@
*/
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { FormFieldModel, FormModel, NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core';
import { FormFieldModel, FormModel, NoopTranslateModule, NoopAuthModule, UnitTestingUtils } from '@alfresco/adf-core';
import { PropertiesViewerWidgetComponent } from './properties-viewer.widget';
import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper/properties-viewer-wrapper.component';
import { fakeNodeWithProperties } from '../../../mocks/attach-file-cloud-widget.mock';
import { NodesApiService, BasicPropertiesService } from '@alfresco/adf-content-services';
import { of } from 'rxjs';
@@ -27,6 +28,7 @@ describe('PropertiesViewerWidgetComponent', () => {
let fixture: ComponentFixture<PropertiesViewerWidgetComponent>;
let element: HTMLElement;
let nodesApiService: NodesApiService;
let testingUtils: UnitTestingUtils;
const fakePngAnswer: any = {
id: '1933',
@@ -52,6 +54,7 @@ describe('PropertiesViewerWidgetComponent', () => {
nodesApiService = TestBed.inject(NodesApiService);
widget = fixture.componentInstance;
element = fixture.nativeElement;
testingUtils = new UnitTestingUtils(fixture.debugElement);
widget.field = new FormFieldModel(new FormModel());
spyOn(nodesApiService, 'getNode').and.returnValue(of(fakeNodeWithProperties));
@@ -97,6 +100,31 @@ describe('PropertiesViewerWidgetComponent', () => {
expect(propertiesViewer).not.toBeNull();
});
it('should default displayCopyToClipboardIcon to true when not set in options', async () => {
widget.field.value = '1234';
fixture.detectChanges();
await fixture.whenStable();
const wrapper = testingUtils.getByDirective(PropertiesViewerWrapperComponent).componentInstance;
expect(wrapper.displayCopyToClipboardIcon).toBeTrue();
});
it('should pass displayCopyToClipboardIcon from options to the properties viewer wrapper', async () => {
widget.field = new FormFieldModel(new FormModel(), {
value: '1234',
params: { propertiesViewerOptions: { displayCopyToClipboardIcon: false } }
});
fixture.detectChanges();
await fixture.whenStable();
const wrapper = testingUtils.getByDirective(PropertiesViewerWrapperComponent).componentInstance;
expect(wrapper.displayCopyToClipboardIcon).toBeFalse();
});
it('should emit the node when node content is loaded', async () => {
const nodeContentLoadedSpy = spyOn(widget.nodeContentLoaded, 'emit');