From 431b3db08a00a6e9098152e605bc1cec43bf49c5 Mon Sep 17 00:00:00 2001 From: AleksanderSklorz <115619721+AleksanderSklorz@users.noreply.github.com> Date: Thu, 30 Mar 2023 14:16:04 +0200 Subject: [PATCH] [ACS-4721] tags are not displayed properly when resizing browser (#8424) * ACS-4721 Partial fix issue with resizing window * ACS-4721 Fixed issue for overlapping view more button with tags, skip calculation if anyone clicked on view more button * ACS-4721 Unit tests * ACS-4721 Fixed lint issues * ACS-4721 Small correction in tests * ACS-4721 Fixed unit tests * ACS-4721 Fixed unit tests * ACS-4721 Resolved issues after opening viewer * ACS-4721 Formatting * ACS-4721 Fixed lint issue --- .../content-metadata.component.spec.ts | 23 +++++ .../content-metadata.component.ts | 3 + .../src/lib/tag/tag-node-list.component.html | 3 +- .../src/lib/tag/tag-node-list.component.scss | 17 +++- .../lib/tag/tag-node-list.component.spec.ts | 90 +++++++++++++++---- .../src/lib/tag/tag-node-list.component.ts | 82 ++++++++++++----- 6 files changed, 176 insertions(+), 42 deletions(-) diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts index 15df0ad1b2..3aea01bf23 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.spec.ts @@ -239,6 +239,29 @@ describe('ContentMetadataComponent', () => { expect(tagService.assignTagsToNode).toHaveBeenCalledWith(node.id, [tag1, tag2]); })); + it('should call getTagsByNodeId on TagService on save click', fakeAsync( () => { + component.editable = true; + component.displayTags = true; + const property = { key: 'properties.property-key', value: 'original-value' } as CardViewBaseItemModel; + const expectedNode = { ...node, name: 'some-modified-value' }; + spyOn(nodesApiService, 'updateNode').and.returnValue(of(expectedNode)); + const tagPaging = mockTagPaging(); + const getTagsByNodeIdSpy = spyOn(tagService, 'getTagsByNodeId').and.returnValue(of(tagPaging)); + component.ngOnInit(); + spyOn(tagService, 'removeTag').and.returnValue(of(undefined)); + spyOn(tagService, 'assignTagsToNode').and.returnValue(of({})); + + updateService.update(property, 'updated-value'); + tick(600); + + fixture.detectChanges(); + findTagsCreator().tagsChange.emit([tagPaging.list.entries[0].entry.tag, 'New tag 3']); + getTagsByNodeIdSpy.calls.reset(); + clickOnSave(); + + expect(tagService.getTagsByNodeId).toHaveBeenCalledWith(node.id); + })); + it('should throw error on unsuccessful save', fakeAsync((done) => { const logService: LogService = TestBed.inject(LogService); component.editable = true; diff --git a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts index b8995b771f..b439342546 100644 --- a/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts +++ b/lib/content-services/src/lib/content-metadata/components/content-metadata/content-metadata.component.ts @@ -270,6 +270,9 @@ export class ContentMetadataComponent implements OnChanges, OnInit, OnDestroy { this.revertChanges(); Object.assign(this.node, result.updatedNode); this.nodesApiService.nodeUpdated.next(this.node); + if (Object.keys(result).length > 1 && this.displayTags) { + this.loadTagsForNode(this.node.id); + } } this._saving = false; }); diff --git a/lib/content-services/src/lib/tag/tag-node-list.component.html b/lib/content-services/src/lib/tag/tag-node-list.component.html index 2482f8c015..15bd49d4b8 100644 --- a/lib/content-services/src/lib/tag/tag-node-list.component.html +++ b/lib/content-services/src/lib/tag/tag-node-list.component.html @@ -10,7 +10,8 @@