mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-19 16:03:02 +00:00
63669: More ContentSourceComponennt tests
This commit is contained in:
@@ -109,22 +109,30 @@ describe('CollectionSourceComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('on startup', () => {
|
describe('on startup', () => {
|
||||||
|
let form;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
form = fixture.debugElement.query(By.css('ds-form'));
|
||||||
|
});
|
||||||
|
|
||||||
it('ContentSource should be disabled', () => {
|
it('ContentSource should be disabled', () => {
|
||||||
expect(comp.contentSource.enabled).toBe(false);
|
expect(comp.contentSource.enabled).toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('the input-form should be disabled', () => {
|
it('the input-form should be hidden', () => {
|
||||||
expect(comp.formGroup.disabled).toBe(true);
|
expect(form).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when selecting the checkbox', () => {
|
describe('when selecting the checkbox', () => {
|
||||||
let input;
|
let input;
|
||||||
|
let form;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
input = fixture.debugElement.query(By.css('#externalSourceCheck')).nativeElement;
|
input = fixture.debugElement.query(By.css('#externalSourceCheck')).nativeElement;
|
||||||
input.click();
|
input.click();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
form = fixture.debugElement.query(By.css('ds-form'));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should enable ContentSource', () => {
|
it('should enable ContentSource', () => {
|
||||||
@@ -134,6 +142,10 @@ describe('CollectionSourceComponent', () => {
|
|||||||
it('should send a field update', () => {
|
it('should send a field update', () => {
|
||||||
expect(objectUpdatesService.saveAddFieldUpdate).toHaveBeenCalledWith(router.url, comp.contentSource)
|
expect(objectUpdatesService.saveAddFieldUpdate).toHaveBeenCalledWith(router.url, comp.contentSource)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should display the form', () => {
|
||||||
|
expect(form).not.toBeNull();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isValid', () => {
|
describe('isValid', () => {
|
||||||
@@ -155,4 +167,20 @@ describe('CollectionSourceComponent', () => {
|
|||||||
expect(comp.isValid()).toBe(true);
|
expect(comp.isValid()).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('onSubmit', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
comp.onSubmit();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should re-initialize the field updates', () => {
|
||||||
|
expect(objectUpdatesService.initialize).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should display a success notification', () => {
|
||||||
|
expect(notificationsService.success).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO: Write test for sending data to REST API on submit
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user