mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 01:54:15 +00:00
Manual fix: sync removed imports between tests and components
The automatic migration made it so HTML always uses the `Themed*` component, and it must therefore be imported in all standalone components that use it. Afterwards, many unit tests fail because the removed imports no longer match up (can't inject `ThemeService`). While we could try to support this as part of the automatic migration, there are too many edge cases for this to be consistent.
This commit is contained in:
@@ -6,7 +6,7 @@ import {
|
||||
} from '@angular/core/testing';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
|
||||
import { ConfigurationSearchPageComponent } from '../../search-page/configuration-search-page.component';
|
||||
import { ThemedConfigurationSearchPageComponent } from '../../search-page/themed-configuration-search-page.component';
|
||||
import { ActivatedRouteStub } from '../../shared/testing/active-router.stub';
|
||||
import { AdminSearchPageComponent } from './admin-search-page.component';
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('AdminSearchPageComponent', () => {
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).overrideComponent(AdminSearchPageComponent, {
|
||||
remove: {
|
||||
imports: [ConfigurationSearchPageComponent],
|
||||
imports: [ThemedConfigurationSearchPageComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -5,7 +5,7 @@ import {
|
||||
waitForAsync,
|
||||
} from '@angular/core/testing';
|
||||
|
||||
import { ConfigurationSearchPageComponent } from '../../search-page/configuration-search-page.component';
|
||||
import { ThemedConfigurationSearchPageComponent } from '../../search-page/themed-configuration-search-page.component';
|
||||
import { AdminWorkflowPageComponent } from './admin-workflow-page.component';
|
||||
|
||||
describe('AdminSearchPageComponent', () => {
|
||||
@@ -20,7 +20,7 @@ describe('AdminSearchPageComponent', () => {
|
||||
.overrideComponent(AdminWorkflowPageComponent, {
|
||||
remove: {
|
||||
imports: [
|
||||
ConfigurationSearchPageComponent,
|
||||
ThemedConfigurationSearchPageComponent,
|
||||
],
|
||||
},
|
||||
})
|
||||
|
@@ -28,7 +28,6 @@ import { DSpaceObjectDataService } from '../../core/data/dspace-object-data.serv
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { Community } from '../../core/shared/community.model';
|
||||
import { Item } from '../../core/shared/item.model';
|
||||
import { BrowseByComponent } from '../../shared/browse-by/browse-by.component';
|
||||
import { ThemedBrowseByComponent } from '../../shared/browse-by/themed-browse-by.component';
|
||||
import { ThemedComcolPageBrowseByComponent } from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component';
|
||||
import { ComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/comcol-page-content.component';
|
||||
@@ -135,7 +134,6 @@ describe('BrowseByDateComponent', () => {
|
||||
ThemedComcolPageHandleComponent,
|
||||
ComcolPageContentComponent,
|
||||
ThemedComcolPageBrowseByComponent,
|
||||
BrowseByComponent,
|
||||
ThemedLoadingComponent,
|
||||
ThemedBrowseByComponent,
|
||||
],
|
||||
|
@@ -25,7 +25,6 @@ import { ItemDataService } from '../../core/data/item-data.service';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { Community } from '../../core/shared/community.model';
|
||||
import { Item } from '../../core/shared/item.model';
|
||||
import { BrowseByComponent } from '../../shared/browse-by/browse-by.component';
|
||||
import { ThemedBrowseByComponent } from '../../shared/browse-by/themed-browse-by.component';
|
||||
import { ThemedComcolPageBrowseByComponent } from '../../shared/comcol/comcol-page-browse-by/themed-comcol-page-browse-by.component';
|
||||
import { ComcolPageContentComponent } from '../../shared/comcol/comcol-page-content/comcol-page-content.component';
|
||||
@@ -108,7 +107,6 @@ describe('BrowseByTitleComponent', () => {
|
||||
ComcolPageContentComponent,
|
||||
DsoEditMenuComponent,
|
||||
ThemedComcolPageBrowseByComponent,
|
||||
BrowseByComponent,
|
||||
ThemedLoadingComponent,
|
||||
ThemedBrowseByComponent,
|
||||
] },
|
||||
|
@@ -12,7 +12,6 @@ import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { ItemTemplateDataService } from '../../core/data/item-template-data.service';
|
||||
import { Collection } from '../../core/shared/collection.model';
|
||||
import { DsoEditMetadataComponent } from '../../dso-shared/dso-edit-metadata/dso-edit-metadata.component';
|
||||
import { ThemedDsoEditMetadataComponent } from '../../dso-shared/dso-edit-metadata/themed-dso-edit-metadata.component';
|
||||
import { getMockThemeService } from '../../shared/mocks/theme-service.mock';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
@@ -51,7 +50,7 @@ describe('EditItemTemplatePageComponent', () => {
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).overrideComponent(EditItemTemplatePageComponent, {
|
||||
remove: {
|
||||
imports: [ThemedDsoEditMetadataComponent, DsoEditMetadataComponent],
|
||||
imports: [ThemedDsoEditMetadataComponent],
|
||||
},
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
@@ -22,7 +22,7 @@ import { Item } from '../../core/shared/item.model';
|
||||
import { ITEM } from '../../core/shared/item.resource-type';
|
||||
import { MetadataValue } from '../../core/shared/metadata.models';
|
||||
import { AlertComponent } from '../../shared/alert/alert.component';
|
||||
import { LoadingComponent } from '../../shared/loading/loading.component';
|
||||
import { ThemedLoadingComponent } from '../../shared/loading/themed-loading.component';
|
||||
import { NotificationsService } from '../../shared/notifications/notifications.service';
|
||||
import { TestDataService } from '../../shared/testing/test-data-service.mock';
|
||||
import { VarDirective } from '../../shared/utils/var.directive';
|
||||
@@ -112,7 +112,7 @@ describe('DsoEditMetadataComponent', () => {
|
||||
DsoEditMetadataValueHeadersComponent,
|
||||
DsoEditMetadataFieldValuesComponent,
|
||||
AlertComponent,
|
||||
LoadingComponent,
|
||||
ThemedLoadingComponent,
|
||||
],
|
||||
},
|
||||
})
|
||||
|
@@ -26,7 +26,7 @@ import { TruncatableComponent } from '../../../../../shared/truncatable/truncata
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { TruncatablePartComponent } from '../../../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { ThumbnailComponent } from '../../../../../thumbnail/thumbnail.component';
|
||||
import { ThemedThumbnailComponent } from '../../../../../thumbnail/themed-thumbnail.component';
|
||||
import { JournalIssueSearchResultListElementComponent } from './journal-issue-search-result-list-element.component';
|
||||
|
||||
let journalIssueListElementComponent: JournalIssueSearchResultListElementComponent;
|
||||
@@ -108,7 +108,7 @@ describe('JournalIssueSearchResultListElementComponent', () => {
|
||||
}).overrideComponent(JournalIssueSearchResultListElementComponent, {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default } ,
|
||||
remove: {
|
||||
imports: [ThumbnailComponent, ThemedBadgesComponent, TruncatableComponent, TruncatablePartComponent],
|
||||
imports: [ThemedThumbnailComponent, ThemedBadgesComponent, TruncatableComponent, TruncatablePartComponent],
|
||||
} },
|
||||
).compileComponents();
|
||||
}));
|
||||
|
@@ -26,7 +26,7 @@ import { TruncatableComponent } from '../../../../../shared/truncatable/truncata
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { TruncatablePartComponent } from '../../../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { ThumbnailComponent } from '../../../../../thumbnail/thumbnail.component';
|
||||
import { ThemedThumbnailComponent } from '../../../../../thumbnail/themed-thumbnail.component';
|
||||
import { JournalVolumeSearchResultListElementComponent } from './journal-volume-search-result-list-element.component';
|
||||
|
||||
let journalVolumeListElementComponent: JournalVolumeSearchResultListElementComponent;
|
||||
@@ -103,7 +103,7 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
remove: {
|
||||
imports: [
|
||||
ThumbnailComponent, NgClass, ThemedBadgesComponent, TruncatableComponent, TruncatablePartComponent,
|
||||
ThemedThumbnailComponent, NgClass, ThemedBadgesComponent, TruncatableComponent, TruncatablePartComponent,
|
||||
],
|
||||
},
|
||||
}).compileComponents();
|
||||
@@ -196,7 +196,7 @@ describe('JournalVolumeSearchResultListElementComponent', () => {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
remove: {
|
||||
imports: [
|
||||
ThumbnailComponent,
|
||||
ThemedThumbnailComponent,
|
||||
ThemedBadgesComponent,
|
||||
TruncatableComponent,
|
||||
TruncatablePartComponent,
|
||||
|
@@ -26,7 +26,7 @@ import { TruncatableComponent } from '../../../../../shared/truncatable/truncata
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { TruncatablePartComponent } from '../../../../../shared/truncatable/truncatable-part/truncatable-part.component';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { ThumbnailComponent } from '../../../../../thumbnail/thumbnail.component';
|
||||
import { ThemedThumbnailComponent } from '../../../../../thumbnail/themed-thumbnail.component';
|
||||
import { JournalSearchResultListElementComponent } from './journal-search-result-list-element.component';
|
||||
|
||||
let journalListElementComponent: JournalSearchResultListElementComponent;
|
||||
@@ -99,7 +99,7 @@ describe('JournalSearchResultListElementComponent', () => {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
remove: {
|
||||
imports: [
|
||||
ThumbnailComponent,
|
||||
ThemedThumbnailComponent,
|
||||
ThemedBadgesComponent,
|
||||
TruncatableComponent,
|
||||
TruncatablePartComponent,
|
||||
|
@@ -24,7 +24,7 @@ import { ThemeService } from '../../../../../shared/theme-support/theme.service'
|
||||
import { TruncatableComponent } from '../../../../../shared/truncatable/truncatable.component';
|
||||
import { TruncatableService } from '../../../../../shared/truncatable/truncatable.service';
|
||||
import { TruncatePipe } from '../../../../../shared/utils/truncate.pipe';
|
||||
import { ThumbnailComponent } from '../../../../../thumbnail/thumbnail.component';
|
||||
import { ThemedThumbnailComponent } from '../../../../../thumbnail/themed-thumbnail.component';
|
||||
import { ProjectSearchResultListElementComponent } from './project-search-result-list-element.component';
|
||||
|
||||
let projectListElementComponent: ProjectSearchResultListElementComponent;
|
||||
@@ -94,7 +94,7 @@ describe('ProjectSearchResultListElementComponent', () => {
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
}).overrideComponent(ProjectSearchResultListElementComponent, {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
remove: { imports: [ThumbnailComponent, TruncatableComponent, ThemedBadgesComponent] },
|
||||
remove: { imports: [ThemedThumbnailComponent, TruncatableComponent, ThemedBadgesComponent] },
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
|
@@ -8,7 +8,6 @@ import {
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { RegisterEmailFormComponent } from '../../register-email-form/register-email-form.component';
|
||||
import { ThemedRegisterEmailFormComponent } from '../../register-email-form/themed-registry-email-form.component';
|
||||
import { ForgotEmailComponent } from './forgot-email.component';
|
||||
|
||||
@@ -23,7 +22,7 @@ describe('ForgotEmailComponent', () => {
|
||||
})
|
||||
.overrideComponent(ForgotEmailComponent, {
|
||||
remove: {
|
||||
imports: [RegisterEmailFormComponent, ThemedRegisterEmailFormComponent],
|
||||
imports: [ThemedRegisterEmailFormComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -19,7 +19,6 @@ import { ThemedSearchNavbarComponent } from '../search-navbar/themed-search-navb
|
||||
import { ThemedAuthNavMenuComponent } from '../shared/auth-nav-menu/themed-auth-nav-menu.component';
|
||||
import { HostWindowService } from '../shared/host-window.service';
|
||||
import { ImpersonateNavbarComponent } from '../shared/impersonate-navbar/impersonate-navbar.component';
|
||||
import { LangSwitchComponent } from '../shared/lang-switch/lang-switch.component';
|
||||
import { ThemedLangSwitchComponent } from '../shared/lang-switch/themed-lang-switch.component';
|
||||
import { MenuService } from '../shared/menu/menu.service';
|
||||
import { ActivatedRouteStub } from '../shared/testing/active-router.stub';
|
||||
@@ -60,7 +59,7 @@ describe('HeaderComponent', () => {
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.overrideComponent(HeaderComponent, {
|
||||
remove: { imports: [ ThemedLangSwitchComponent, ThemedSearchNavbarComponent, LangSwitchComponent, ContextHelpToggleComponent, ThemedAuthNavMenuComponent, ImpersonateNavbarComponent] },
|
||||
remove: { imports: [ ThemedLangSwitchComponent, ThemedSearchNavbarComponent, ContextHelpToggleComponent, ThemedAuthNavMenuComponent, ImpersonateNavbarComponent] },
|
||||
})
|
||||
.compileComponents(); // compile template and css
|
||||
}));
|
||||
|
@@ -9,7 +9,7 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ConfigurationSearchPageComponent } from '../../../../search-page/configuration-search-page.component';
|
||||
import { ThemedConfigurationSearchPageComponent } from '../../../../search-page/themed-configuration-search-page.component';
|
||||
import { RelatedEntitiesSearchComponent } from './related-entities-search.component';
|
||||
|
||||
describe('RelatedEntitiesSearchComponent', () => {
|
||||
@@ -30,7 +30,7 @@ describe('RelatedEntitiesSearchComponent', () => {
|
||||
})
|
||||
.overrideComponent(RelatedEntitiesSearchComponent, {
|
||||
remove: {
|
||||
imports: [ConfigurationSearchPageComponent],
|
||||
imports: [ThemedConfigurationSearchPageComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -19,7 +19,7 @@ import { Item } from '../../../core/shared/item.model';
|
||||
import { PageInfo } from '../../../core/shared/page-info.model';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
|
||||
import {
|
||||
ItemMockPid10,
|
||||
NotificationsMockDspaceObject,
|
||||
@@ -106,7 +106,7 @@ describe('ProjectEntryImportModalComponent test suite', () => {
|
||||
.overrideComponent(ProjectEntryImportModalComponent, {
|
||||
remove: {
|
||||
imports: [
|
||||
LoadingComponent,
|
||||
ThemedLoadingComponent,
|
||||
ThemedSearchResultsComponent,
|
||||
AlertComponent,
|
||||
],
|
||||
|
@@ -16,7 +16,7 @@ import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
|
||||
import {
|
||||
getMockNotificationsStateService,
|
||||
qualityAssuranceSourceObjectMoreAbstract,
|
||||
@@ -61,7 +61,7 @@ describe('QualityAssuranceSourceComponent test suite', () => {
|
||||
remove: {
|
||||
imports: [
|
||||
AlertComponent,
|
||||
LoadingComponent,
|
||||
ThemedLoadingComponent,
|
||||
PaginationComponent,
|
||||
],
|
||||
},
|
||||
|
@@ -18,7 +18,7 @@ import { ItemDataService } from 'src/app/core/data/item-data.service';
|
||||
|
||||
import { PaginationService } from '../../../core/pagination/pagination.service';
|
||||
import { AlertComponent } from '../../../shared/alert/alert.component';
|
||||
import { LoadingComponent } from '../../../shared/loading/loading.component';
|
||||
import { ThemedLoadingComponent } from '../../../shared/loading/themed-loading.component';
|
||||
import {
|
||||
getMockNotificationsStateService,
|
||||
qualityAssuranceTopicObjectMoreAbstract,
|
||||
@@ -69,7 +69,7 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
|
||||
remove: {
|
||||
imports: [
|
||||
AlertComponent,
|
||||
LoadingComponent,
|
||||
ThemedLoadingComponent,
|
||||
PaginationComponent,
|
||||
],
|
||||
},
|
||||
|
@@ -8,7 +8,6 @@ import {
|
||||
import { ReactiveFormsModule } from '@angular/forms';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
import { RegisterEmailFormComponent } from '../../register-email-form/register-email-form.component';
|
||||
import { ThemedRegisterEmailFormComponent } from '../../register-email-form/themed-registry-email-form.component';
|
||||
import { RegisterEmailComponent } from './register-email.component';
|
||||
|
||||
@@ -24,7 +23,7 @@ describe('RegisterEmailComponent', () => {
|
||||
})
|
||||
.overrideComponent(RegisterEmailComponent, {
|
||||
remove: {
|
||||
imports: [RegisterEmailFormComponent, ThemedRegisterEmailFormComponent],
|
||||
imports: [ThemedRegisterEmailFormComponent],
|
||||
},
|
||||
})
|
||||
.compileComponents();
|
||||
|
@@ -21,7 +21,7 @@ import { NotificationsService } from '../../../../../../notifications/notificati
|
||||
import { ItemSearchResult } from '../../../../../../object-collection/shared/item-search-result.model';
|
||||
import { SelectableListService } from '../../../../../../object-list/selectable-list/selectable-list.service';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../../../remote-data.utils';
|
||||
import { SearchResultsComponent } from '../../../../../../search/search-results/search-results.component';
|
||||
import { ThemedSearchResultsComponent } from '../../../../../../search/search-results/themed-search-results.component';
|
||||
import { createPaginatedList } from '../../../../../../testing/utils.test';
|
||||
import { RelationshipOptions } from '../../../../models/relationship-options.model';
|
||||
import {
|
||||
@@ -97,7 +97,7 @@ describe('DsDynamicLookupRelationExternalSourceTabComponent', () => {
|
||||
schemas: [NO_ERRORS_SCHEMA],
|
||||
})
|
||||
.overrideComponent(ExternalSourceEntryImportModalComponent, {
|
||||
remove: { imports: [SearchResultsComponent] },
|
||||
remove: { imports: [ThemedSearchResultsComponent] },
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
@@ -17,7 +17,7 @@ import { of as observableOf } from 'rxjs';
|
||||
|
||||
import { APP_CONFIG } from '../../../../../config/app-config.interface';
|
||||
import { Item } from '../../../../core/shared/item.model';
|
||||
import { ThumbnailComponent } from '../../../../thumbnail/thumbnail.component';
|
||||
import { ThemedThumbnailComponent } from '../../../../thumbnail/themed-thumbnail.component';
|
||||
import { TranslateLoaderMock } from '../../../mocks/translate-loader.mock';
|
||||
import { ThemedBadgesComponent } from '../../../object-collection/shared/badges/themed-badges.component';
|
||||
import { ItemCollectionComponent } from '../../../object-collection/shared/mydspace-item-collection/item-collection.component';
|
||||
@@ -116,7 +116,7 @@ describe('ItemListPreviewComponent', () => {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
remove: {
|
||||
imports: [
|
||||
ThumbnailComponent, ThemedBadgesComponent,
|
||||
ThemedThumbnailComponent, ThemedBadgesComponent,
|
||||
TruncatableComponent, TruncatablePartComponent,
|
||||
ItemSubmitterComponent, ItemCollectionComponent,
|
||||
],
|
||||
@@ -228,7 +228,7 @@ describe('ItemListPreviewComponent', () => {
|
||||
add: { changeDetection: ChangeDetectionStrategy.Default },
|
||||
remove: {
|
||||
imports: [
|
||||
ThumbnailComponent, ThemedBadgesComponent,
|
||||
ThemedThumbnailComponent, ThemedBadgesComponent,
|
||||
TruncatableComponent, TruncatablePartComponent,
|
||||
ItemSubmitterComponent, ItemCollectionComponent,
|
||||
],
|
||||
|
@@ -51,6 +51,7 @@ import { SectionUploadService } from '../section-upload.service';
|
||||
import { POLICY_DEFAULT_WITH_LIST } from '../section-upload-constants';
|
||||
import { SubmissionSectionUploadFileEditComponent } from './edit/section-upload-file-edit.component';
|
||||
import { SubmissionSectionUploadFileComponent } from './section-upload-file.component';
|
||||
import { ThemedSubmissionSectionUploadFileComponent } from './themed-section-upload-file.component';
|
||||
import { SubmissionSectionUploadFileViewComponent } from './view/section-upload-file-view.component';
|
||||
|
||||
const configMetadataFormMock = {
|
||||
@@ -284,7 +285,7 @@ describe('SubmissionSectionUploadFileComponent test suite', () => {
|
||||
template: ``,
|
||||
standalone: true,
|
||||
imports: [
|
||||
SubmissionSectionUploadFileComponent,
|
||||
ThemedSubmissionSectionUploadFileComponent,
|
||||
CommonModule,
|
||||
AsyncPipe,
|
||||
NgbModule],
|
||||
|
Reference in New Issue
Block a user