From 8aa88f8964aa3d907a6d6ecb338136d7a9f9961d Mon Sep 17 00:00:00 2001 From: crisnicandrei <62384997+crisnicandrei@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:49:32 +0300 Subject: [PATCH] PER-9890-switch-folder-item-on-share-view Display corresponding item in case shared file is a record or a folder --- ...archive-creation-with-share.component.html | 3 +- ...hive-creation-with-share.component.spec.ts | 52 +++++++++++++++++++ .../archive-creation-with-share.component.ts | 2 + .../{shared_item.svg => shared_folder.svg} | 0 src/assets/svg/onboarding/shared_record.svg | 5 ++ 5 files changed, 61 insertions(+), 1 deletion(-) rename src/assets/svg/onboarding/{shared_item.svg => shared_folder.svg} (100%) create mode 100644 src/assets/svg/onboarding/shared_record.svg diff --git a/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.html b/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.html index 613d37a0a..e4f7faaa4 100644 --- a/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.html +++ b/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.html @@ -7,7 +7,8 @@

- + +

{{ sharedItemName }}

diff --git a/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.spec.ts b/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.spec.ts index ea9cd4aa0..7e2d8194e 100644 --- a/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.spec.ts +++ b/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.spec.ts @@ -82,4 +82,56 @@ describe('ArchiveCreationWithShareToken', () => { expect(instance.sharerName).toBeUndefined(); expect(instance.sharedItemName).toBeUndefined(); }); + + it('should display the record icon if the shared item is a record', async () => { + const mockApi = { + invite: { + getFullShareInvite: jasmine.createSpy().and.returnValue( + Promise.resolve({ + getInviteVO: () => ({ + AccountVO: { fullName: 'Sharer Name' }, + RecordVO: { displayName: 'Shared Item Name' }, + }), + }), + ), + }, + }; + + const { instance, fixture } = await shallow + .mock(ApiService, mockApi) + .render(); + + spyOn(localStorage, 'getItem').and.returnValue('shareToken'); + + instance.ngOnInit(); + await fixture.whenStable(); + + expect(instance.isFolder).toBe(false); + }); + + it('should display the folder icon if the shared item is a folder', async () => { + const mockApi = { + invite: { + getFullShareInvite: jasmine.createSpy().and.returnValue( + Promise.resolve({ + getInviteVO: () => ({ + AccountVO: { fullName: 'Sharer Name' }, + RecordVO: null, + }), + }), + ), + }, + }; + + const { instance, fixture } = await shallow + .mock(ApiService, mockApi) + .render(); + + spyOn(localStorage, 'getItem').and.returnValue('shareToken'); + + instance.ngOnInit(); + await fixture.whenStable(); + + expect(instance.isFolder).toBe(false); + }); }); diff --git a/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.ts b/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.ts index 21bf49372..00dcd0735 100644 --- a/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.ts +++ b/src/app/onboarding/components/archive-creation-with-share/archive-creation-with-share.component.ts @@ -11,6 +11,7 @@ export class ArchiveCreationWithShareComponent implements OnInit { public hasShareToken = false; public sharerName: string; public sharedItemName: string; + public isFolder: boolean = false; constructor(private api: ApiService) {} @@ -23,6 +24,7 @@ export class ArchiveCreationWithShareComponent implements OnInit { this.sharedItemName = inviteVO.RecordVO ? inviteVO.RecordVO.displayName : inviteVO.FolderVO.displayName; + this.isFolder = !inviteVO.RecordVO; }); } } diff --git a/src/assets/svg/onboarding/shared_item.svg b/src/assets/svg/onboarding/shared_folder.svg similarity index 100% rename from src/assets/svg/onboarding/shared_item.svg rename to src/assets/svg/onboarding/shared_folder.svg diff --git a/src/assets/svg/onboarding/shared_record.svg b/src/assets/svg/onboarding/shared_record.svg new file mode 100644 index 000000000..4a9305a2d --- /dev/null +++ b/src/assets/svg/onboarding/shared_record.svg @@ -0,0 +1,5 @@ + + + + +