Skip to content

Commit

Permalink
PER-9890-switch-folder-item-on-share-view
Browse files Browse the repository at this point in the history
Display corresponding item in case shared file is a record or a folder
  • Loading branch information
crisnicandrei committed Oct 23, 2024
1 parent 6b2e6b1 commit 76339d0
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
</p>
<div class="invitation-info">
<div class="img-container">
<img src="assets/svg/onboarding/shared_item.svg" />
<img *ngIf="isFolder" src="assets/svg/onboarding/shared_folder.svg" />
<img *ngIf="!isFolder" src="assets/svg/onboarding/shared_record.svg" />
</div>
<div class="sharer-info">
<p class="shared-item-name">{{ sharedItemName }}</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}

Expand All @@ -23,6 +24,7 @@ export class ArchiveCreationWithShareComponent implements OnInit {
this.sharedItemName = inviteVO.RecordVO
? inviteVO.RecordVO.displayName
: inviteVO.FolderVO.displayName;
this.isFolder = !inviteVO.RecordVO;
});
}
}
Expand Down
File renamed without changes
5 changes: 5 additions & 0 deletions src/assets/svg/onboarding/shared_record.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76339d0

Please sign in to comment.