mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
fixed SubmissionImportExternalPreviewComponent after angular 10 upgrade
This commit is contained in:
@@ -1,11 +1,13 @@
|
|||||||
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
import { Component, NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { async, ComponentFixture, inject, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, inject, TestBed, waitForAsync } from '@angular/core/testing';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { TestScheduler } from 'rxjs/testing';
|
import { TestScheduler } from 'rxjs/testing';
|
||||||
import { of as observableOf } from 'rxjs';
|
import { of as observableOf } from 'rxjs';
|
||||||
import { getTestScheduler } from 'jasmine-marbles';
|
import { getTestScheduler } from 'jasmine-marbles';
|
||||||
|
|
||||||
import { SubmissionImportExternalPreviewComponent } from './submission-import-external-preview.component';
|
import { SubmissionImportExternalPreviewComponent } from './submission-import-external-preview.component';
|
||||||
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
import { NotificationsService } from '../../../shared/notifications/notifications.service';
|
||||||
import { RouterStub } from '../../../shared/testing/router.stub';
|
import { RouterStub } from '../../../shared/testing/router.stub';
|
||||||
@@ -18,6 +20,20 @@ import { Metadata } from '../../../core/shared/metadata.utils';
|
|||||||
import { SubmissionImportExternalCollectionComponent } from '../import-external-collection/submission-import-external-collection.component';
|
import { SubmissionImportExternalCollectionComponent } from '../import-external-collection/submission-import-external-collection.component';
|
||||||
import { CollectionListEntry } from '../../../shared/collection-dropdown/collection-dropdown.component';
|
import { CollectionListEntry } from '../../../shared/collection-dropdown/collection-dropdown.component';
|
||||||
|
|
||||||
|
const externalEntry = Object.assign(new ExternalSourceEntry(), {
|
||||||
|
id: '0001-0001-0001-0001',
|
||||||
|
display: 'John Doe',
|
||||||
|
value: 'John, Doe',
|
||||||
|
metadata: {
|
||||||
|
'dc.identifier.uri': [
|
||||||
|
{
|
||||||
|
value: 'https://orcid.org/0001-0001-0001-0001'
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
_links: { self: { href: 'http://test-rest.com/server/api/integration/externalSources/orcidV2/entryValues/0000-0003-4851-8004' } }
|
||||||
|
});
|
||||||
|
|
||||||
describe('SubmissionImportExternalPreviewComponent test suite', () => {
|
describe('SubmissionImportExternalPreviewComponent test suite', () => {
|
||||||
let comp: SubmissionImportExternalPreviewComponent;
|
let comp: SubmissionImportExternalPreviewComponent;
|
||||||
let compAsAny: any;
|
let compAsAny: any;
|
||||||
@@ -26,21 +42,9 @@ describe('SubmissionImportExternalPreviewComponent test suite', () => {
|
|||||||
let scheduler: TestScheduler;
|
let scheduler: TestScheduler;
|
||||||
const ngbActiveModal = jasmine.createSpyObj('modal', ['close', 'dismiss']);
|
const ngbActiveModal = jasmine.createSpyObj('modal', ['close', 'dismiss']);
|
||||||
const ngbModal = jasmine.createSpyObj('modal', ['open']);
|
const ngbModal = jasmine.createSpyObj('modal', ['open']);
|
||||||
const externalEntry = Object.assign(new ExternalSourceEntry(), {
|
|
||||||
id: '0001-0001-0001-0001',
|
|
||||||
display: 'John Doe',
|
|
||||||
value: 'John, Doe',
|
|
||||||
metadata: {
|
|
||||||
'dc.identifier.uri': [
|
|
||||||
{
|
|
||||||
value: 'https://orcid.org/0001-0001-0001-0001'
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
_links: { self: { href: 'http://test-rest.com/server/api/integration/externalSources/orcidV2/entryValues/0000-0003-4851-8004' } }
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(async(() => {
|
|
||||||
|
beforeEach(waitForAsync(() => {
|
||||||
scheduler = getTestScheduler();
|
scheduler = getTestScheduler();
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
@@ -70,7 +74,7 @@ describe('SubmissionImportExternalPreviewComponent test suite', () => {
|
|||||||
// synchronous beforeEach
|
// synchronous beforeEach
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
const html = `
|
const html = `
|
||||||
<ds-submission-import-external-preview></ds-submission-import-external-preview>`;
|
<ds-submission-import-external-preview [externalSourceEntry]="externalSourceEntry"></ds-submission-import-external-preview>`;
|
||||||
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
|
testFixture = createTestComponent(html, TestComponent) as ComponentFixture<TestComponent>;
|
||||||
testComp = testFixture.componentInstance;
|
testComp = testFixture.componentInstance;
|
||||||
});
|
});
|
||||||
@@ -162,4 +166,5 @@ describe('SubmissionImportExternalPreviewComponent test suite', () => {
|
|||||||
})
|
})
|
||||||
class TestComponent {
|
class TestComponent {
|
||||||
|
|
||||||
|
externalSourceEntry = externalEntry;
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, Input, OnInit } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { NgbActiveModal, NgbModalRef, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
import { NgbActiveModal, NgbModalRef, NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||||
import { ExternalSourceEntry } from '../../../core/shared/external-source-entry.model';
|
import { ExternalSourceEntry } from '../../../core/shared/external-source-entry.model';
|
||||||
@@ -23,7 +23,7 @@ export class SubmissionImportExternalPreviewComponent implements OnInit {
|
|||||||
/**
|
/**
|
||||||
* The external source entry
|
* The external source entry
|
||||||
*/
|
*/
|
||||||
public externalSourceEntry: ExternalSourceEntry;
|
@Input() public externalSourceEntry: ExternalSourceEntry;
|
||||||
/**
|
/**
|
||||||
* The entry metadata list
|
* The entry metadata list
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user