"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/app/submission/import-external/import-external-collection/submission-import-external-collection.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.

submission-import-external-collection.component.spec.ts  (dspace-angular-dspace-7.0):submission-import-external-collection.component.spec.ts  (dspace-angular-dspace-7.1)
import { Component, NO_ERRORS_SCHEMA, EventEmitter } from '@angular/core'; import { Component, EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
import { waitForAsync, TestBed, ComponentFixture, inject } from '@angular/core/t import { ComponentFixture, fakeAsync, inject, TestBed, waitForAsync } from '@ang
esting'; ular/core/testing';
import { TranslateModule } from '@ngx-translate/core'; import { TranslateModule } from '@ngx-translate/core';
import { createTestComponent } from '../../../shared/testing/utils.test'; import { createTestComponent } from '../../../shared/testing/utils.test';
import { SubmissionImportExternalCollectionComponent } from './submission-import -external-collection.component'; import { SubmissionImportExternalCollectionComponent } from './submission-import -external-collection.component';
import { CollectionListEntry } from '../../../shared/collection-dropdown/collect ion-dropdown.component'; import { CollectionListEntry } from '../../../shared/collection-dropdown/collect ion-dropdown.component';
import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { By } from '@angular/platform-browser';
describe('SubmissionImportExternalCollectionComponent test suite', () => { describe('SubmissionImportExternalCollectionComponent test suite', () => {
let comp: SubmissionImportExternalCollectionComponent; let comp: SubmissionImportExternalCollectionComponent;
let compAsAny: any; let compAsAny: any;
let fixture: ComponentFixture<SubmissionImportExternalCollectionComponent>; let fixture: ComponentFixture<SubmissionImportExternalCollectionComponent>;
beforeEach(waitForAsync (() => { beforeEach(waitForAsync (() => {
TestBed.configureTestingModule({ TestBed.configureTestingModule({
imports: [ imports: [
TranslateModule.forRoot(), TranslateModule.forRoot(),
skipping to change at line 79 skipping to change at line 80
expect(comp.selectedEvent).toEqual(event); expect(comp.selectedEvent).toEqual(event);
}); });
it('The variable \'selectedEvent\' should be assigned', () => { it('The variable \'selectedEvent\' should be assigned', () => {
spyOn(compAsAny.activeModal, 'dismiss'); spyOn(compAsAny.activeModal, 'dismiss');
comp.closeCollectionModal(); comp.closeCollectionModal();
expect(compAsAny.activeModal.dismiss).toHaveBeenCalled(); expect(compAsAny.activeModal.dismiss).toHaveBeenCalled();
}); });
it('should be in loading state when search is not completed', () => {
comp.loading = null;
expect(comp.isLoading()).toBeFalse();
comp.loading = true;
expect(comp.isLoading()).toBeTrue();
comp.loading = false;
expect(comp.isLoading()).toBeFalse();
});
it('should set loading variable to false on searchComplete event', () => {
comp.loading = null;
comp.searchComplete();
expect(comp.loading).toBe(false);
});
it('should emit theOnlySelectable', () => {
spyOn(comp.selectedEvent, 'emit').and.callThrough();
const selected: any = {};
comp.theOnlySelectable(selected);
expect(comp.selectedEvent.emit).toHaveBeenCalledWith(selected);
});
it('dropdown should be invisible when the component is loading', fakeAsync((
) => {
spyOn(comp, 'isLoading').and.returnValue(true);
fixture.detectChanges();
fixture.whenStable().then(() => {
const dropdownMenu = fixture.debugElement.query(By.css('ds-collection-dr
opdown')).nativeElement;
expect(dropdownMenu.classList).toContain('d-none');
});
}));
}); });
}); });
// declare a test component // declare a test component
@Component({ @Component({
selector: 'ds-test-cmp', selector: 'ds-test-cmp',
template: `` template: ``
}) })
class TestComponent { class TestComponent {
 End of changes. 3 change blocks. 
3 lines changed or deleted 46 lines changed or added

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