mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[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:
+2
@@ -51,6 +51,7 @@
|
||||
[editable]="!readOnly && isPanelEditing(DefaultPanels.PROPERTIES)"
|
||||
[displayEmpty]="displayEmpty"
|
||||
[copyToClipboardAction]="copyToClipboardAction"
|
||||
[displayCopyToClipboardIcon]="displayCopyToClipboardIcon"
|
||||
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
|
||||
[multiValueSeparator]="multiValueSeparator" />
|
||||
</mat-expansion-panel>
|
||||
@@ -252,6 +253,7 @@
|
||||
[editable]="!readOnly && group.editable && isPanelEditing(group.title)"
|
||||
[displayEmpty]="displayEmpty"
|
||||
[copyToClipboardAction]="copyToClipboardAction"
|
||||
[displayCopyToClipboardIcon]="displayCopyToClipboardIcon"
|
||||
[useChipsForMultiValueProperty]="useChipsForMultiValueProperty"
|
||||
[multiValueSeparator]="multiValueSeparator" />
|
||||
</mat-expansion-panel>
|
||||
|
||||
+20
@@ -50,6 +50,7 @@ describe('ContentMetadataComponent', () => {
|
||||
let contentMetadataService: ContentMetadataService;
|
||||
let updateService: CardViewContentUpdateService;
|
||||
let nodesApiService: NodesApiService;
|
||||
let appConfigService: AppConfigService;
|
||||
let node: Node;
|
||||
let folderNode: Node;
|
||||
let tagService: TagService;
|
||||
@@ -212,6 +213,7 @@ describe('ContentMetadataComponent', () => {
|
||||
tagService = TestBed.inject(TagService);
|
||||
categoryService = TestBed.inject(CategoryService);
|
||||
notificationService = TestBed.inject(NotificationService);
|
||||
appConfigService = TestBed.inject(AppConfigService);
|
||||
const propertyDescriptorsService = TestBed.inject(PropertyDescriptorsService);
|
||||
const classesApi = propertyDescriptorsService['classesApi'];
|
||||
|
||||
@@ -255,6 +257,24 @@ describe('ContentMetadataComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Copy to clipboard configuration', () => {
|
||||
it('should set displayCopyToClipboardIcon to true when config value is true', () => {
|
||||
const getSpy = spyOn(appConfigService, 'get').and.callThrough();
|
||||
getSpy.withArgs('content-metadata.display-copy-to-clipboard-icon').and.returnValue(true);
|
||||
const newFixture = TestBed.createComponent(ContentMetadataComponent);
|
||||
|
||||
expect(newFixture.componentInstance.displayCopyToClipboardIcon).toBeTrue();
|
||||
});
|
||||
|
||||
it('should set displayCopyToClipboardIcon to false when config value is false', () => {
|
||||
const getSpy = spyOn(appConfigService, 'get').and.callThrough();
|
||||
getSpy.withArgs('content-metadata.display-copy-to-clipboard-icon').and.returnValue(false);
|
||||
const newFixture = TestBed.createComponent(ContentMetadataComponent);
|
||||
|
||||
expect(newFixture.componentInstance.displayCopyToClipboardIcon).toBeFalse();
|
||||
});
|
||||
});
|
||||
|
||||
describe('Folder', () => {
|
||||
it('should show the folder node', (done) => {
|
||||
component.expanded = false;
|
||||
|
||||
+5
@@ -131,6 +131,10 @@ export class ContentMetadataComponent implements OnChanges, OnInit {
|
||||
@Input()
|
||||
copyToClipboardAction: boolean = true;
|
||||
|
||||
/** Toggles whether or not to display the copy to clipboard icon. */
|
||||
@Input()
|
||||
displayCopyToClipboardIcon = true;
|
||||
|
||||
/** Toggles whether or not to enable chips for multivalued properties. */
|
||||
@Input()
|
||||
useChipsForMultiValueProperty: boolean = true;
|
||||
@@ -186,6 +190,7 @@ export class ContentMetadataComponent implements OnChanges, OnInit {
|
||||
|
||||
constructor() {
|
||||
this.copyToClipboardAction = this.appConfig.get<boolean>('content-metadata.copy-to-clipboard-action');
|
||||
this.displayCopyToClipboardIcon = this.appConfig.get<boolean>('content-metadata.display-copy-to-clipboard-icon');
|
||||
this.multiValueSeparator = this.appConfig.get<string>('content-metadata.multi-value-pipe-separator') || DEFAULT_SEPARATOR;
|
||||
this.useChipsForMultiValueProperty = this.appConfig.get<boolean>('content-metadata.multi-value-chips');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user