"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/access-control/group-registry/groups-registry.component.spec.ts" between
dspace-angular-dspace-7.0.tar.gz and dspace-angular-dspace-7.1.tar.gz

About: dspace-angular is the Angular-based frontend of DSpace, a digital repository system to capture, store, index, preserve and redistribute an organization’s research material in digital formats.

groups-registry.component.spec.ts  (dspace-angular-dspace-7.0):groups-registry.component.spec.ts  (dspace-angular-dspace-7.1)
skipping to change at line 155 skipping to change at line 155
totalPages: 1, totalPages: 1,
currentPage: 1 currentPage: 1
}), [result])); }), [result]));
} }
}; };
dsoDataServiceStub = { dsoDataServiceStub = {
findByHref(href: string): Observable<RemoteData<DSpaceObject>> { findByHref(href: string): Observable<RemoteData<DSpaceObject>> {
return createSuccessfulRemoteDataObject$(undefined); return createSuccessfulRemoteDataObject$(undefined);
} }
}; };
authorizationService = jasmine.createSpyObj('authorizationService', ['isAuth orized']); authorizationService = jasmine.createSpyObj('authorizationService', ['isAuth orized']);
setIsAuthorized(true, true); setIsAuthorized(true, true);
paginationService = new PaginationServiceStub(); paginationService = new PaginationServiceStub();
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, Brows erModule, imports: [CommonModule, NgbModule, FormsModule, ReactiveFormsModule, Brows erModule,
TranslateModule.forRoot({ TranslateModule.forRoot({
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useClass: TranslateLoaderMock useClass: TranslateLoaderMock
} }
skipping to change at line 203 skipping to change at line 204
it('should display list of groups', () => { it('should display list of groups', () => {
const groupIdsFound = fixture.debugElement.queryAll(By.css('#groups tr td:fi rst-child')); const groupIdsFound = fixture.debugElement.queryAll(By.css('#groups tr td:fi rst-child'));
expect(groupIdsFound.length).toEqual(2); expect(groupIdsFound.length).toEqual(2);
mockGroups.map((group: Group) => { mockGroups.map((group: Group) => {
expect(groupIdsFound.find((foundEl) => { expect(groupIdsFound.find((foundEl) => {
return (foundEl.nativeElement.textContent.trim() === group.uuid); return (foundEl.nativeElement.textContent.trim() === group.uuid);
})).toBeTruthy(); })).toBeTruthy();
}); });
}); });
it('should display community/collection name if present', () => {
const collectionNamesFound = fixture.debugElement.queryAll(By.css('#groups t
r td:nth-child(3)'));
expect(collectionNamesFound.length).toEqual(2);
expect(collectionNamesFound[0].nativeElement.textContent).toEqual('');
expect(collectionNamesFound[1].nativeElement.textContent).toEqual('testgroup
id2objectName');
});
describe('edit buttons', () => { describe('edit buttons', () => {
describe('when the user is a general admin', () => { describe('when the user is a general admin', () => {
beforeEach(fakeAsync(() => { beforeEach(fakeAsync(() => {
// NOTE: setting canManageGroup to false should not matter, since isAdmi n takes priority // NOTE: setting canManageGroup to false should not matter, since isAdmi n takes priority
setIsAuthorized(true, false); setIsAuthorized(true, false);
// force rerender after setup changes // force rerender after setup changes
component.search({ query: '' }); component.search({ query: '' });
tick(); tick();
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('should be active', () => { it('should be active', () => {
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups t r td:nth-child(4) button.btn-edit')); const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups t r td:nth-child(5) button.btn-edit'));
expect(editButtonsFound.length).toEqual(2); expect(editButtonsFound.length).toEqual(2);
editButtonsFound.forEach((editButtonFound) => { editButtonsFound.forEach((editButtonFound) => {
expect(editButtonFound.nativeElement.disabled).toBeFalse(); expect(editButtonFound.nativeElement.disabled).toBeFalse();
}); });
}); });
it('should not check the canManageGroup permissions', () => { it('should not check the canManageGroup permissions', () => {
expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith( expect(authorizationService.isAuthorized).not.toHaveBeenCalledWith(
FeatureID.CanManageGroup, mockGroups[0].self FeatureID.CanManageGroup, mockGroups[0].self
); );
skipping to change at line 250 skipping to change at line 258
beforeEach(fakeAsync(() => { beforeEach(fakeAsync(() => {
setIsAuthorized(false, true); setIsAuthorized(false, true);
// force rerender after setup changes // force rerender after setup changes
component.search({ query: '' }); component.search({ query: '' });
tick(); tick();
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('should be active', () => { it('should be active', () => {
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups t r td:nth-child(4) button.btn-edit')); const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups t r td:nth-child(5) button.btn-edit'));
expect(editButtonsFound.length).toEqual(2); expect(editButtonsFound.length).toEqual(2);
editButtonsFound.forEach((editButtonFound) => { editButtonsFound.forEach((editButtonFound) => {
expect(editButtonFound.nativeElement.disabled).toBeFalse(); expect(editButtonFound.nativeElement.disabled).toBeFalse();
}); });
}); });
}); });
describe('when the user can not edit the groups', () => { describe('when the user can not edit the groups', () => {
beforeEach(fakeAsync(() => { beforeEach(fakeAsync(() => {
setIsAuthorized(false, false); setIsAuthorized(false, false);
// force rerender after setup changes // force rerender after setup changes
component.search({ query: '' }); component.search({ query: '' });
tick(); tick();
fixture.detectChanges(); fixture.detectChanges();
})); }));
it('should not be active', () => { it('should not be active', () => {
const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups t r td:nth-child(4) button.btn-edit')); const editButtonsFound = fixture.debugElement.queryAll(By.css('#groups t r td:nth-child(5) button.btn-edit'));
expect(editButtonsFound.length).toEqual(2); expect(editButtonsFound.length).toEqual(2);
editButtonsFound.forEach((editButtonFound) => { editButtonsFound.forEach((editButtonFound) => {
expect(editButtonFound.nativeElement.disabled).toBeTrue(); expect(editButtonFound.nativeElement.disabled).toBeTrue();
}); });
}); });
}); });
}); });
describe('search', () => { describe('search', () => {
describe('when searching with query', () => { describe('when searching with query', () => {
 End of changes. 5 change blocks. 
3 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)