mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
AAE-36484 improved standalone support for Core (#10998)
improved standalone support
This commit is contained in:
@@ -1,17 +1,21 @@
|
||||
# @alfresco/adf-core/shell
|
||||
|
||||
Secondary entry point of `@alfresco/adf-core`. It can be used by importing from `@alfresco/adf-core/shell`.
|
||||
Namespace: `@alfresco/adf-core/shell`.
|
||||
|
||||
This module provides the main layout for the application, allowing you to define routes and guards for your application shell.
|
||||
|
||||
# Shell
|
||||
|
||||
[ShellModule](./src/lib/shell.module.ts) is designated as a main layout for the application.
|
||||
Passed routes are going to be attached to shell main route.
|
||||
|
||||
I order to attach routes to appShell, `withRoutes(routes: Routes | AppShellRoutesConfig)` method should be used.
|
||||
```typescript
|
||||
import { provideShellRoutes } from '@alfresco/adf-core/shell';
|
||||
|
||||
Passed routes are going to be attached to [shell main route](./src/lib/shell.routes.ts)
|
||||
provideShellRoutes([/*Your Routes*/])
|
||||
```
|
||||
|
||||
If you would like to provide custom app guard, you can provide your own using [SHELL_AUTH_TOKEN](./src/lib/shell.routes.ts)
|
||||
If you would like to provide custom app guard, you can provide your own using `SHELL_AUTH_TOKEN`.
|
||||
|
||||
## Shell Service
|
||||
|
||||
In order to use `shell`, you need to provide [SHELL_APP_SERVICE](./src/lib/services/shell-app.service.ts) which provides necessary options for shell component to work.
|
||||
In order to use `shell`, you need to provide `SHELL_APP_SERVICE` which provides necessary options for shell component to work.
|
||||
|
@@ -18,3 +18,4 @@
|
||||
export * from './lib/shell.module';
|
||||
export * from './lib/services/shell-app.service';
|
||||
export * from './lib/components/shell/shell.component';
|
||||
export * from './lib/shell.routes';
|
||||
|
@@ -16,19 +16,11 @@
|
||||
*/
|
||||
|
||||
import { ModuleWithProviders, NgModule } from '@angular/core';
|
||||
import { Routes, provideRoutes, Route } from '@angular/router';
|
||||
import { SHELL_LAYOUT_ROUTE } from './shell.routes';
|
||||
import { ShellLayoutComponent } from './components/shell/shell.component';
|
||||
import { Routes, provideRouter } from '@angular/router';
|
||||
import { AppShellRoutesConfig, SHELL_LAYOUT_ROUTE } from './shell.routes';
|
||||
|
||||
export interface AppShellRoutesConfig {
|
||||
shellParentRoute?: Route;
|
||||
shellChildren: Routes;
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [ShellLayoutComponent],
|
||||
exports: [ShellLayoutComponent]
|
||||
})
|
||||
/** @deprecated use `provideShellRoutes` instead */
|
||||
@NgModule()
|
||||
export class ShellModule {
|
||||
static withRoutes(routes: Routes | AppShellRoutesConfig): ModuleWithProviders<ShellModule> {
|
||||
if (Array.isArray(routes)) {
|
||||
@@ -54,7 +46,7 @@ function getModuleForRoutes(routes: Routes): ModuleWithProviders<ShellModule> {
|
||||
|
||||
return {
|
||||
ngModule: ShellModule,
|
||||
providers: provideRoutes([shellLayoutRoute])
|
||||
providers: [provideRouter([shellLayoutRoute])]
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,6 +76,6 @@ function getModuleForRouteConfig(config: AppShellRoutesConfig): ModuleWithProvid
|
||||
|
||||
return {
|
||||
ngModule: ShellModule,
|
||||
providers: provideRoutes([rootRoute])
|
||||
providers: [provideRouter([rootRoute])]
|
||||
};
|
||||
}
|
||||
|
@@ -15,9 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Route } from '@angular/router';
|
||||
import { provideRouter, Route, Routes } from '@angular/router';
|
||||
import { ShellLayoutComponent } from './components/shell/shell.component';
|
||||
import { SHELL_AUTH_TOKEN } from './services/shell-app.service';
|
||||
import { EnvironmentProviders } from '@angular/core';
|
||||
|
||||
export const SHELL_LAYOUT_ROUTE: Route = {
|
||||
path: '',
|
||||
@@ -25,3 +26,38 @@ export const SHELL_LAYOUT_ROUTE: Route = {
|
||||
canActivate: [SHELL_AUTH_TOKEN],
|
||||
children: []
|
||||
};
|
||||
|
||||
export interface AppShellRoutesConfig {
|
||||
shellParentRoute?: Route;
|
||||
shellChildren: Routes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides shell routes for the application.
|
||||
*
|
||||
* @param routes The routes configuration for the shell.
|
||||
* @returns An array of providers for the shell routes.
|
||||
*/
|
||||
export function provideShellRoutes(routes: Routes | AppShellRoutesConfig): EnvironmentProviders[] {
|
||||
const shellLayoutRoute = SHELL_LAYOUT_ROUTE;
|
||||
|
||||
if (Array.isArray(routes)) {
|
||||
shellLayoutRoute.children.push(...routes);
|
||||
return [provideRouter([shellLayoutRoute])];
|
||||
}
|
||||
|
||||
const shellChildrenRoutes = routes.shellChildren || [];
|
||||
if (shellChildrenRoutes.length > 0) {
|
||||
shellLayoutRoute.children.push(...shellChildrenRoutes);
|
||||
}
|
||||
|
||||
const shellParentRoute = routes.shellParentRoute;
|
||||
const rootRoute = shellParentRoute || shellLayoutRoute;
|
||||
|
||||
if (routes.shellParentRoute) {
|
||||
rootRoute.children = rootRoute.children || [];
|
||||
rootRoute.children.push(shellLayoutRoute);
|
||||
}
|
||||
|
||||
return [provideRouter([rootRoute])];
|
||||
}
|
||||
|
@@ -18,9 +18,9 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { AppConfigPipe } from './app-config.pipe';
|
||||
|
||||
/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */
|
||||
@NgModule({
|
||||
imports: [AppConfigPipe],
|
||||
exports: [AppConfigPipe]
|
||||
})
|
||||
/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */
|
||||
export class AppConfigModule {}
|
||||
|
43
lib/core/src/lib/app-config/provide-app-config.ts
Normal file
43
lib/core/src/lib/app-config/provide-app-config.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { inject, provideAppInitializer, Provider, EnvironmentProviders } from '@angular/core';
|
||||
import { StoragePrefixFactory } from './app-config-storage-prefix.factory';
|
||||
import { loadAppConfig } from './app-config.loader';
|
||||
import { AppConfigService } from './app-config.service';
|
||||
import { StorageService } from '../common';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
/**
|
||||
* Provides the application configuration for the application.
|
||||
*
|
||||
* @returns An array of providers to initialize the application configuration.
|
||||
*/
|
||||
export function provideAppConfig(): (Provider | EnvironmentProviders)[] {
|
||||
return [
|
||||
StoragePrefixFactory,
|
||||
provideAppInitializer(() => {
|
||||
const initializerFn = loadAppConfig(
|
||||
inject(AppConfigService),
|
||||
inject(StorageService),
|
||||
inject(AdfHttpClient),
|
||||
inject(StoragePrefixFactory)
|
||||
);
|
||||
return initializerFn();
|
||||
})
|
||||
];
|
||||
}
|
@@ -21,3 +21,4 @@ export * from './app-config.pipe';
|
||||
export * from './app-config-storage-prefix.factory';
|
||||
|
||||
export * from './app-config.module';
|
||||
export * from './provide-app-config';
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { UnitTestingUtils } from '../testing/unit-testing-utils';
|
||||
@@ -119,7 +118,7 @@ testCases.forEach((testCase) => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, TestComponent]
|
||||
imports: [TestComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.componentInstance.isEnabled = false;
|
||||
|
@@ -15,8 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { NgModule, ModuleWithProviders, inject, provideAppInitializer } from '@angular/core';
|
||||
import { TranslateModule, TranslateLoader, TranslateStore, TranslateService } from '@ngx-translate/core';
|
||||
import { NgModule, ModuleWithProviders } from '@angular/core';
|
||||
import { TranslateLoader, provideTranslateService } from '@ngx-translate/core';
|
||||
import { ABOUT_DIRECTIVES } from './about/about.module';
|
||||
import { CARD_VIEW_DIRECTIVES } from './card-view/card-view.module';
|
||||
import { CONTEXT_MENU_DIRECTIVES } from './context-menu/context-menu.module';
|
||||
@@ -37,29 +37,24 @@ import { NOTIFICATION_HISTORY_DIRECTIVES } from './notifications/notification-hi
|
||||
import { BlankPageComponent } from './blank-page/blank-page.component';
|
||||
import { CORE_DIRECTIVES } from './directives/directive.module';
|
||||
import { CORE_PIPES } from './pipes/pipe.module';
|
||||
import { TranslationService } from './translation/translation.service';
|
||||
import { TranslateLoaderService } from './translation/translate-loader.service';
|
||||
import { SEARCH_TEXT_INPUT_DIRECTIVES } from './search-text/search-text-input.module';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
import { AuthenticationInterceptor, Authentication } from '@alfresco/adf-core/auth';
|
||||
import { HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http';
|
||||
import { HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withXsrfConfiguration, withInterceptorsFromDi } from '@angular/common/http';
|
||||
import { AuthenticationService } from './auth/services/authentication.service';
|
||||
import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar';
|
||||
import { loadAppConfig } from './app-config/app-config.loader';
|
||||
import { AppConfigService } from './app-config/app-config.service';
|
||||
import { StorageService } from './common/services/storage.service';
|
||||
import { MomentDateAdapter } from './common/utils/moment-date-adapter';
|
||||
import { AppConfigPipe, StoragePrefixFactory } from './app-config';
|
||||
import { AppConfigPipe } from './app-config';
|
||||
import { IconComponent } from './icon';
|
||||
import { SortingPickerComponent } from './sorting-picker';
|
||||
import { DynamicChipListComponent } from './dynamic-chip-list';
|
||||
import { IdentityUserInfoComponent } from './identity-user-info';
|
||||
import { UnsavedChangesDialogComponent } from './dialogs';
|
||||
import { MaterialModule } from './material.module';
|
||||
import { DecimalRenderMiddlewareService, FORM_FIELD_MODEL_RENDER_MIDDLEWARE } from './form';
|
||||
import { provideAppConfig } from './app-config/provide-app-config';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
TranslateModule,
|
||||
...ABOUT_DIRECTIVES,
|
||||
...VIEWER_DIRECTIVES,
|
||||
...LAYOUT_DIRECTIVES,
|
||||
@@ -87,11 +82,6 @@ import { MaterialModule } from './material.module';
|
||||
BlankPageComponent,
|
||||
UnsavedChangesDialogComponent,
|
||||
DynamicChipListComponent,
|
||||
HttpClientModule,
|
||||
HttpClientXsrfModule.withOptions({
|
||||
cookieName: 'CSRF-TOKEN',
|
||||
headerName: 'X-CSRF-TOKEN'
|
||||
}),
|
||||
MaterialModule
|
||||
],
|
||||
providers: [...CORE_PIPES],
|
||||
@@ -115,7 +105,6 @@ import { MaterialModule } from './material.module';
|
||||
...LANGUAGE_MENU_DIRECTIVES,
|
||||
...INFO_DRAWER_DIRECTIVES,
|
||||
...DATATABLE_DIRECTIVES,
|
||||
TranslateModule,
|
||||
...TEMPLATE_DIRECTIVES,
|
||||
SortingPickerComponent,
|
||||
IconComponent,
|
||||
@@ -132,20 +121,16 @@ export class CoreModule {
|
||||
return {
|
||||
ngModule: CoreModule,
|
||||
providers: [
|
||||
TranslateStore,
|
||||
TranslateService,
|
||||
{ provide: TranslateLoader, useClass: TranslateLoaderService },
|
||||
MomentDateAdapter,
|
||||
StoragePrefixFactory,
|
||||
provideAppInitializer(() => {
|
||||
const initializerFn = loadAppConfig(
|
||||
inject(AppConfigService),
|
||||
inject(StorageService),
|
||||
inject(AdfHttpClient),
|
||||
inject(StoragePrefixFactory)
|
||||
);
|
||||
return initializerFn();
|
||||
provideTranslateService({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderService,
|
||||
deps: [HttpClient]
|
||||
},
|
||||
defaultLanguage: 'en'
|
||||
}),
|
||||
provideAppConfig(),
|
||||
provideHttpClient(withInterceptorsFromDi(), withXsrfConfiguration({ cookieName: 'CSRF-TOKEN', headerName: 'X-CSRF-TOKEN' })),
|
||||
{ provide: HTTP_INTERCEPTORS, useClass: AuthenticationInterceptor, multi: true },
|
||||
{ provide: Authentication, useClass: AuthenticationService },
|
||||
{
|
||||
@@ -153,6 +138,11 @@ export class CoreModule {
|
||||
useValue: {
|
||||
duration: 10000
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE,
|
||||
useClass: DecimalRenderMiddlewareService,
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
};
|
||||
@@ -167,8 +157,4 @@ export class CoreModule {
|
||||
ngModule: CoreModule
|
||||
};
|
||||
}
|
||||
|
||||
constructor(translation: TranslationService) {
|
||||
translation.addTranslationFolder('adf-core', 'assets/adf-core');
|
||||
}
|
||||
}
|
||||
|
@@ -24,7 +24,6 @@ import { DataSorting } from '../../data/data-sorting.model';
|
||||
import { ObjectDataColumn } from '../../data/object-datacolumn.model';
|
||||
import { ObjectDataTableAdapter } from '../../data/object-datatable-adapter';
|
||||
import { DataTableComponent, ShowHeaderMode } from './datatable.component';
|
||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||
import { DataColumnListComponent } from '../../data-column/data-column-list.component';
|
||||
import { DataColumnComponent } from '../../data-column/data-column.component';
|
||||
import { CdkDrag, CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop';
|
||||
@@ -35,6 +34,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { UnitTestingUtils } from '../../../testing/unit-testing-utils';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-custom-column-template-component',
|
||||
@@ -146,7 +146,8 @@ describe('DataTable', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, CustomColumnHeaderComponent]
|
||||
imports: [CustomColumnHeaderComponent],
|
||||
providers: [provideRouter([])]
|
||||
});
|
||||
fixture = TestBed.createComponent(DataTableComponent);
|
||||
dataTable = fixture.componentInstance;
|
||||
@@ -1291,7 +1292,7 @@ describe('DataTable', () => {
|
||||
expect(dataTable.data.getColumns()).toEqual(expectedNewDataColumns);
|
||||
});
|
||||
|
||||
it('should render the custom column header', () => {
|
||||
it('should render the custom column header', async () => {
|
||||
const customHeader = TestBed.createComponent(CustomColumnHeaderComponent).componentInstance.templateRef;
|
||||
dataTable.data = new ObjectDataTableAdapter(
|
||||
[
|
||||
@@ -1301,6 +1302,7 @@ describe('DataTable', () => {
|
||||
[new ObjectDataColumn({ key: 'id', title: 'ID' }), new ObjectDataColumn({ key: 'name', title: 'Name', header: customHeader })]
|
||||
);
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(testingUtils.getInnerTextByDataAutomationId('auto_id_id')).toContain('ID');
|
||||
expect(testingUtils.getInnerTextByDataAutomationId('auto_id_name')).toContain('CUSTOM HEADER');
|
||||
@@ -1518,7 +1520,7 @@ describe('Accessibility', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, CustomColumnTemplateComponent],
|
||||
imports: [CustomColumnTemplateComponent],
|
||||
providers: [{ provide: ConfigurableFocusTrapFactory, useValue: focusTrapFactory }],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
@@ -1752,7 +1754,7 @@ describe('Drag&Drop column header', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, CustomColumnTemplateComponent],
|
||||
imports: [CustomColumnTemplateComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
fixture = TestBed.createComponent(DataTableComponent);
|
||||
@@ -1846,7 +1848,7 @@ describe('Show/hide columns', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, CustomColumnTemplateComponent],
|
||||
imports: [CustomColumnTemplateComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
fixture = TestBed.createComponent(DataTableComponent);
|
||||
@@ -1954,7 +1956,7 @@ describe('Column Resizing', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, CustomColumnTemplateComponent],
|
||||
imports: [CustomColumnTemplateComponent],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
fixture = TestBed.createComponent(DataTableComponent);
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { DataTableComponent } from '../components/datatable/datatable.component';
|
||||
import { HeaderFilterTemplateDirective } from './header-filter-template.directive';
|
||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
||||
|
||||
describe('HeaderFilterTemplateDirective', () => {
|
||||
let fixture: ComponentFixture<DataTableComponent>;
|
||||
@@ -27,7 +26,7 @@ describe('HeaderFilterTemplateDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [DataTableComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(DataTableComponent);
|
||||
dataTable = fixture.componentInstance;
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { DataTableComponent } from '../components/datatable/datatable.component';
|
||||
import { NoPermissionTemplateDirective } from './no-permission-template.directive';
|
||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
||||
|
||||
describe('NoPermissionTemplateDirective', () => {
|
||||
let fixture: ComponentFixture<DataTableComponent>;
|
||||
@@ -27,7 +26,7 @@ describe('NoPermissionTemplateDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [DataTableComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(DataTableComponent);
|
||||
dataTable = fixture.componentInstance;
|
||||
|
@@ -20,7 +20,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DIALOG_COMPONENT_DATA, DialogComponent } from './dialog.component';
|
||||
import { DialogData } from './dialog-data.interface';
|
||||
import { DialogSize } from './dialog.model';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../testing';
|
||||
import { UnitTestingUtils } from '../../testing';
|
||||
import { Component, inject } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
@@ -56,7 +56,7 @@ describe('DialogComponent', () => {
|
||||
|
||||
const setupBeforeEach = (dialogOptions: DialogData = data) => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, DummyComponent],
|
||||
imports: [DummyComponent],
|
||||
providers: [
|
||||
{ provide: MAT_DIALOG_DATA, useValue: dialogOptions },
|
||||
{ provide: MatDialogRef, useValue: dialogRef }
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigValues, CoreTestingModule, UnsavedChangesDialogComponent, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AppConfigValues, UnsavedChangesDialogComponent, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA, MatDialogClose } from '@angular/material/dialog';
|
||||
import { UnsavedChangesDialogData } from './unsaved-changes-dialog.model';
|
||||
@@ -30,7 +30,6 @@ describe('UnsavedChangesDialog', () => {
|
||||
|
||||
const setupBeforeEach = (unsavedChangesDialogData?: UnsavedChangesDialogData) => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
providers: [
|
||||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
|
@@ -19,7 +19,6 @@ import { DebugElement, SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { Chip } from './chip';
|
||||
import { DynamicChipListComponent } from './dynamic-chip-list.component';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { UnitTestingUtils } from '../testing/unit-testing-utils';
|
||||
|
||||
describe('DynamicChipListComponent', () => {
|
||||
@@ -65,9 +64,6 @@ describe('DynamicChipListComponent', () => {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
const resizeObserverSpy = spyOn(window, 'ResizeObserver').and.callThrough();
|
||||
fixture = TestBed.createComponent(DynamicChipListComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { UnitTestingUtils } from '../../../testing';
|
||||
import { FormRenderingService } from '../../services/form-rendering.service';
|
||||
import { CheckboxWidgetComponent, FormFieldModel, FormFieldTypes, FormModel, TextWidgetComponent } from '../widgets';
|
||||
import { FormFieldComponent } from './form-field.component';
|
||||
@@ -31,7 +31,7 @@ describe('FormFieldComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [FormFieldComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(FormFieldComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../testing';
|
||||
import { UnitTestingUtils } from '../../testing';
|
||||
import { FormRulesManager } from '../models/form-rules.model';
|
||||
import { FormRenderingService } from '../services/form-rendering.service';
|
||||
import { FormService } from '../services/form.service';
|
||||
@@ -90,7 +90,7 @@ describe('Form Renderer Component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [FormRendererComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(FormRendererComponent);
|
||||
formRendererComponent = fixture.componentInstance;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { UnitTestingUtils } from '../../../testing';
|
||||
import { FormFieldModel, FormModel } from '../widgets';
|
||||
import { FormSectionComponent } from './form-section.component';
|
||||
import { mockSectionWithFields } from '../mock/form-renderer.component.mock';
|
||||
@@ -28,7 +28,7 @@ describe('FormSectionComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [FormSectionComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(FormSectionComponent);
|
||||
testingUtils = new UnitTestingUtils(fixture.debugElement);
|
||||
|
@@ -17,8 +17,8 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { UntypedFormControl } from '@angular/forms';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { InplaceFormInputComponent } from './inplace-form-input.component';
|
||||
import { UnitTestingUtils } from '../../../testing/unit-testing-utils';
|
||||
|
||||
describe('InplaceFormInputComponent', () => {
|
||||
let component: InplaceFormInputComponent;
|
||||
@@ -26,13 +26,10 @@ describe('InplaceFormInputComponent', () => {
|
||||
let formControl: UntypedFormControl;
|
||||
let testingUtils: UnitTestingUtils;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, InplaceFormInputComponent]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [InplaceFormInputComponent]
|
||||
});
|
||||
formControl = new UntypedFormControl('');
|
||||
fixture = TestBed.createComponent(InplaceFormInputComponent);
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { AmountWidgetComponent, ADF_AMOUNT_SETTINGS } from './amount.widget';
|
||||
import { FormBaseModule } from '../../../form-base.module';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
@@ -33,7 +32,7 @@ describe('AmountWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [FormBaseModule]
|
||||
imports: [AmountWidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(AmountWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
@@ -131,7 +130,7 @@ describe('AmountWidgetComponent - rendering', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [FormBaseModule]
|
||||
imports: [AmountWidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(AmountWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
@@ -336,7 +335,7 @@ describe('AmountWidgetComponent settings', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [FormBaseModule],
|
||||
imports: [AmountWidgetComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: ADF_AMOUNT_SETTINGS,
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '../../../../testing';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { FormFieldModel, FormModel } from '../core';
|
||||
import { BaseViewerWidgetComponent } from './base-viewer.widget';
|
||||
@@ -44,7 +43,7 @@ describe('BaseViewerWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, BaseViewerWidgetComponent],
|
||||
imports: [BaseViewerWidgetComponent],
|
||||
providers: [{ provide: FormService, useValue: formServiceStub }]
|
||||
});
|
||||
|
||||
|
@@ -19,9 +19,7 @@ import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatCheckboxModule } from '@angular/material/checkbox';
|
||||
import { TranslateLoader } from '@ngx-translate/core';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../../testing';
|
||||
import { TranslateLoaderService } from '../../../../translation';
|
||||
import { UnitTestingUtils } from '../../../../testing';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from '../core';
|
||||
import { CheckboxWidgetComponent } from './checkbox.widget';
|
||||
|
||||
@@ -33,8 +31,7 @@ describe('CheckboxWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, MatCheckboxModule],
|
||||
providers: [{ provide: TranslateLoader, useClass: TranslateLoaderService }]
|
||||
imports: [MatCheckboxModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(CheckboxWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
@@ -25,16 +25,11 @@ import { FormOutcomeModel } from './form-outcome.model';
|
||||
import { FormModel } from './form.model';
|
||||
import { TabModel } from './tab.model';
|
||||
import { fakeMetadataForm, mockDisplayExternalPropertyForm, mockFormWithSections, fakeValidatorMock } from '../../mock/form.mock';
|
||||
import { CoreTestingModule } from '../../../../testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
describe('FormModel', () => {
|
||||
let formService: FormService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
formService = new FormService();
|
||||
});
|
||||
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DateAdapter } from '@angular/material/core';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../../testing';
|
||||
import { UnitTestingUtils } from '../../../../testing';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from '../core';
|
||||
import { DateWidgetComponent } from './date.widget';
|
||||
import { DEFAULT_DATE_FORMAT } from '../../../../common';
|
||||
@@ -32,7 +32,7 @@ describe('DateWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [DateWidgetComponent]
|
||||
});
|
||||
|
||||
form = new FormModel();
|
||||
|
@@ -19,7 +19,7 @@ import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../../testing';
|
||||
import { UnitTestingUtils } from '../../../../testing';
|
||||
import { FormService } from '../../../services/form.service';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from '../core';
|
||||
import { DecimalWidgetComponent } from './decimal.component';
|
||||
@@ -30,11 +30,11 @@ describe('DecimalComponent', () => {
|
||||
let fixture: ComponentFixture<DecimalWidgetComponent>;
|
||||
let testingUtils: UnitTestingUtils;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, MatInputModule, DecimalWidgetComponent],
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MatInputModule, DecimalWidgetComponent],
|
||||
providers: [FormService]
|
||||
}).compileComponents();
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(DecimalWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { SimpleChange, SimpleChanges } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../../testing';
|
||||
import { UnitTestingUtils } from '../../../../testing';
|
||||
import { ErrorMessageModel } from '../core';
|
||||
import { ErrorWidgetComponent } from './error.component';
|
||||
|
||||
@@ -28,7 +28,7 @@ describe('ErrorWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [ErrorWidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(ErrorWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../../testing';
|
||||
import { UnitTestingUtils } from '../../../../testing';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from '../core';
|
||||
import { HyperlinkWidgetComponent } from './hyperlink.widget';
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('HyperlinkWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [HyperlinkWidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(HyperlinkWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
@@ -20,7 +20,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatInputModule } from '@angular/material/input';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../../testing';
|
||||
import { UnitTestingUtils } from '../../../../testing';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel } from '../core';
|
||||
import { NumberWidgetComponent } from './number.widget';
|
||||
import { DecimalNumberPipe } from '../../../../pipes';
|
||||
@@ -36,7 +36,7 @@ describe('NumberWidgetComponent', () => {
|
||||
mockDecimalNumberPipe = jasmine.createSpyObj('DecimalNumberPipe', ['transform']);
|
||||
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, MatInputModule, MatIconModule]
|
||||
imports: [MatInputModule, MatIconModule]
|
||||
})
|
||||
.overrideComponent(NumberWidgetComponent, {
|
||||
set: {
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { filter } from 'rxjs/operators';
|
||||
import { CoreTestingModule } from '../../../testing';
|
||||
import { FormRulesEvent } from '../../events';
|
||||
import { FormFieldModel, FormModel } from './core';
|
||||
import { WidgetComponent } from './widget.component';
|
||||
@@ -29,7 +28,7 @@ describe('WidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [WidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(WidgetComponent);
|
||||
|
||||
|
@@ -20,10 +20,9 @@ import { StartFormCustomButtonDirective } from './components/form-custom-button.
|
||||
import { FormFieldComponent } from './components/form-field/form-field.component';
|
||||
import { FormRendererComponent } from './components/form-renderer.component';
|
||||
import { InplaceFormInputComponent } from './components/inplace-form-input/inplace-form-input.component';
|
||||
import { DecimalRenderMiddlewareService } from './components/middlewares/decimal-middleware.service';
|
||||
import { FORM_FIELD_MODEL_RENDER_MIDDLEWARE } from './components/middlewares/middleware';
|
||||
import { MASK_DIRECTIVE, WIDGET_DIRECTIVES, WidgetComponent } from './components/widgets';
|
||||
|
||||
/** @deprecated This module is deprecated and will be removed in a future release. Use standalone components instead. */
|
||||
@NgModule({
|
||||
imports: [
|
||||
FormFieldComponent,
|
||||
@@ -34,7 +33,6 @@ import { MASK_DIRECTIVE, WIDGET_DIRECTIVES, WidgetComponent } from './components
|
||||
...WIDGET_DIRECTIVES,
|
||||
...MASK_DIRECTIVE
|
||||
],
|
||||
declarations: [],
|
||||
exports: [
|
||||
FormFieldComponent,
|
||||
FormRendererComponent,
|
||||
@@ -42,13 +40,6 @@ import { MASK_DIRECTIVE, WIDGET_DIRECTIVES, WidgetComponent } from './components
|
||||
...WIDGET_DIRECTIVES,
|
||||
InplaceFormInputComponent,
|
||||
WidgetComponent
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE,
|
||||
useClass: DecimalRenderMiddlewareService,
|
||||
multi: true
|
||||
}
|
||||
]
|
||||
})
|
||||
export class FormBaseModule {}
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { Injector } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { getTestScheduler } from 'jasmine-marbles';
|
||||
import { CoreTestingModule } from '../../testing';
|
||||
import { FormModel } from '../components/widgets';
|
||||
import { FormEvent, FormRulesEvent } from '../events';
|
||||
import { FormService } from '../services/form.service';
|
||||
@@ -42,7 +41,6 @@ describe('Form Rules', () => {
|
||||
describe('Injection token provided', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
providers: [
|
||||
{
|
||||
provide: FORM_RULES_MANAGER,
|
||||
@@ -106,9 +104,6 @@ describe('Form Rules', () => {
|
||||
let getRulesSpy: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
injector = TestBed.inject(Injector);
|
||||
rulesManager = formRulesManagerFactory<any>(injector);
|
||||
getRulesSpy = spyOn<any>(rulesManager, 'getRules');
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { formModelTabs } from '../../mock';
|
||||
import { FORM_SERVICE_FIELD_VALIDATORS_TOKEN, FormService } from './form.service';
|
||||
import { CoreTestingModule } from '../../testing';
|
||||
import { FORM_FIELD_VALIDATORS, FormFieldValidator } from '../public-api';
|
||||
|
||||
const fakeValidator = {
|
||||
@@ -32,7 +31,7 @@ describe('Form service', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [],
|
||||
providers: [{ provide: FORM_SERVICE_FIELD_VALIDATORS_TOKEN, useValue: [fakeValidator] }]
|
||||
});
|
||||
service = TestBed.inject(FormService);
|
||||
|
@@ -28,7 +28,6 @@ import {
|
||||
complexVisibilityJsonNotVisible,
|
||||
headerVisibilityCond
|
||||
} from '../../mock/form/widget-visibility-cloud.service.mock';
|
||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -39,9 +38,6 @@ describe('WidgetVisibilityCloudService', () => {
|
||||
const stubFormWithFields = new FormModel(fakeFormJson);
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
service = TestBed.inject(WidgetVisibilityService);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
@@ -30,7 +30,6 @@ import {
|
||||
fakeFormChainedVisibilityJson,
|
||||
fakeFormCheckBoxVisibilityJson
|
||||
} from '../../mock/form/widget-visibility.service.mock';
|
||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
||||
|
||||
describe('WidgetVisibilityService', () => {
|
||||
let service: WidgetVisibilityService;
|
||||
@@ -48,9 +47,6 @@ describe('WidgetVisibilityService', () => {
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
service = TestBed.inject(WidgetVisibilityService);
|
||||
});
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { IdentityUserInfoComponent } from './identity-user-info.component';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { IdentityUserModel } from '../auth/models/identity-user.model';
|
||||
import { UnitTestingUtils } from '../testing/unit-testing-utils';
|
||||
@@ -51,7 +50,7 @@ describe('IdentityUserInfoComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, MatMenuModule, IdentityUserInfoComponent]
|
||||
imports: [MatMenuModule, IdentityUserInfoComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(IdentityUserInfoComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { LanguageMenuComponent } from './language-menu.component';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { LanguageService } from './service/language.service';
|
||||
|
||||
@@ -47,7 +46,7 @@ describe('LanguageMenuComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, LanguageMenuComponent]
|
||||
imports: [LanguageMenuComponent]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(LanguageMenuComponent);
|
||||
|
@@ -20,17 +20,17 @@ import { LanguagePickerComponent } from './language-picker.component';
|
||||
import { MatMenuItem, MatMenuTrigger } from '@angular/material/menu';
|
||||
import { LanguageMenuComponent } from './language-menu.component';
|
||||
import { QueryList } from '@angular/core';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '@alfresco/adf-core';
|
||||
import { UnitTestingUtils } from '@alfresco/adf-core';
|
||||
|
||||
describe('LanguagePickerComponent', () => {
|
||||
let component: LanguagePickerComponent;
|
||||
let fixture: ComponentFixture<LanguagePickerComponent>;
|
||||
let testingUtils: UnitTestingUtils;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, LanguagePickerComponent]
|
||||
}).compileComponents();
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [LanguagePickerComponent]
|
||||
});
|
||||
|
||||
fixture = TestBed.createComponent(LanguagePickerComponent);
|
||||
testingUtils = new UnitTestingUtils(fixture.debugElement);
|
||||
|
@@ -17,11 +17,11 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { HeaderLayoutComponent } from './header.component';
|
||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||
import { Component } from '@angular/core';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { UnitTestingUtils } from '../../../testing/unit-testing-utils';
|
||||
import { provideRouter } from '@angular/router';
|
||||
|
||||
describe('HeaderLayoutComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@@ -32,7 +32,8 @@ describe('HeaderLayoutComponent', () => {
|
||||
describe('Input parameters', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, HeaderLayoutComponent]
|
||||
imports: [HeaderLayoutComponent],
|
||||
providers: [provideRouter([])]
|
||||
});
|
||||
fixture = TestBed.createComponent(HeaderLayoutComponent);
|
||||
loader = TestbedHarnessEnvironment.loader(fixture);
|
||||
@@ -248,7 +249,8 @@ describe('HeaderLayoutComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, HeaderLayoutTesterComponent]
|
||||
imports: [HeaderLayoutTesterComponent],
|
||||
providers: [provideRouter([])]
|
||||
});
|
||||
});
|
||||
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { Component } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SidebarActionMenuComponent } from './sidebar-action-menu.component';
|
||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
@@ -31,7 +30,7 @@ describe('SidebarActionMenuComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, SidebarActionMenuComponent]
|
||||
imports: [SidebarActionMenuComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(SidebarActionMenuComponent);
|
||||
component = fixture.componentInstance;
|
||||
@@ -86,7 +85,7 @@ describe('Custom SidebarActionMenuComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, SidebarActionMenuComponent, CustomSidebarActionMenuComponent]
|
||||
imports: [SidebarActionMenuComponent, CustomSidebarActionMenuComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(CustomSidebarActionMenuComponent);
|
||||
fixture.detectChanges();
|
||||
|
@@ -21,7 +21,7 @@ import { OidcAuthenticationService } from '../../../auth/oidc/oidc-authenticatio
|
||||
import { UnitTestingUtils } from '../../../testing/unit-testing-utils';
|
||||
import { LoginDialogPanelComponent } from './login-dialog-panel.component';
|
||||
import { BasicAlfrescoAuthService } from '../../../auth/basic-auth/basic-alfresco-auth.service';
|
||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||
import { NoopAuthModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('LoginDialogPanelComponent', () => {
|
||||
let component: LoginDialogPanelComponent;
|
||||
@@ -33,7 +33,7 @@ describe('LoginDialogPanelComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [NoopAuthModule, LoginDialogPanelComponent],
|
||||
providers: [{ provide: OidcAuthenticationService, useValue: {} }]
|
||||
});
|
||||
fixture = TestBed.createComponent(LoginDialogPanelComponent);
|
||||
|
@@ -26,9 +26,12 @@ import { UserPreferencesService } from '../../../common/services/user-preference
|
||||
import { AppConfigService } from '../../../app-config/app-config.service';
|
||||
import { BasicAlfrescoAuthService } from '../../../auth/basic-auth/basic-alfresco-auth.service';
|
||||
import { UnitTestingUtils } from '../../../testing/unit-testing-utils';
|
||||
import { CoreTestingModule } from '../../../testing/core.testing.module';
|
||||
import { LoginSuccessEvent } from '../../models/login-success.event';
|
||||
import { LoginErrorEvent } from '../../models/login-error.event';
|
||||
import { provideHttpClientTesting } from '@angular/common/http/testing';
|
||||
import { NoopAuthModule } from '../../../testing/noop-auth.module';
|
||||
import { TranslationService } from '../../../translation/translation.service';
|
||||
import { NoopTranslationService } from '../../../testing/noop-translate.module';
|
||||
|
||||
describe('LoginComponent', () => {
|
||||
let component: LoginComponent;
|
||||
@@ -58,8 +61,10 @@ describe('LoginComponent', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [NoopAuthModule, LoginComponent],
|
||||
providers: [
|
||||
provideHttpClientTesting(),
|
||||
{ provide: TranslationService, useClass: NoopTranslationService },
|
||||
{
|
||||
provide: OidcAuthenticationService,
|
||||
useValue: {
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CoreTestingModule, LoginComponent, LoginFooterDirective } from '@alfresco/adf-core';
|
||||
import { LoginComponent, LoginFooterDirective, NoopAuthModule } from '@alfresco/adf-core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { OidcAuthenticationService } from '../../auth/oidc/oidc-authentication.service';
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('LoginFooterDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [NoopAuthModule, LoginComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: OidcAuthenticationService,
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CoreTestingModule, LoginComponent, LoginHeaderDirective } from '@alfresco/adf-core';
|
||||
import { LoginComponent, LoginHeaderDirective, NoopAuthModule } from '@alfresco/adf-core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { OidcAuthenticationService } from '../../auth/oidc/oidc-authentication.service';
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('LoginHeaderDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [NoopAuthModule, LoginComponent],
|
||||
providers: [{ provide: OidcAuthenticationService, useValue: {} }]
|
||||
});
|
||||
fixture = TestBed.createComponent(LoginComponent);
|
||||
|
@@ -20,7 +20,6 @@ import { PaginationModel } from '../models/pagination.model';
|
||||
import { InfinitePaginationComponent } from './infinite-pagination.component';
|
||||
import { PaginatedComponent } from './paginated-component.interface';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { Component, ChangeDetectorRef } from '@angular/core';
|
||||
import { RequestPaginationModel } from '../models/request-pagination.model';
|
||||
import { UnitTestingUtils } from '../testing/unit-testing-utils';
|
||||
@@ -59,7 +58,7 @@ describe('InfinitePaginationComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, TestPaginatedComponent]
|
||||
imports: [TestPaginatedComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(InfinitePaginationComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { of } from 'rxjs';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { DecimalNumberPipe } from './decimal-number.pipe';
|
||||
import { Injector, runInInjectionContext } from '@angular/core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
@@ -28,9 +27,6 @@ describe('DecimalNumberPipe', () => {
|
||||
let userPreferences: UserPreferencesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
userPreferences = TestBed.inject(UserPreferencesService);
|
||||
const injector = TestBed.inject(Injector);
|
||||
spyOn(userPreferences, 'select').and.returnValue(of(''));
|
||||
|
@@ -20,7 +20,6 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { of } from 'rxjs';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import localeFr from '@angular/common/locales/fr';
|
||||
registerLocaleData(localeFr);
|
||||
@@ -30,9 +29,6 @@ describe('LocalizedDatePipe', () => {
|
||||
let userPreferences: UserPreferencesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
userPreferences = TestBed.inject(UserPreferencesService);
|
||||
spyOn(userPreferences, 'select').and.returnValue(of(''));
|
||||
pipe = new LocalizedDatePipe(userPreferences, TestBed.inject(AppConfigService));
|
||||
|
@@ -17,14 +17,13 @@
|
||||
|
||||
import { MultiValuePipe } from './multi-value.pipe';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
|
||||
describe('MultiValuePipe', () => {
|
||||
let pipe: MultiValuePipe;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, MultiValuePipe],
|
||||
imports: [MultiValuePipe],
|
||||
providers: [MultiValuePipe]
|
||||
});
|
||||
pipe = TestBed.inject(MultiValuePipe);
|
||||
|
@@ -19,7 +19,6 @@ import { TimeAgoPipe } from './time-ago.pipe';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { UserPreferencesService } from '../common/services/user-preferences.service';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { of } from 'rxjs';
|
||||
import { Injector, runInInjectionContext } from '@angular/core';
|
||||
|
||||
@@ -28,9 +27,6 @@ describe('TimeAgoPipe', () => {
|
||||
let userPreferences: UserPreferencesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
userPreferences = TestBed.inject(UserPreferencesService);
|
||||
const injector = TestBed.inject(Injector);
|
||||
spyOn(userPreferences, 'select').and.returnValue(of(''));
|
||||
|
@@ -17,16 +17,12 @@
|
||||
|
||||
import { TruncatePipe } from './truncate.pipe';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { Injector, runInInjectionContext } from '@angular/core';
|
||||
|
||||
describe('TruncatePipe', () => {
|
||||
let pipe: TruncatePipe;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
const injector = TestBed.inject(Injector);
|
||||
runInInjectionContext(injector, () => {
|
||||
pipe = new TruncatePipe();
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed, discardPeriodicTasks, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
import { SearchTextInputComponent } from './search-text-input.component';
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { Subject } from 'rxjs';
|
||||
@@ -32,7 +31,7 @@ describe('SearchTextInputComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [SearchTextInputComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(SearchTextInputComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -20,7 +20,6 @@ import { MatIcon } from '@angular/material/icon';
|
||||
import { MAT_SNACK_BAR_DATA, MatSnackBarRef } from '@angular/material/snack-bar';
|
||||
import { SnackbarContentComponent } from './snackbar-content.component';
|
||||
import { UnitTestingUtils } from '../testing/unit-testing-utils';
|
||||
import { CoreTestingModule } from '../testing/core.testing.module';
|
||||
|
||||
describe('SnackbarContentComponent', () => {
|
||||
let component: SnackbarContentComponent;
|
||||
@@ -29,7 +28,7 @@ describe('SnackbarContentComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, SnackbarContentComponent],
|
||||
imports: [SnackbarContentComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: MatSnackBarRef,
|
||||
|
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '../../testing/core.testing.module';
|
||||
import { ErrorContentComponent } from './error-content.component';
|
||||
import { TranslationService } from '../../translation/translation.service';
|
||||
import { ActivatedRoute } from '@angular/router';
|
||||
@@ -31,7 +30,7 @@ describe('ErrorContentComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [ErrorContentComponent],
|
||||
providers: [{ provide: ActivatedRoute, useValue: { params: of() } }]
|
||||
});
|
||||
fixture = TestBed.createComponent(ErrorContentComponent);
|
||||
|
@@ -21,6 +21,7 @@ import { CoreModule } from '../core.module';
|
||||
import { NoopTranslateModule } from './noop-translate.module';
|
||||
import { NoopAuthModule } from './noop-auth.module';
|
||||
|
||||
/** @deprecated this module is deprecated and will be removed in the future */
|
||||
@NgModule({
|
||||
imports: [NoopAnimationsModule, CoreModule.forRoot(), NoopTranslateModule, NoopAuthModule]
|
||||
})
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { EventEmitter, Injectable, NgModule } from '@angular/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
||||
import { TranslationService } from '../translation/translation.service';
|
||||
import { LangChangeEvent } from '../mock';
|
||||
import { Observable, of } from 'rxjs';
|
||||
@@ -47,8 +47,15 @@ export class NoopTranslationService implements TranslationService {
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [HttpClientTestingModule, TranslateModule.forRoot()],
|
||||
providers: [{ provide: TranslationService, useClass: NoopTranslationService }],
|
||||
exports: [TranslateModule]
|
||||
imports: [HttpClientTestingModule],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: NoopTranslationService },
|
||||
provideTranslateService({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: NoopTranslationService
|
||||
}
|
||||
})
|
||||
]
|
||||
})
|
||||
export class NoopTranslateModule {}
|
||||
|
@@ -29,7 +29,12 @@ import { map, catchError, retry } from 'rxjs/operators';
|
||||
export class TranslateLoaderService implements TranslateLoader {
|
||||
private prefix: string = 'i18n';
|
||||
private suffix: string = '.json';
|
||||
private providers: ComponentTranslationModel[] = [];
|
||||
private providers: ComponentTranslationModel[] = [
|
||||
new ComponentTranslationModel({
|
||||
name: 'adf-core',
|
||||
path: 'assets/adf-core'
|
||||
})
|
||||
];
|
||||
private queue: string[][] = [];
|
||||
private defaultLang: string = 'en';
|
||||
|
||||
|
@@ -18,11 +18,8 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateLoaderService } from './translate-loader.service';
|
||||
import { TranslationService } from './translation.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreModule } from '../core.module';
|
||||
import { AuthModule } from '../auth/oidc/auth.module';
|
||||
|
||||
declare let jasmine: any;
|
||||
import { provideTranslateService, TranslateLoader } from '@ngx-translate/core';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
|
||||
describe('TranslateLoader', () => {
|
||||
let translationService: TranslationService;
|
||||
@@ -30,17 +27,20 @@ describe('TranslateLoader', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AuthModule.forRoot({ useHash: true }), TranslateModule.forRoot(), CoreModule.forRoot()],
|
||||
providers: [TranslationService]
|
||||
providers: [
|
||||
provideTranslateService({
|
||||
loader: {
|
||||
provide: TranslateLoader,
|
||||
useClass: TranslateLoaderService,
|
||||
deps: [HttpClient]
|
||||
},
|
||||
defaultLanguage: 'en'
|
||||
}),
|
||||
TranslationService
|
||||
]
|
||||
});
|
||||
translationService = TestBed.inject(TranslationService);
|
||||
customLoader = translationService.translate.currentLoader as TranslateLoaderService;
|
||||
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
it('should be able to provide any TranslateLoader', () => {
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatDialogRef } from '@angular/material/dialog';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { UnitTestingUtils } from '../../../testing';
|
||||
import { DownloadPromptActions } from '../../models/download-prompt.actions';
|
||||
import { DownloadPromptDialogComponent } from './download-prompt-dialog.component';
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('DownloadPromptDialogComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, DownloadPromptDialogComponent],
|
||||
imports: [DownloadPromptDialogComponent],
|
||||
providers: [{ provide: MatDialogRef, useValue: mockDialog }]
|
||||
});
|
||||
matDialogRef = TestBed.inject(MatDialogRef);
|
||||
|
@@ -19,7 +19,7 @@ import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { AppConfigService } from '../../../app-config';
|
||||
import { UrlService } from '../../../common';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { UnitTestingUtils } from '../../../testing';
|
||||
import { ImgViewerComponent } from './img-viewer.component';
|
||||
|
||||
describe('Test Img viewer component ', () => {
|
||||
@@ -33,12 +33,6 @@ describe('Test Img viewer component ', () => {
|
||||
return new Blob([data], { type: 'image/png' });
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
});
|
||||
});
|
||||
|
||||
describe('Zoom customization', () => {
|
||||
beforeEach(() => {
|
||||
urlService = TestBed.inject(UrlService);
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
|
||||
import { CoreTestingModule } from '../../../testing';
|
||||
import { PdfPasswordDialogComponent } from './pdf-viewer-password-dialog';
|
||||
|
||||
declare const pdfjsLib: any;
|
||||
@@ -29,7 +28,7 @@ describe('PdfPasswordDialogComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [PdfPasswordDialogComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
|
@@ -18,7 +18,6 @@
|
||||
import { DomSanitizer } from '@angular/platform-browser';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PdfThumbComponent } from './pdf-viewer-thumb.component';
|
||||
import { CoreTestingModule } from '../../../testing';
|
||||
|
||||
describe('PdfThumbComponent', () => {
|
||||
let fixture: ComponentFixture<PdfThumbComponent>;
|
||||
@@ -42,7 +41,7 @@ describe('PdfThumbComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [PdfThumbComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: DomSanitizer,
|
||||
|
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PdfThumbListComponent } from './pdf-viewer-thumbnails.component';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { UnitTestingUtils } from '../../../testing';
|
||||
import { DOWN_ARROW, ESCAPE, UP_ARROW } from '@angular/cdk/keycodes';
|
||||
|
||||
declare const pdfjsViewer: any;
|
||||
@@ -72,7 +72,7 @@ describe('PdfThumbListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [PdfThumbListComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(PdfThumbListComponent);
|
||||
testingUtils = new UnitTestingUtils(fixture.debugElement);
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { TxtViewerComponent } from './txt-viewer.component';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../../testing';
|
||||
import { UnitTestingUtils } from '../../../testing';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
@@ -29,7 +29,7 @@ describe('Text View component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule, TxtViewerComponent]
|
||||
imports: [TxtViewerComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TxtViewerComponent);
|
||||
testingUtils = new UnitTestingUtils(fixture.debugElement);
|
||||
|
@@ -17,7 +17,6 @@
|
||||
|
||||
import { UnknownFormatComponent } from './unknown-format.component';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('Unknown Format Component', () => {
|
||||
let fixture: ComponentFixture<UnknownFormatComponent>;
|
||||
@@ -26,7 +25,7 @@ describe('Unknown Format Component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [UnknownFormatComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(UnknownFormatComponent);
|
||||
fixture.detectChanges();
|
||||
|
@@ -17,13 +17,11 @@
|
||||
|
||||
import { Component, DebugElement, SimpleChanges } from '@angular/core';
|
||||
import { ComponentFixture, discardPeriodicTasks, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { of } from 'rxjs';
|
||||
import { AppConfigService } from '../../app-config';
|
||||
import { EventMock } from '../../mock';
|
||||
import { CoreTestingModule, UnitTestingUtils } from '../../testing';
|
||||
import { UnitTestingUtils } from '../../testing';
|
||||
import { DownloadPromptActions } from '../models/download-prompt.actions';
|
||||
import { CloseButtonPosition } from '../models/viewer.model';
|
||||
import { ViewUtilService } from '../services/view-util.service';
|
||||
@@ -58,9 +56,6 @@ describe('ViewerComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreTestingModule,
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
ViewerWithCustomToolbarComponent,
|
||||
ViewerWithCustomSidebarComponent,
|
||||
ViewerWithCustomOpenWithComponent,
|
||||
|
@@ -21,7 +21,6 @@ import { ChangeDetectorRef, ElementRef } from '@angular/core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ViewerRenderComponent } from '../components/viewer-render/viewer-render.component';
|
||||
import { ViewerExtensionDirective } from './viewer-extension.directive';
|
||||
import { CoreTestingModule } from '../../testing';
|
||||
|
||||
describe('ExtensionViewerDirective', () => {
|
||||
let extensionViewerDirective: ViewerExtensionDirective;
|
||||
@@ -35,7 +34,7 @@ describe('ExtensionViewerDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule],
|
||||
imports: [ViewerRenderComponent],
|
||||
providers: [
|
||||
{ provide: Location, useClass: SpyLocation },
|
||||
ViewerExtensionDirective,
|
||||
|
Reference in New Issue
Block a user