Skip to content

Commit 4a05f6b

Browse files
Andrea Barbassoatarix83
authored andcommitted
Merged in task/dspace-cris-2023_02_x/DSC-2095 (pull request DSpace#3073)
[DSC-2095] fix group info not showing in eperson form page Approved-by: Giuseppe Digilio
2 parents ab8a628 + bcc573f commit 4a05f6b

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.spec.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Observable, of as observableOf } from 'rxjs';
22
import { CommonModule } from '@angular/common';
33
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
4-
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
4+
import { ComponentFixture, fakeAsync, TestBed, tick, waitForAsync } from '@angular/core/testing';
55
import { UntypedFormControl, UntypedFormGroup, FormsModule, ReactiveFormsModule, Validators } from '@angular/forms';
66
import { BrowserModule, By } from '@angular/platform-browser';
77
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@@ -30,7 +30,7 @@ import { PaginationServiceStub } from '../../../shared/testing/pagination-servic
3030
import { FindListOptions } from '../../../core/data/find-list-options.model';
3131
import { ValidateEmailNotTaken } from './validators/email-taken.validator';
3232
import { EpersonRegistrationService } from '../../../core/data/eperson-registration.service';
33-
import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
33+
import { followLink, FollowLinkConfig } from '../../../shared/utils/follow-link-config.model';
3434
import { ActivatedRoute, Router } from '@angular/router';
3535
import { RouterStub } from '../../../shared/testing/router.stub';
3636
import { ActivatedRouteStub } from '../../../shared/testing/active-router.stub';
@@ -46,7 +46,7 @@ describe('EPersonFormComponent', () => {
4646
let ePersonDataServiceStub: any;
4747
let authService: AuthServiceStub;
4848
let authorizationService: AuthorizationDataService;
49-
let groupsDataService: GroupDataService;
49+
let groupsDataService: jasmine.SpyObj<GroupDataService>;
5050
let epersonRegistrationService: EpersonRegistrationService;
5151
let route: ActivatedRouteStub;
5252
let router: RouterStub;
@@ -513,4 +513,15 @@ describe('EPersonFormComponent', () => {
513513
expect(epersonRegistrationService.registerEmail).toHaveBeenCalledWith(ePersonEmail, null, 'forgot');
514514
});
515515
});
516+
517+
describe('findListByHref functionality', () => {
518+
it('retrieves groups and object on page change', fakeAsync(() => {
519+
component.activeEPerson$ = observableOf({_links: { groups: { href: 'groups' } } } as EPerson);
520+
521+
const options = { currentPage: 1, elementsPerPage: 5 };
522+
component.onPageChange(options.currentPage);
523+
tick();
524+
expect(groupsDataService.findListByHref).toHaveBeenCalledWith(jasmine.anything(), options, undefined, undefined, followLink('object'));
525+
}));
526+
});
516527
});

src/app/access-control/epeople-registry/eperson-form/eperson-form.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ export class EPersonFormComponent implements OnInit, OnDestroy {
576576
*/
577577
private updateGroups(options) {
578578
this.subs.push(this.activeEPerson$.subscribe((eperson: EPerson) => {
579-
this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, options);
579+
this.groups = this.groupsDataService.findListByHref(eperson._links.groups.href, options, undefined, undefined, followLink('object'));
580580
}));
581581
}
582582
}

0 commit comments

Comments
 (0)