edit-relationship-list.component.spec.ts (dspace-angular-dspace-7.0) | : | edit-relationship-list.component.spec.ts (dspace-angular-dspace-7.1) | ||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
import { SharedModule } from '../../../../shared/shared.module'; | import { SharedModule } from '../../../../shared/shared.module'; | |||
import { EditRelationshipListComponent } from './edit-relationship-list.componen t'; | import { EditRelationshipListComponent } from './edit-relationship-list.componen t'; | |||
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-dat a.utils'; | import { createSuccessfulRemoteDataObject$ } from '../../../../shared/remote-dat a.utils'; | |||
import { createPaginatedList } from '../../../../shared/testing/utils.test'; | import { createPaginatedList } from '../../../../shared/testing/utils.test'; | |||
import { PaginationService } from '../../../../core/pagination/pagination.servic e'; | import { PaginationService } from '../../../../core/pagination/pagination.servic e'; | |||
import { PaginationServiceStub } from '../../../../shared/testing/pagination-ser vice.stub'; | import { PaginationServiceStub } from '../../../../shared/testing/pagination-ser vice.stub'; | |||
import { HostWindowService } from '../../../../shared/host-window.service'; | import { HostWindowService } from '../../../../shared/host-window.service'; | |||
import { HostWindowServiceStub } from '../../../../shared/testing/host-window-se rvice.stub'; | import { HostWindowServiceStub } from '../../../../shared/testing/host-window-se rvice.stub'; | |||
import { PaginationComponent } from '../../../../shared/pagination/pagination.co mponent'; | import { PaginationComponent } from '../../../../shared/pagination/pagination.co mponent'; | |||
import { PaginationComponentOptions } from '../../../../shared/pagination/pagina tion-component-options.model'; | import { PaginationComponentOptions } from '../../../../shared/pagination/pagina tion-component-options.model'; | |||
import { RelationshipTypeService } from '../../../../core/data/relationship-type .service'; | ||||
let comp: EditRelationshipListComponent; | let comp: EditRelationshipListComponent; | |||
let fixture: ComponentFixture<EditRelationshipListComponent>; | let fixture: ComponentFixture<EditRelationshipListComponent>; | |||
let de: DebugElement; | let de: DebugElement; | |||
let linkService; | let linkService; | |||
let objectUpdatesService; | let objectUpdatesService; | |||
let relationshipService; | let relationshipService; | |||
let selectableListService; | let selectableListService; | |||
let paginationService; | let paginationService; | |||
let hostWindowService; | let hostWindowService; | |||
const relationshipTypeService = {}; | ||||
const url = 'http://test-url.com/test-url'; | const url = 'http://test-url.com/test-url'; | |||
let item; | let item; | |||
let entityType; | let entityType; | |||
let relatedEntityType; | let relatedEntityType; | |||
let author1; | let author1; | |||
let author2; | let author2; | |||
let fieldUpdate1; | let fieldUpdate1; | |||
let fieldUpdate2; | let fieldUpdate2; | |||
skipping to change at line 60 | skipping to change at line 62 | |||
describe('EditRelationshipListComponent', () => { | describe('EditRelationshipListComponent', () => { | |||
const resetComponent = () => { | const resetComponent = () => { | |||
fixture = TestBed.createComponent(EditRelationshipListComponent); | fixture = TestBed.createComponent(EditRelationshipListComponent); | |||
comp = fixture.componentInstance; | comp = fixture.componentInstance; | |||
de = fixture.debugElement; | de = fixture.debugElement; | |||
comp.item = item; | comp.item = item; | |||
comp.itemType = entityType; | comp.itemType = entityType; | |||
comp.url = url; | comp.url = url; | |||
comp.relationshipType = relationshipType; | comp.relationshipType = relationshipType; | |||
comp.hasChanges = observableOf(false); | ||||
fixture.detectChanges(); | fixture.detectChanges(); | |||
}; | }; | |||
beforeEach(waitForAsync(() => { | beforeEach(waitForAsync(() => { | |||
entityType = Object.assign(new ItemType(), { | entityType = Object.assign(new ItemType(), { | |||
id: 'Publication', | id: 'Publication', | |||
uuid: 'Publication', | uuid: 'Publication', | |||
label: 'Publication', | label: 'Publication', | |||
}); | }); | |||
skipping to change at line 184 | skipping to change at line 187 | |||
TestBed.configureTestingModule({ | TestBed.configureTestingModule({ | |||
imports: [SharedModule, TranslateModule.forRoot()], | imports: [SharedModule, TranslateModule.forRoot()], | |||
declarations: [EditRelationshipListComponent], | declarations: [EditRelationshipListComponent], | |||
providers: [ | providers: [ | |||
{ provide: ObjectUpdatesService, useValue: objectUpdatesService }, | { provide: ObjectUpdatesService, useValue: objectUpdatesService }, | |||
{ provide: RelationshipService, useValue: relationshipService }, | { provide: RelationshipService, useValue: relationshipService }, | |||
{ provide: SelectableListService, useValue: selectableListService }, | { provide: SelectableListService, useValue: selectableListService }, | |||
{ provide: LinkService, useValue: linkService }, | { provide: LinkService, useValue: linkService }, | |||
{ provide: PaginationService, useValue: paginationService }, | { provide: PaginationService, useValue: paginationService }, | |||
{ provide: HostWindowService, useValue: hostWindowService }, | { provide: HostWindowService, useValue: hostWindowService }, | |||
{ provide: RelationshipTypeService, useValue: relationshipTypeService }, | ||||
], schemas: [ | ], schemas: [ | |||
NO_ERRORS_SCHEMA | NO_ERRORS_SCHEMA | |||
] | ] | |||
}).compileComponents(); | }).compileComponents(); | |||
resetComponent(); | resetComponent(); | |||
})); | })); | |||
describe('changeType is REMOVE', () => { | describe('changeType is REMOVE', () => { | |||
beforeEach(() => { | beforeEach(() => { | |||
skipping to change at line 278 | skipping to change at line 282 | |||
it('should fetch isAuthorOfPublication', () => { | it('should fetch isAuthorOfPublication', () => { | |||
expect(relationshipService.getItemRelationshipsByLabel).toHaveBeenCalled Times(1); | expect(relationshipService.getItemRelationshipsByLabel).toHaveBeenCalled Times(1); | |||
const callArgs = relationshipService.getItemRelationshipsByLabel.calls.m ostRecent().args; | const callArgs = relationshipService.getItemRelationshipsByLabel.calls.m ostRecent().args; | |||
const label = callArgs[1]; | const label = callArgs[1]; | |||
expect(label).toEqual('isAuthorOfPublication'); | expect(label).toEqual('isAuthorOfPublication'); | |||
}); | }); | |||
}); | }); | |||
describe('changes managment for add buttons', () => { | ||||
it('should show enabled add buttons', () => { | ||||
const element = de.query(By.css('.btn-success')); | ||||
expect(element.nativeElement?.disabled).toBeFalse(); | ||||
}); | ||||
it('after hash changes changed', () => { | ||||
comp.hasChanges = observableOf(true); | ||||
fixture.detectChanges(); | ||||
const element = de.query(By.css('.btn-success')); | ||||
expect(element.nativeElement?.disabled).toBeTrue(); | ||||
}); | ||||
}); | ||||
}); | }); | |||
}); | }); | |||
End of changes. 5 change blocks. | ||||
0 lines changed or deleted | 20 lines changed or added |