mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
63669: More ContentSourceComponennt tests
This commit is contained in:
@@ -109,22 +109,30 @@ describe('CollectionSourceComponent', () => {
|
||||
});
|
||||
|
||||
describe('on startup', () => {
|
||||
let form;
|
||||
|
||||
beforeEach(() => {
|
||||
form = fixture.debugElement.query(By.css('ds-form'));
|
||||
});
|
||||
|
||||
it('ContentSource should be disabled', () => {
|
||||
expect(comp.contentSource.enabled).toBe(false);
|
||||
});
|
||||
|
||||
it('the input-form should be disabled', () => {
|
||||
expect(comp.formGroup.disabled).toBe(true);
|
||||
it('the input-form should be hidden', () => {
|
||||
expect(form).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('when selecting the checkbox', () => {
|
||||
let input;
|
||||
let form;
|
||||
|
||||
beforeEach(() => {
|
||||
input = fixture.debugElement.query(By.css('#externalSourceCheck')).nativeElement;
|
||||
input.click();
|
||||
fixture.detectChanges();
|
||||
form = fixture.debugElement.query(By.css('ds-form'));
|
||||
});
|
||||
|
||||
it('should enable ContentSource', () => {
|
||||
@@ -134,6 +142,10 @@ describe('CollectionSourceComponent', () => {
|
||||
it('should send a field update', () => {
|
||||
expect(objectUpdatesService.saveAddFieldUpdate).toHaveBeenCalledWith(router.url, comp.contentSource)
|
||||
});
|
||||
|
||||
it('should display the form', () => {
|
||||
expect(form).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValid', () => {
|
||||
@@ -155,4 +167,20 @@ describe('CollectionSourceComponent', () => {
|
||||
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