mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
ACS-8652: Noop Translation Module for better unit testing ergonomics (#10118)
This commit is contained in:
parent
f6e72f8a6f
commit
54ab9575d3
@ -26,6 +26,8 @@ import { ContentService } from '@alfresco/adf-content-services';
|
||||
import { ContentTestingModule } from 'lib/content-services/src/lib/testing/content.testing.module';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [FolderCreateDirective],
|
||||
template: ` <div [adf-create-folder]="parentNode" (success)="success($event)" title="create-title" [nodeType]="'cm:my-little-pony'"></div>`
|
||||
})
|
||||
class TestTypeComponent {
|
||||
@ -38,6 +40,8 @@ class TestTypeComponent {
|
||||
}
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [FolderCreateDirective],
|
||||
template: `<div [adf-create-folder]="parentNode"></div>`
|
||||
})
|
||||
class TestComponent {
|
||||
@ -56,8 +60,7 @@ describe('FolderCreateDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule],
|
||||
declarations: [TestTypeComponent, TestComponent]
|
||||
imports: [ContentTestingModule, TestTypeComponent, TestComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
element = fixture.debugElement.query(By.directive(FolderCreateDirective));
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AppConfigService, TranslationMock, TranslationService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import {
|
||||
CategoryBody,
|
||||
CategoryEntry,
|
||||
@ -30,8 +30,6 @@ import {
|
||||
} from '@alfresco/js-api';
|
||||
import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { CategoryService } from './category.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
describe('CategoryService', () => {
|
||||
let categoryService: CategoryService;
|
||||
@ -47,8 +45,7 @@ describe('CategoryService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule, TranslateModule.forRoot()],
|
||||
providers: [CategoryService, UserPreferencesService, { provide: TranslationService, useClass: TranslationMock }]
|
||||
imports: [NoopTranslateModule]
|
||||
});
|
||||
|
||||
categoryService = TestBed.inject(CategoryService);
|
||||
|
@ -21,14 +21,12 @@ import { Node } from '@alfresco/js-api';
|
||||
import { ContentMetadataCardComponent } from './content-metadata-card.component';
|
||||
import { ContentMetadataComponent } from '../content-metadata/content-metadata.component';
|
||||
import { APP_INITIALIZER, SimpleChange } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NodeAspectService } from '../../../aspect-list/services/node-aspect.service';
|
||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
||||
import { AllowableOperationsEnum } from '../../../common/models/allowable-operations.enum';
|
||||
import { of } from 'rxjs';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, AuthModule, TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, AuthModule, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { versionCompatibilityFactory } from '../../../version-compatibility/version-compatibility-factory';
|
||||
import { VersionCompatibilityService } from '../../../version-compatibility';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
@ -53,17 +51,15 @@ describe('ContentMetadataCardComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
NoopAnimationsModule,
|
||||
NoopTranslateModule,
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
HttpClientModule,
|
||||
MatDialogModule,
|
||||
MatSnackBarModule,
|
||||
ContentMetadataCardComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
useFactory: versionCompatibilityFactory,
|
||||
|
@ -26,14 +26,12 @@ import {
|
||||
AuthModule,
|
||||
CardViewBaseItemModel,
|
||||
CardViewComponent,
|
||||
NoopTranslateModule,
|
||||
NotificationService,
|
||||
TranslationMock,
|
||||
TranslationService,
|
||||
UpdateNotification
|
||||
} from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '../../../common/services/nodes-api.service';
|
||||
import { EMPTY, of, throwError } from 'rxjs';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CardViewContentUpdateService } from '../../../common/services/card-view-content-update.service';
|
||||
import { PropertyGroup } from '../../interfaces/property-group.interface';
|
||||
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
||||
@ -47,7 +45,6 @@ import {
|
||||
} from '@alfresco/adf-content-services';
|
||||
import { MatExpansionPanel } from '@angular/material/expansion';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
@ -184,16 +181,14 @@ describe('ContentMetadataComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
NoopAnimationsModule,
|
||||
NoopTranslateModule,
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
HttpClientModule,
|
||||
MatDialogModule,
|
||||
MatSnackBarModule,
|
||||
ContentMetadataComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{
|
||||
provide: TagService,
|
||||
useValue: {
|
||||
|
@ -21,12 +21,9 @@ import { Subject } from 'rxjs';
|
||||
import { Category } from '@alfresco/js-api';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AppConfigService, AppConfigServiceMock, TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { CategoriesManagementComponent } from '../../category';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { AppConfigService, AppConfigServiceMock, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('Category selector dialog component', () => {
|
||||
describe('CategorySelectorDialogComponent', () => {
|
||||
let fixture: ComponentFixture<CategorySelectorDialogComponent>;
|
||||
let component: CategorySelectorDialogComponent;
|
||||
let selectButton: HTMLButtonElement;
|
||||
@ -51,18 +48,11 @@ describe('Category selector dialog component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
MatDialogModule,
|
||||
HttpClientTestingModule,
|
||||
CategoriesManagementComponent,
|
||||
CategorySelectorDialogComponent
|
||||
],
|
||||
imports: [NoopTranslateModule, MatDialogModule, CategorySelectorDialogComponent],
|
||||
providers: [
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: options },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: options }
|
||||
]
|
||||
});
|
||||
dialogRef.close.calls.reset();
|
||||
|
@ -21,9 +21,7 @@ import { DownloadZipDialogComponent } from './download-zip.dialog';
|
||||
import { DownloadZipService } from './services/download-zip.service';
|
||||
import { DownloadEntry, FileDownloadStatus } from '@alfresco/js-api';
|
||||
import { EMPTY, Observable, of } from 'rxjs';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, RedirectAuthService, TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, NoopTranslateModule, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('DownloadZipDialogComponent', () => {
|
||||
@ -41,11 +39,10 @@ describe('DownloadZipDialogComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule, TranslateModule.forRoot(), MatDialogModule, NoopAnimationsModule],
|
||||
imports: [NoopTranslateModule, MatDialogModule, NoopAnimationsModule],
|
||||
providers: [
|
||||
DownloadZipService,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: dataMock },
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }
|
||||
|
@ -19,7 +19,7 @@ import { Component } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { AutoFocusDirective } from './auto-focus.directive';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@ -33,7 +33,7 @@ describe('AutoFocusDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), AutoFocusDirective, AutoFocusTestComponent]
|
||||
imports: [NoopTranslateModule, AutoFocusDirective, AutoFocusTestComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(AutoFocusTestComponent);
|
||||
});
|
||||
|
@ -19,7 +19,7 @@ import { Component } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { NodeCounterDirective, NodeCounterComponent } from './node-counter.directive';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
@ -35,7 +35,7 @@ describe('NodeCounterDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NodeCounterDirective, NodeCounterComponent, TestComponent]
|
||||
imports: [NoopTranslateModule, NodeCounterDirective, NodeCounterComponent, TestComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.detectChanges();
|
||||
|
@ -19,9 +19,7 @@ import { Component, DebugElement, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NodeDeleteDirective } from './node-delete.directive';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { RedirectAuthService, TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule, RedirectAuthService } from '@alfresco/adf-core';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { CheckAllowableOperationDirective } from './check-allowable-operation.directive';
|
||||
|
||||
@ -85,11 +83,8 @@ describe('NodeDeleteDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule, TranslateModule.forRoot(), TestComponent, TestWithPermissionsComponent, TestDeletePermanentComponent],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }
|
||||
]
|
||||
imports: [NoopTranslateModule, TestComponent, TestWithPermissionsComponent, TestDeletePermanentComponent],
|
||||
providers: [{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
fixtureWithPermissions = TestBed.createComponent(TestWithPermissionsComponent);
|
||||
|
@ -19,9 +19,7 @@ import { Component, DebugElement } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NodeRestoreDirective } from './node-restore.directive';
|
||||
import { TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopTranslateModule, TranslationService } from '@alfresco/adf-core';
|
||||
import { TrashcanApi } from '@alfresco/js-api';
|
||||
|
||||
@Component({
|
||||
@ -46,8 +44,7 @@ describe('NodeRestoreDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule, TranslateModule.forRoot(), TestComponent],
|
||||
providers: [{ provide: TranslationService, useClass: TranslationMock }]
|
||||
imports: [NoopTranslateModule, TestComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -20,11 +20,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FileAutoDownloadComponent } from './file-auto-download.component';
|
||||
import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/material/dialog';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { NodeDownloadDirective } from '../../../directives/node-download.directive';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
||||
const mockDialog = {
|
||||
close: jasmine.createSpy('close')
|
||||
@ -37,18 +35,10 @@ describe('FileAutoDownloadComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
TranslateModule.forRoot(),
|
||||
MatDialogModule,
|
||||
MatButtonModule,
|
||||
NodeDownloadDirective,
|
||||
FileAutoDownloadComponent
|
||||
],
|
||||
imports: [NoopTranslateModule, MatDialogModule, MatButtonModule, NodeDownloadDirective, FileAutoDownloadComponent],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: mockDialog },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: null },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
{ provide: MAT_DIALOG_DATA, useValue: null }
|
||||
]
|
||||
});
|
||||
|
||||
|
@ -21,8 +21,7 @@ import { fakeAuthorityClearanceApiResponse } from './mock/security-authorities.m
|
||||
import { fakeGroupsApiResponse, createNewSecurityGroupMock } from './mock/security-groups.mock';
|
||||
import { fakeMarksApiResponse, createNewSecurityMarkMock } from './mock/security-marks.mock';
|
||||
import { SecurityGroupBody, SecurityMarkBody, SecurityMarkEntry } from '@alfresco/js-api';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('SecurityControlsService', () => {
|
||||
let service: SecurityControlsService;
|
||||
@ -39,7 +38,7 @@ describe('SecurityControlsService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule]
|
||||
imports: [NoopTranslateModule]
|
||||
});
|
||||
|
||||
service = TestBed.inject(SecurityControlsService);
|
||||
|
@ -17,9 +17,8 @@
|
||||
|
||||
import { ComponentFixture, discardPeriodicTasks, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
||||
import { TagsCreatorComponent } from './tags-creator.component';
|
||||
import { NotificationService } from '@alfresco/adf-core';
|
||||
import { NoopTranslateModule, NotificationService } from '@alfresco/adf-core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatError } from '@angular/material/form-field';
|
||||
import { TagsCreatorMode, TagService } from '@alfresco/adf-content-services';
|
||||
import { EMPTY, of, throwError } from 'rxjs';
|
||||
@ -39,7 +38,7 @@ describe('TagsCreatorComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule, TranslateModule.forRoot(), TagsCreatorComponent],
|
||||
imports: [NoopAnimationsModule, NoopTranslateModule, TagsCreatorComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: TagService,
|
||||
|
@ -22,16 +22,14 @@ import {
|
||||
CoreModule,
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
TranslationService,
|
||||
CookieService,
|
||||
AlfrescoApiServiceMock,
|
||||
AppConfigServiceMock,
|
||||
TranslationMock,
|
||||
CookieServiceMock,
|
||||
AuthModule
|
||||
AuthModule,
|
||||
NoopTranslateModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentModule } from '../content.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { versionCompatibilityFactory } from '../version-compatibility/version-compatibility-factory';
|
||||
import { VersionCompatibilityService } from '../version-compatibility/version-compatibility.service';
|
||||
import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
@ -41,15 +39,14 @@ import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
NoopAnimationsModule,
|
||||
RouterTestingModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule,
|
||||
NoopTranslateModule,
|
||||
ContentModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
@ -58,6 +55,6 @@ import { MatIconTestingModule } from '@angular/material/icon/testing';
|
||||
multi: true
|
||||
}
|
||||
],
|
||||
exports: [NoopAnimationsModule, TranslateModule, CoreModule, ContentModule]
|
||||
exports: [NoopAnimationsModule, CoreModule, ContentModule]
|
||||
})
|
||||
export class ContentTestingModule {}
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
import { TreeComponent } from './tree.component';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ContextMenuDirective, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ContextMenuDirective, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { TreeNode, TreeNodeType } from '../models/tree-node.interface';
|
||||
import { singleNode, treeNodesChildrenMockExpanded, treeNodesMock, treeNodesMockExpanded, treeNodesNoChildrenMock } from '../mock/tree-node.mock';
|
||||
import { of, Subject } from 'rxjs';
|
||||
@ -30,8 +30,6 @@ import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
|
||||
import { MatCheckboxHarness } from '@angular/material/checkbox/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
describe('TreeComponent', () => {
|
||||
@ -64,7 +62,7 @@ describe('TreeComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule, HttpClientTestingModule, TranslateModule.forRoot(), TreeComponent],
|
||||
imports: [NoopAnimationsModule, NoopTranslateModule, TreeComponent],
|
||||
providers: [UserPreferencesService, { provide: TreeService, useClass: TreeServiceMock }]
|
||||
});
|
||||
|
||||
|
@ -15,15 +15,14 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TranslationMock } from '@alfresco/adf-core';
|
||||
import { NoopTranslationService } from '@alfresco/adf-core';
|
||||
import { FileUploadErrorPipe } from './file-upload-error.pipe';
|
||||
|
||||
describe('FileUploadErrorPipe', () => {
|
||||
|
||||
let pipe: FileUploadErrorPipe;
|
||||
|
||||
beforeEach(() => {
|
||||
pipe = new FileUploadErrorPipe(new TranslationMock());
|
||||
pipe = new FileUploadErrorPipe(new NoopTranslationService());
|
||||
});
|
||||
|
||||
it('should return generic message when error code is null', () => {
|
||||
|
@ -20,8 +20,6 @@ import { SpyLocation } from '@angular/common/testing';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { AppExtensionService, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { ContentInfo, Node, NodeEntry, VersionEntry } from '@alfresco/js-api';
|
||||
import { AlfrescoViewerComponent, ContentService, NodeActionsService, RenditionService } from '@alfresco/adf-content-services';
|
||||
import {
|
||||
@ -30,12 +28,11 @@ import {
|
||||
AuthModule,
|
||||
CloseButtonPosition,
|
||||
EventMock,
|
||||
TranslationMock,
|
||||
TranslationService,
|
||||
ViewUtilService,
|
||||
ViewerComponent,
|
||||
VIEWER_DIRECTIVES,
|
||||
ViewerSidebarComponent
|
||||
ViewerSidebarComponent,
|
||||
NoopTranslateModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { NodesApiService } from '../../common/services/nodes-api.service';
|
||||
import { UploadService } from '../../common/services/upload.service';
|
||||
@ -44,8 +41,6 @@ import { throwError } from 'rxjs';
|
||||
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ESCAPE } from '@angular/cdk/keycodes';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-viewer-container-toolbar',
|
||||
@ -100,7 +95,7 @@ class DummyDialogComponent {}
|
||||
<mat-icon>dialpad</mat-icon>
|
||||
<span>Option 1</span>
|
||||
</button>
|
||||
<button mat-menu-item disabled>
|
||||
<button mat-menu-item [disabled]="true">
|
||||
<mat-icon>voicemail</mat-icon>
|
||||
<span>Option 2</span>
|
||||
</button>
|
||||
@ -123,7 +118,7 @@ class ViewerWithCustomOpenWithComponent {}
|
||||
<mat-icon>dialpad</mat-icon>
|
||||
<span>Action One</span>
|
||||
</button>
|
||||
<button mat-menu-item disabled>
|
||||
<button mat-menu-item [disabled]="true">
|
||||
<mat-icon>voicemail</mat-icon>
|
||||
<span>Action Two</span>
|
||||
</button>
|
||||
@ -152,15 +147,7 @@ describe('AlfrescoViewerComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
TranslateModule.forRoot(),
|
||||
MatButtonModule,
|
||||
MatIconModule,
|
||||
MatDialogModule,
|
||||
HttpClientTestingModule,
|
||||
...VIEWER_DIRECTIVES
|
||||
],
|
||||
imports: [AuthModule.forRoot({ useHash: true }), MatDialogModule, NoopTranslateModule, ...VIEWER_DIRECTIVES],
|
||||
declarations: [
|
||||
ViewerWithCustomToolbarComponent,
|
||||
ViewerWithCustomSidebarComponent,
|
||||
@ -171,7 +158,6 @@ describe('AlfrescoViewerComponent', () => {
|
||||
providers: [
|
||||
ContentService,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{
|
||||
provide: RenditionService,
|
||||
useValue: {
|
||||
|
@ -17,13 +17,12 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FlagsComponent } from './flags.component';
|
||||
import { FeaturesDirective } from '../../directives/features.directive';
|
||||
import { WritableFeaturesServiceToken } from '../../interfaces/features.interface';
|
||||
import { provideMockFeatureFlags } from '../../mocks/features-service-mock.factory';
|
||||
import { StorageFeaturesService } from '../../services/storage-features.service';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('FlagsComponent', () => {
|
||||
let component: FlagsComponent;
|
||||
@ -31,7 +30,7 @@ describe('FlagsComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [FlagsComponent, TranslateModule.forRoot(), FeaturesDirective, NoopAnimationsModule],
|
||||
imports: [FlagsComponent, NoopTranslateModule, FeaturesDirective, NoopAnimationsModule],
|
||||
providers: [
|
||||
{ provide: WritableFeaturesServiceToken, useClass: StorageFeaturesService },
|
||||
provideMockFeatureFlags({
|
||||
|
@ -18,9 +18,8 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AboutServerSettingsComponent } from './about-server-settings.component';
|
||||
import { AppConfigService } from '../../app-config/app-config.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { AppConfigServiceMock } from '../../common';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
const aboutGithubDetails = {
|
||||
url: 'https://github.com/componany/repository/commits/',
|
||||
@ -38,7 +37,7 @@ describe('AboutServerSettingsComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [{ provide: AppConfigService, useClass: AppConfigServiceMock }]
|
||||
});
|
||||
fixture = TestBed.createComponent(AboutServerSettingsComponent);
|
||||
|
@ -21,12 +21,11 @@ import { AuthGuardBpm } from './auth-guard-bpm.service';
|
||||
import { AuthenticationService } from '../services/authentication.service';
|
||||
import { RouterStateSnapshot, Router } from '@angular/router';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('AuthGuardService BPM', () => {
|
||||
let authGuard: AuthGuardBpm;
|
||||
@ -39,7 +38,7 @@ describe('AuthGuardService BPM', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule],
|
||||
imports: [NoopTranslateModule, MatDialogModule],
|
||||
providers: [
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } },
|
||||
{
|
||||
|
@ -21,13 +21,12 @@ import { AuthGuardEcm } from './auth-guard-ecm.service';
|
||||
import { AuthenticationService } from '../services/authentication.service';
|
||||
import { RouterStateSnapshot, Router } from '@angular/router';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('AuthGuardService ECM', () => {
|
||||
let authGuard: AuthGuardEcm;
|
||||
@ -39,7 +38,7 @@ describe('AuthGuardService ECM', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, RouterTestingModule, MatDialogModule],
|
||||
imports: [NoopTranslateModule, RouterTestingModule, MatDialogModule],
|
||||
providers: [
|
||||
BasicAlfrescoAuthService,
|
||||
AppConfigService,
|
||||
|
@ -20,8 +20,7 @@ import { ActivatedRouteSnapshot, Router } from '@angular/router';
|
||||
import { AuthGuardSsoRoleService } from './auth-guard-sso-role.service';
|
||||
import { JwtHelperService } from '../services/jwt-helper.service';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('Auth Guard SSO role service', () => {
|
||||
let authGuard: AuthGuardSsoRoleService;
|
||||
@ -30,7 +29,7 @@ describe('Auth Guard SSO role service', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule]
|
||||
imports: [NoopTranslateModule, MatDialogModule]
|
||||
});
|
||||
localStorage.clear();
|
||||
authGuard = TestBed.inject(AuthGuardSsoRoleService);
|
||||
|
@ -20,15 +20,14 @@ import { Router, RouterStateSnapshot } from '@angular/router';
|
||||
import { AppConfigService } from '../../app-config/app-config.service';
|
||||
import { AuthGuard } from './auth-guard.service';
|
||||
import { AuthenticationService } from '../services/authentication.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
import { OidcAuthenticationService } from '../oidc/oidc-authentication.service';
|
||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('AuthGuardService', () => {
|
||||
let state;
|
||||
@ -42,7 +41,7 @@ describe('AuthGuardService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatDialogModule, RouterTestingModule],
|
||||
imports: [NoopTranslateModule, MatDialogModule, RouterTestingModule],
|
||||
providers: [
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
|
@ -19,7 +19,6 @@ import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { AuthenticationService } from './authentication.service';
|
||||
import { CookieService } from '../../common/services/cookie.service';
|
||||
import { AppConfigService } from '../../app-config/app-config.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { BasicAlfrescoAuthService } from '../basic-auth/basic-alfresco-auth.service';
|
||||
import { AuthModule } from '../oidc/auth.module';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
@ -30,6 +29,7 @@ import { OAuthEvent } from 'angular-oauth2-oidc';
|
||||
import { Subject } from 'rxjs';
|
||||
import { RedirectAuthService } from '../oidc/redirect-auth.service';
|
||||
import { Injector } from '@angular/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
declare let jasmine: any;
|
||||
// eslint-disable-next-line
|
||||
@ -42,7 +42,7 @@ xdescribe('AuthenticationService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), AuthModule.forRoot({ useHash: true }), HttpClientModule],
|
||||
imports: [NoopTranslateModule, AuthModule.forRoot({ useHash: true }), HttpClientModule],
|
||||
providers: [
|
||||
{
|
||||
provide: CookieService,
|
||||
|
@ -27,9 +27,8 @@ import {
|
||||
mockIdentityGroups,
|
||||
roleMappingMock
|
||||
} from '../mock/identity-group.mock';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AdfHttpClient } from '../../../../api/src';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('IdentityGroupService', () => {
|
||||
let service: IdentityGroupService;
|
||||
@ -38,7 +37,7 @@ describe('IdentityGroupService', () => {
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [AdfHttpClient]
|
||||
});
|
||||
service = TestBed.inject(IdentityGroupService);
|
||||
|
@ -32,10 +32,9 @@ import { IdentityUserService } from './identity-user.service';
|
||||
import { JwtHelperService } from './jwt-helper.service';
|
||||
import { mockToken } from '../mock/jwt-helper.service.spec';
|
||||
import { IdentityRoleModel } from '../models/identity-role.model';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { AdfHttpClient } from '../../../../api/src';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('IdentityUserService', () => {
|
||||
const mockRoles = [
|
||||
@ -53,7 +52,7 @@ describe('IdentityUserService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [StorageService, AdfHttpClient]
|
||||
});
|
||||
storageService = TestBed.inject(StorageService);
|
||||
|
@ -21,7 +21,7 @@ import { MatCheckbox, MatCheckboxChange } from '@angular/material/checkbox';
|
||||
import { CardViewUpdateService } from '../../services/card-view-update.service';
|
||||
import { CardViewBoolItemComponent } from './card-view-boolitem.component';
|
||||
import { CardViewBoolItemModel } from '../../models/card-view-boolitem.model';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('CardViewBoolItemComponent', () => {
|
||||
let fixture: ComponentFixture<CardViewBoolItemComponent>;
|
||||
@ -29,7 +29,7 @@ describe('CardViewBoolItemComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()]
|
||||
imports: [NoopTranslateModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(CardViewBoolItemComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { SelectFilterInputComponent } from './select-filter-input.component';
|
||||
import { MatSelect, MatSelectModule } from '@angular/material/select';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('SelectFilterInputComponent', () => {
|
||||
let fixture: ComponentFixture<SelectFilterInputComponent>;
|
||||
@ -28,7 +28,7 @@ describe('SelectFilterInputComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule, TranslateModule.forRoot(), MatSelectModule],
|
||||
imports: [NoopAnimationsModule, NoopTranslateModule, MatSelectModule],
|
||||
providers: [MatSelect]
|
||||
});
|
||||
|
||||
|
@ -19,12 +19,8 @@ import { Component, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, tick, fakeAsync } from '@angular/core/testing';
|
||||
import { ClipboardService } from './clipboard.service';
|
||||
import { ClipboardDirective } from './clipboard.directive';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { TranslationService } from '../translation';
|
||||
import { TranslationMock } from '../mock';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-test-component',
|
||||
@ -42,8 +38,7 @@ describe('ClipboardDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatSnackBarModule, MatButtonModule, ClipboardDirective],
|
||||
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }],
|
||||
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective],
|
||||
declarations: [TestTargetClipboardComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestTargetClipboardComponent);
|
||||
@ -86,8 +81,7 @@ describe('CopyClipboardDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatSnackBarModule, ClipboardDirective],
|
||||
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }],
|
||||
imports: [NoopTranslateModule, MatSnackBarModule, ClipboardDirective],
|
||||
declarations: [TestCopyClipboardComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestCopyClipboardComponent);
|
||||
|
@ -19,20 +19,16 @@ import { NotificationService } from '../notifications/services/notification.serv
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ClipboardService } from './clipboard.service';
|
||||
import { MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslationService } from '../translation';
|
||||
import { TranslationMock } from '../mock';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('ClipboardService', () => {
|
||||
let clipboardService: ClipboardService;
|
||||
let notificationService: NotificationService;
|
||||
let inputElement;
|
||||
let inputElement: HTMLInputElement;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule, MatSnackBarModule],
|
||||
providers: [ClipboardService, { provide: TranslationService, useClass: TranslationMock }]
|
||||
imports: [NoopTranslateModule, MatSnackBarModule]
|
||||
});
|
||||
clipboardService = TestBed.inject(ClipboardService);
|
||||
notificationService = TestBed.inject(NotificationService);
|
||||
|
@ -19,11 +19,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CommentModel } from '../../models/comment.model';
|
||||
import { CommentListComponent } from './comment-list.component';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { commentUserNoPictureDefined, commentUserPictureDefined, mockCommentOne, testUser } from './mocks/comment-list.mock';
|
||||
import { CommentListServiceMock } from './mocks/comment-list.service.mock';
|
||||
import { ADF_COMMENTS_SERVICE } from '../interfaces/comments.token';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('CommentListComponent', () => {
|
||||
let commentList: CommentListComponent;
|
||||
@ -32,7 +31,7 @@ describe('CommentListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [
|
||||
{
|
||||
provide: ADF_COMMENTS_SERVICE,
|
||||
|
@ -18,13 +18,12 @@
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CommentsComponent } from './comments.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CommentsServiceMock, commentsResponseMock } from './mocks/comments.service.mock';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { ADF_COMMENTS_SERVICE } from './interfaces/comments.token';
|
||||
import { CommentsService } from './interfaces/comments-service.interface';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('CommentsComponent', () => {
|
||||
let component: CommentsComponent;
|
||||
@ -35,7 +34,7 @@ describe('CommentsComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopAnimationsModule, HttpClientTestingModule, TranslateModule.forRoot(), CommentsComponent],
|
||||
imports: [NoopAnimationsModule, NoopTranslateModule, CommentsComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: ADF_COMMENTS_SERVICE,
|
||||
|
@ -17,18 +17,17 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { UserPreferencesService } from './user-preferences.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { DirectionalityConfigService } from './directionality-config.service';
|
||||
import { directionalityConfigFactory } from './directionality-config-factory';
|
||||
import { APP_INITIALIZER } from '@angular/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('DirectionalityConfigService', () => {
|
||||
let userPreferencesService: UserPreferencesService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [
|
||||
UserPreferencesService,
|
||||
{
|
||||
|
@ -16,15 +16,14 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { AppConfigService } from '../../app-config/app-config.service';
|
||||
import { StorageService } from '../../common/services/storage.service';
|
||||
import { UserPreferencesService, UserPreferenceValues } from '../../common/services/user-preferences.service';
|
||||
import { AppConfigServiceMock } from '../mock/app-config.service.mock';
|
||||
import { AlfrescoApiService } from '../../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock, TranslationMock } from '../../mock';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslationService } from '../../translation';
|
||||
import { AlfrescoApiServiceMock } from '../../mock';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('UserPreferencesService', () => {
|
||||
const supportedPaginationSize = [5, 10, 15, 20];
|
||||
@ -36,11 +35,8 @@ describe('UserPreferencesService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule],
|
||||
providers: [
|
||||
UserPreferencesService,
|
||||
StorageService,
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
]
|
||||
|
@ -20,11 +20,10 @@ import { DateCellComponent } from './date-cell.component';
|
||||
import { DataColumn, DateConfig } from '../../data/data-column.model';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { AppConfigService } from '../../../app-config';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { LOCALE_ID } from '@angular/core';
|
||||
import { registerLocaleData } from '@angular/common';
|
||||
import localePL from '@angular/common/locales/pl';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
let component: DateCellComponent;
|
||||
let appConfigService: AppConfigService;
|
||||
@ -62,11 +61,7 @@ const checkDisplayedTooltip = (expectedTooltip: string) => {
|
||||
|
||||
const configureTestingModule = (providers: any[]) => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DateCellComponent,
|
||||
HttpClientTestingModule,
|
||||
TranslateModule.forRoot()
|
||||
],
|
||||
imports: [DateCellComponent, NoopTranslateModule],
|
||||
providers
|
||||
});
|
||||
fixture = TestBed.createComponent(DateCellComponent);
|
||||
|
@ -20,7 +20,7 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatDialogModule } from '@angular/materia
|
||||
import { ConfirmDialogComponent } from './confirm.dialog';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('Confirm Dialog Component', () => {
|
||||
let fixture: ComponentFixture<ConfirmDialogComponent>;
|
||||
@ -39,7 +39,7 @@ describe('Confirm Dialog Component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [MatDialogModule, NoopAnimationsModule, TranslateModule.forRoot()],
|
||||
imports: [MatDialogModule, NoopAnimationsModule, NoopTranslateModule],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: data }
|
||||
|
@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { JsonPipe, NgClass, NgForOf, NgIf, NgStyle, NgTemplateOutlet, UpperCasePipe } from '@angular/common';
|
||||
import { Component, Inject, Injector, Input, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
|
||||
import { Component, Inject, Injector, Input, OnDestroy, OnInit, Optional, ViewEncapsulation } from '@angular/core';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@ -77,8 +77,9 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
constructor(
|
||||
public formService: FormService,
|
||||
private formRulesManager: FormRulesManager<T>,
|
||||
@Optional()
|
||||
@Inject(FORM_FIELD_MODEL_RENDER_MIDDLEWARE)
|
||||
private middlewareServices: FormFieldModelRenderMiddleware[]
|
||||
private middlewareServices?: FormFieldModelRenderMiddleware[]
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
@ -161,6 +162,7 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private runMiddlewareServices(): void {
|
||||
if (this.middlewareServices && this.middlewareServices.length > 0) {
|
||||
const formFields = this.formDefinition.getFormFields();
|
||||
|
||||
formFields.forEach((field) => {
|
||||
@ -172,3 +174,4 @@ export class FormRendererComponent<T> implements OnInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,13 +20,13 @@ 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 { TranslateModule } from '@ngx-translate/core';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatInputHarness } from '@angular/material/input/testing';
|
||||
import { MatFormFieldHarness } from '@angular/material/form-field/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('AmountWidgetComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@ -36,7 +36,7 @@ describe('AmountWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormBaseModule]
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, FormBaseModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(AmountWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
@ -135,7 +135,7 @@ describe('AmountWidgetComponent - rendering', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormBaseModule]
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, FormBaseModule]
|
||||
});
|
||||
fixture = TestBed.createComponent(AmountWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
@ -331,7 +331,7 @@ describe('AmountWidgetComponent settings', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, FormBaseModule],
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, FormBaseModule],
|
||||
providers: [
|
||||
{
|
||||
provide: ADF_AMOUNT_SETTINGS,
|
||||
|
@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { DateTimeWidgetComponent } from './date-time.widget';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
@ -29,7 +28,7 @@ import { MatDialogModule } from '@angular/material/dialog';
|
||||
import { MatDatetimepickerModule, MatNativeDatetimeModule } from '@mat-datetimepicker/core';
|
||||
import { MatDatepickerModule } from '@angular/material/datepicker';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('DateTimeWidgetComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@ -41,8 +40,7 @@ describe('DateTimeWidgetComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
HttpClientTestingModule,
|
||||
NoopTranslateModule,
|
||||
NoopAnimationsModule,
|
||||
MatDialogModule,
|
||||
MatNativeDatetimeModule,
|
||||
|
@ -23,10 +23,8 @@ import { FormModel } from '../core/form.model';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { MultilineTextWidgetComponentComponent } from './multiline-text.widget';
|
||||
import { ComponentFixture, getTestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslationService } from '../../../../translation/translation.service';
|
||||
import { TranslationMock } from '../../../../mock/translation.service.mock';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('MultilineTextWidgetComponentComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@ -35,11 +33,10 @@ describe('MultilineTextWidgetComponentComponent', () => {
|
||||
let element: HTMLElement;
|
||||
|
||||
beforeEach(() => {
|
||||
getTestBed().configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule],
|
||||
providers: [{ provide: TranslationService, useClass: TranslationMock }]
|
||||
TestBed.configureTestingModule({
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, MultilineTextWidgetComponentComponent]
|
||||
});
|
||||
fixture = getTestBed().createComponent(MultilineTextWidgetComponentComponent);
|
||||
fixture = TestBed.createComponent(MultilineTextWidgetComponentComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
loader = TestbedHarnessEnvironment.loader(fixture);
|
||||
|
@ -20,11 +20,11 @@ import { FormFieldTypes } from '../core/form-field-types';
|
||||
import { FormFieldModel } from '../core/form-field.model';
|
||||
import { FormModel } from '../core/form.model';
|
||||
import { TextWidgetComponent } from './text.widget';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatInputHarness } from '@angular/material/input/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
describe('TextWidgetComponent', () => {
|
||||
const form = new FormModel({ taskId: 'fake-task-id' });
|
||||
@ -37,7 +37,7 @@ describe('TextWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, TextWidgetComponent]
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, TextWidgetComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TextWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
@ -24,9 +24,9 @@ export interface LangChangeEvent {
|
||||
translations: any;
|
||||
}
|
||||
|
||||
/** @deprecated use `NoopTranslateModule` instead */
|
||||
@Injectable()
|
||||
export class TranslationMock implements TranslationService {
|
||||
|
||||
defaultLang: string = 'en';
|
||||
userLang: string;
|
||||
customLoader: any;
|
||||
@ -50,5 +50,4 @@ export class TranslationMock implements TranslationService {
|
||||
instant(key: string | Array<string>): string | any {
|
||||
return key;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -20,14 +20,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { MatSnackBarConfig, MatSnackBarModule } from '@angular/material/snack-bar';
|
||||
import { NotificationService } from './notification.service';
|
||||
import { TranslationService } from '../../translation/translation.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatIconHarness } from '@angular/material/icon/testing';
|
||||
import { MatSnackBarHarness } from '@angular/material/snack-bar/testing';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { TranslationMock } from '../../mock';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
template: '',
|
||||
@ -94,10 +92,8 @@ describe('NotificationService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, HttpClientModule, MatSnackBarModule],
|
||||
declarations: [ProvidesNotificationServiceComponent],
|
||||
providers:[
|
||||
{ provide: TranslationService, useClass: TranslationMock }]
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, MatSnackBarModule],
|
||||
declarations: [ProvidesNotificationServiceComponent]
|
||||
});
|
||||
translationService = TestBed.inject(TranslationService);
|
||||
fixture = TestBed.createComponent(ProvidesNotificationServiceComponent);
|
||||
|
@ -19,13 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PaginationComponent } from './pagination.component';
|
||||
import { PaginatedComponent } from './paginated-component.interface';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
import { TranslateFakeLoader, TranslateLoader, TranslateModule } from '@ngx-translate/core';
|
||||
import { PaginationModel } from '../models/pagination.model';
|
||||
import { TranslationService } from '../translation/translation.service';
|
||||
import { TranslationMock } from '../mock/translation.service.mock';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import { MatMenuModule } from '@angular/material/menu';
|
||||
import { NoopTranslateModule } from '@alfresco/adf-core';
|
||||
|
||||
class FakePaginationInput implements PaginationModel {
|
||||
count = 25;
|
||||
@ -46,17 +42,7 @@ describe('PaginationComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
HttpClientModule,
|
||||
MatMenuModule,
|
||||
TranslateModule.forRoot({
|
||||
loader: {provide: TranslateLoader, useClass: TranslateFakeLoader}
|
||||
})
|
||||
],
|
||||
providers:[
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
imports: [NoopAnimationsModule, NoopTranslateModule, PaginationComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(PaginationComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -18,14 +18,11 @@
|
||||
import { NgModule, APP_INITIALIZER } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CoreModule } from '../core.module';
|
||||
import { AlfrescoApiService } from '../services/alfresco-api.service';
|
||||
import { AlfrescoApiServiceMock } from '../mock/alfresco-api.service.mock';
|
||||
import { AppConfigService } from '../app-config/app-config.service';
|
||||
import { AppConfigServiceMock } from '../common/mock/app-config.service.mock';
|
||||
import { TranslationService } from '../translation/translation.service';
|
||||
import { TranslationMock } from '../mock/translation.service.mock';
|
||||
import { DatePipe } from '@angular/common';
|
||||
import { CookieService } from '../common/services/cookie.service';
|
||||
import { CookieServiceMock } from '../mock/cookie.service.mock';
|
||||
@ -34,6 +31,7 @@ import { directionalityConfigFactory } from '../common/services/directionality-c
|
||||
import { DirectionalityConfigService } from '../common/services/directionality-config.service';
|
||||
import { AuthModule, RedirectAuthService } from '../auth';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
import { NoopTranslateModule } from './noop-translate.module';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
@ -41,14 +39,13 @@ import { EMPTY, of } from 'rxjs';
|
||||
NoopAnimationsModule,
|
||||
RouterTestingModule,
|
||||
HttpClientModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot()
|
||||
CoreModule.forRoot(),
|
||||
NoopTranslateModule
|
||||
],
|
||||
providers: [
|
||||
DatePipe,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: CookieService, useClass: CookieServiceMock },
|
||||
{
|
||||
provide: APP_INITIALIZER,
|
||||
@ -58,6 +55,6 @@ import { EMPTY, of } from 'rxjs';
|
||||
},
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, init: () => {}, onTokenReceived: of() } }
|
||||
],
|
||||
exports: [NoopAnimationsModule, CoreModule, TranslateModule, RouterTestingModule]
|
||||
exports: [NoopAnimationsModule, CoreModule, RouterTestingModule]
|
||||
})
|
||||
export class CoreTestingModule {}
|
||||
|
@ -18,3 +18,4 @@
|
||||
export * from './setup-test-bed';
|
||||
export * from './core.testing.module';
|
||||
export * from './core.story.module';
|
||||
export * from './noop-translate.module';
|
||||
|
53
lib/core/src/lib/testing/noop-translate.module.ts
Normal file
53
lib/core/src/lib/testing/noop-translate.module.ts
Normal file
@ -0,0 +1,53 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 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 { EventEmitter, NgModule } from '@angular/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TranslationService } from '../translation/translation.service';
|
||||
import { LangChangeEvent } from '../mock';
|
||||
import { Observable, of } from 'rxjs';
|
||||
|
||||
export class NoopTranslationService implements TranslationService {
|
||||
defaultLang: string = 'en';
|
||||
userLang: string;
|
||||
customLoader: any;
|
||||
|
||||
translate: any = {
|
||||
onLangChange: new EventEmitter<LangChangeEvent>()
|
||||
};
|
||||
|
||||
addTranslationFolder() {}
|
||||
onTranslationChanged() {}
|
||||
use(): any {}
|
||||
loadTranslation() {}
|
||||
|
||||
get(key: string | Array<string>): Observable<string | any> {
|
||||
return of(key);
|
||||
}
|
||||
|
||||
instant(key: string | Array<string>): string | any {
|
||||
return key;
|
||||
}
|
||||
}
|
||||
|
||||
@NgModule({
|
||||
imports: [HttpClientTestingModule, TranslateModule.forRoot()],
|
||||
providers: [{ provide: TranslationService, useClass: NoopTranslationService }],
|
||||
exports: [TranslateModule]
|
||||
})
|
||||
export class NoopTranslateModule {}
|
@ -19,6 +19,8 @@ import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { TxtViewerComponent } from './txt-viewer.component';
|
||||
import { CoreTestingModule } from '../../../testing';
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { of } from 'rxjs';
|
||||
|
||||
describe('Text View component', () => {
|
||||
let component: TxtViewerComponent;
|
||||
@ -27,41 +29,42 @@ describe('Text View component', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CoreTestingModule]
|
||||
imports: [CoreTestingModule, TxtViewerComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TxtViewerComponent);
|
||||
|
||||
const httpClient = TestBed.inject(HttpClient);
|
||||
spyOn(httpClient, 'get').and.returnValue(of('example'));
|
||||
|
||||
element = fixture.nativeElement;
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
describe('View', () => {
|
||||
it('Should text container be present with urlFile', (done) => {
|
||||
it('Should text container be present with urlFile', async () => {
|
||||
fixture.detectChanges();
|
||||
const urlFile = './fake-test-file.txt';
|
||||
const change = new SimpleChange(null, urlFile, true);
|
||||
|
||||
component.ngOnChanges({ urlFile: change }).then(() => {
|
||||
await component.ngOnChanges({ urlFile: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(element.querySelector('.adf-txt-viewer-content').textContent).toContain('example');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Should text container be present with Blob file', (done) => {
|
||||
it('Should text container be present with Blob file', async () => {
|
||||
const blobFile = new Blob(['text example'], { type: 'text/txt' });
|
||||
|
||||
const change = new SimpleChange(null, blobFile, true);
|
||||
|
||||
component.ngOnChanges({ blobFile: change }).then(() => {
|
||||
await component.ngOnChanges({ blobFile: change });
|
||||
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
await fixture.whenStable();
|
||||
|
||||
expect(element.querySelector('.adf-txt-viewer-content').textContent).toContain('example');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -17,25 +17,21 @@
|
||||
|
||||
import { NgModule } from '@angular/core';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
AlfrescoApiServiceMock,
|
||||
AppConfigService,
|
||||
AppConfigServiceMock,
|
||||
TranslationService,
|
||||
TranslationMock,
|
||||
AuthModule
|
||||
AuthModule,
|
||||
NoopTranslateModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
||||
@NgModule({
|
||||
imports: [AuthModule.forRoot({ useHash: true }), NoopAnimationsModule, HttpClientTestingModule, TranslateModule.forRoot()],
|
||||
imports: [AuthModule.forRoot({ useHash: true }), NoopAnimationsModule, NoopTranslateModule],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
],
|
||||
exports: [NoopAnimationsModule, TranslateModule]
|
||||
exports: [NoopAnimationsModule]
|
||||
})
|
||||
export class InsightsTestingModule {}
|
||||
|
@ -16,9 +16,7 @@
|
||||
*/
|
||||
|
||||
import { Component, ViewEncapsulation, Input, Inject, OnDestroy } from '@angular/core';
|
||||
import {
|
||||
AppConfigService, UserPreferencesService
|
||||
} from '@alfresco/adf-core';
|
||||
import { AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import { ServiceTaskQueryCloudRequestModel } from '../models/service-task-cloud.model';
|
||||
import { BaseTaskListCloudComponent } from './base-task-list-cloud.component';
|
||||
import { ServiceTaskListCloudService } from '../services/service-task-list-cloud.service';
|
||||
@ -42,14 +40,12 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent im
|
||||
private onDestroyServiceTaskList$ = new Subject<boolean>();
|
||||
|
||||
private isReloadingSubject$ = new BehaviorSubject<boolean>(false);
|
||||
isLoading$ = combineLatest([
|
||||
this.isLoadingPreferences$,
|
||||
this.isReloadingSubject$
|
||||
]).pipe(
|
||||
isLoading$ = combineLatest([this.isLoadingPreferences$, this.isReloadingSubject$]).pipe(
|
||||
map(([isLoadingPreferences, isReloading]) => isLoadingPreferences || isReloading)
|
||||
);
|
||||
|
||||
constructor(private serviceTaskListCloudService: ServiceTaskListCloudService,
|
||||
constructor(
|
||||
private serviceTaskListCloudService: ServiceTaskListCloudService,
|
||||
appConfigService: AppConfigService,
|
||||
taskCloudService: TaskCloudService,
|
||||
userPreferences: UserPreferencesService,
|
||||
@ -69,22 +65,20 @@ export class ServiceTaskListCloudComponent extends BaseTaskListCloudComponent im
|
||||
this.requestNode = this.createRequestNode();
|
||||
|
||||
if (this.requestNode.appName || this.requestNode.appName === '') {
|
||||
|
||||
combineLatest([
|
||||
this.serviceTaskListCloudService.getServiceTaskByRequest(this.requestNode),
|
||||
this.isColumnSchemaCreated$
|
||||
]).pipe(
|
||||
takeUntil(this.onDestroyServiceTaskList$)
|
||||
).subscribe(
|
||||
combineLatest([this.serviceTaskListCloudService.getServiceTaskByRequest(this.requestNode), this.isColumnSchemaCreated$])
|
||||
.pipe(takeUntil(this.onDestroyServiceTaskList$))
|
||||
.subscribe(
|
||||
([tasks]) => {
|
||||
this.rows = tasks.list.entries;
|
||||
this.success.emit(tasks);
|
||||
this.pagination.next(tasks.list.pagination);
|
||||
this.isReloadingSubject$.next(false);
|
||||
}, (error) => {
|
||||
},
|
||||
(error) => {
|
||||
this.error.emit(error);
|
||||
this.isReloadingSubject$.next(false);
|
||||
});
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.rows = [];
|
||||
}
|
||||
|
@ -151,14 +151,12 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
|
||||
dataAdapter: TasksListDatatableAdapter | undefined;
|
||||
|
||||
private isReloadingSubject$ = new BehaviorSubject<boolean>(false);
|
||||
isLoading$ = combineLatest([
|
||||
this.isLoadingPreferences$,
|
||||
this.isReloadingSubject$
|
||||
]).pipe(
|
||||
isLoading$ = combineLatest([this.isLoadingPreferences$, this.isReloadingSubject$]).pipe(
|
||||
map(([isLoadingPreferences, isReloading]) => isLoadingPreferences || isReloading)
|
||||
);
|
||||
|
||||
constructor(@Inject(TASK_LIST_CLOUD_TOKEN) public taskListCloudService: TaskListCloudServiceInterface,
|
||||
constructor(
|
||||
@Inject(TASK_LIST_CLOUD_TOKEN) public taskListCloudService: TaskListCloudServiceInterface,
|
||||
appConfigService: AppConfigService,
|
||||
taskCloudService: TaskCloudService,
|
||||
userPreferences: UserPreferencesService,
|
||||
@ -176,31 +174,33 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
|
||||
reload() {
|
||||
this.isReloadingSubject$.next(true);
|
||||
|
||||
this.isColumnSchemaCreated$.pipe(
|
||||
this.isColumnSchemaCreated$
|
||||
.pipe(
|
||||
switchMap(() => of(this.createRequestNode())),
|
||||
tap((requestNode) => this.requestNode = requestNode),
|
||||
tap((requestNode) => (this.requestNode = requestNode)),
|
||||
switchMap((requestNode) => this.taskListCloudService.getTaskByRequest(requestNode)),
|
||||
takeUntil(this.onDestroyTaskList$)
|
||||
).subscribe((tasks: { list: PaginatedEntries<TaskCloudModel> }) => {
|
||||
)
|
||||
.subscribe(
|
||||
(tasks: { list: PaginatedEntries<TaskCloudModel> }) => {
|
||||
const tasksWithVariables = tasks.list.entries.map((task) => ({
|
||||
...task,
|
||||
variables: task.processVariables
|
||||
}));
|
||||
|
||||
this.rows = this.viewModelCreator.mapVariablesByColumnTitle(
|
||||
tasksWithVariables,
|
||||
this.columns
|
||||
);
|
||||
this.rows = this.viewModelCreator.mapVariablesByColumnTitle(tasksWithVariables, this.columns);
|
||||
|
||||
this.dataAdapter = new TasksListDatatableAdapter(this.rows, this.columns);
|
||||
|
||||
this.success.emit(tasks);
|
||||
this.isReloadingSubject$.next(false);
|
||||
this.pagination.next(tasks.list.pagination);
|
||||
}, (error) => {
|
||||
},
|
||||
(error) => {
|
||||
this.error.emit(error);
|
||||
this.isReloadingSubject$.next(false);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
createRequestNode(): TaskQueryCloudRequestModel {
|
||||
@ -242,11 +242,8 @@ export class TaskListCloudComponent extends BaseTaskListCloudComponent<ProcessLi
|
||||
|
||||
private getRequestNodeVariables(): string[] | undefined {
|
||||
const displayedVariableColumns: string[] = (this.columns ?? [])
|
||||
.filter(column =>
|
||||
column.customData?.columnType === 'process-variable-column' &&
|
||||
column.isHidden !== true
|
||||
)
|
||||
.map(column => {
|
||||
.filter((column) => column.customData?.columnType === 'process-variable-column' && column.isHidden !== true)
|
||||
.map((column) => {
|
||||
const variableDefinitionsPayload = column.customData.variableDefinitionsPayload;
|
||||
return variableDefinitionsPayload;
|
||||
})
|
||||
|
@ -1,30 +0,0 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright © 2005-2024 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 { TaskListCloudModule } from './task-list-cloud.module';
|
||||
|
||||
describe('TaskListCloudModule', () => {
|
||||
let taskListCloudModule: TaskListCloudModule;
|
||||
|
||||
beforeEach(() => {
|
||||
taskListCloudModule = new TaskListCloudModule();
|
||||
});
|
||||
|
||||
it('should create an instance', () => {
|
||||
expect(taskListCloudModule).toBeTruthy();
|
||||
});
|
||||
});
|
@ -26,19 +26,9 @@ import { TaskListCloudService } from './services/task-list-cloud.service';
|
||||
import { LocalPreferenceCloudService } from '../../services/local-preference-cloud.service';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MaterialModule,
|
||||
CoreModule
|
||||
],
|
||||
declarations: [
|
||||
TaskListCloudComponent,
|
||||
ServiceTaskListCloudComponent
|
||||
],
|
||||
exports: [
|
||||
TaskListCloudComponent,
|
||||
ServiceTaskListCloudComponent
|
||||
],
|
||||
imports: [CommonModule, MaterialModule, CoreModule],
|
||||
declarations: [TaskListCloudComponent, ServiceTaskListCloudComponent],
|
||||
exports: [TaskListCloudComponent, ServiceTaskListCloudComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: TASK_LIST_CLOUD_TOKEN,
|
||||
|
@ -25,7 +25,8 @@ import {
|
||||
AppConfigServiceMock,
|
||||
TranslationService,
|
||||
TranslationMock,
|
||||
CoreModule, AuthModule
|
||||
CoreModule,
|
||||
AuthModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ProcessServicesCloudModule } from '../process-services-cloud.module';
|
||||
@ -46,11 +47,6 @@ import { RouterTestingModule } from '@angular/router/testing';
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
],
|
||||
exports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule,
|
||||
CoreModule,
|
||||
ProcessServicesCloudModule
|
||||
]
|
||||
exports: [NoopAnimationsModule, TranslateModule, CoreModule, ProcessServicesCloudModule]
|
||||
})
|
||||
export class ProcessServiceCloudTestingModule {}
|
||||
|
@ -27,6 +27,7 @@ import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing';
|
||||
import { AppDefinitionRepresentation } from '@alfresco/js-api';
|
||||
import { CustomEmptyContentTemplateDirective } from '@alfresco/adf-core';
|
||||
|
||||
describe('AppsListComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@ -37,6 +38,8 @@ describe('AppsListComponent', () => {
|
||||
let getAppsSpy: jasmine.Spy;
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CustomEmptyContentTemplateDirective, AppsListComponent],
|
||||
template: `
|
||||
<adf-apps>
|
||||
<adf-custom-empty-content-template>
|
||||
@ -49,8 +52,7 @@ describe('AppsListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [CustomEmptyAppListTemplateComponent]
|
||||
imports: [ProcessTestingModule, CustomEmptyAppListTemplateComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(AppsListComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -27,6 +27,7 @@ import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-dialog-test',
|
||||
standalone: true,
|
||||
template: ''
|
||||
})
|
||||
export class DialogSelectAppTestComponent {
|
||||
@ -57,8 +58,7 @@ describe('Select app dialog', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [DialogSelectAppTestComponent],
|
||||
imports: [ProcessTestingModule, DialogSelectAppTestComponent],
|
||||
providers: [
|
||||
{
|
||||
provide: OverlayContainer,
|
||||
|
@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { SimpleChange, Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { SimpleChange, Component } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of, throwError } from 'rxjs';
|
||||
@ -26,6 +26,7 @@ import { ProcessContentService } from '../../form/services/process-content.servi
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatMenuHarness } from '@angular/material/menu/testing';
|
||||
import { EmptyListComponent, EmptyListHeaderDirective } from '@alfresco/adf-core';
|
||||
|
||||
describe('ProcessAttachmentListComponent', () => {
|
||||
let loader: HarnessLoader;
|
||||
@ -239,6 +240,8 @@ describe('ProcessAttachmentListComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [EmptyListHeaderDirective, EmptyListComponent, ProcessAttachmentListComponent],
|
||||
template: `
|
||||
<adf-process-attachment-list>
|
||||
<adf-empty-list>
|
||||
@ -254,9 +257,7 @@ describe('Custom CustomEmptyTemplateComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [CustomEmptyTemplateComponent],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
imports: [ProcessTestingModule, CustomEmptyTemplateComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(CustomEmptyTemplateComponent);
|
||||
fixture.detectChanges();
|
||||
|
@ -39,6 +39,8 @@ import { TaskFormService } from './services/task-form.service';
|
||||
import { TaskService } from './services/task.service';
|
||||
import { EditorService } from './services/editor.service';
|
||||
import { ModelService } from './services/model.service';
|
||||
import { FormCustomOutcomesComponent } from '@alfresco/adf-process-services';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
|
||||
describe('FormComponent', () => {
|
||||
let fixture: ComponentFixture<FormComponent>;
|
||||
@ -981,6 +983,8 @@ describe('FormComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [FormCustomOutcomesComponent, MatButtonModule, FormComponent],
|
||||
selector: 'adf-form-with-custom-outcomes',
|
||||
template: ` <adf-form #adfForm>
|
||||
<adf-form-custom-outcomes>
|
||||
@ -1005,8 +1009,7 @@ describe('FormWithCustomOutComesComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [FormWithCustomOutComesComponent]
|
||||
imports: [ProcessTestingModule, FormWithCustomOutComesComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(FormWithCustomOutComesComponent);
|
||||
customComponent = fixture.componentInstance;
|
||||
|
@ -17,18 +17,8 @@
|
||||
|
||||
import { FileViewerWidgetComponent } from './file-viewer.widget';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
FormModel,
|
||||
FormService,
|
||||
FormFieldModel,
|
||||
TranslationService,
|
||||
TranslationMock,
|
||||
AuthenticationService,
|
||||
RedirectAuthService
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FormModel, FormService, FormFieldModel, RedirectAuthService, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { EMPTY, of } from 'rxjs';
|
||||
|
||||
describe('FileViewerWidgetComponent', () => {
|
||||
@ -54,11 +44,9 @@ describe('FileViewerWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), FileViewerWidgetComponent, HttpClientTestingModule],
|
||||
imports: [NoopTranslateModule, FileViewerWidgetComponent],
|
||||
providers: [
|
||||
{ provide: FormService, useValue: formServiceStub },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AuthenticationService,
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY, onTokenReceived: of() } }
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
|
@ -24,26 +24,18 @@ import {
|
||||
FormFieldOption,
|
||||
FormFieldModel,
|
||||
FormModel,
|
||||
ErrorWidgetComponent,
|
||||
TranslationMock,
|
||||
AlfrescoApiServiceMock,
|
||||
AppConfigServiceMock,
|
||||
AppConfigService,
|
||||
AlfrescoApiService,
|
||||
TranslationService
|
||||
NoopTranslateModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { RadioButtonsWidgetComponent } from './radio-buttons.widget';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatRadioModule } from '@angular/material/radio';
|
||||
import { FormsModule } from '@angular/forms';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TaskFormService } from '../../services/task-form.service';
|
||||
import { ProcessDefinitionService } from '../../services/process-definition.service';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatRadioButtonHarness, MatRadioGroupHarness } from '@angular/material/radio/testing';
|
||||
import { MatButtonModule } from '@angular/material/button';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
||||
describe('RadioButtonsWidgetComponent', () => {
|
||||
let formService: FormService;
|
||||
@ -53,18 +45,8 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
getTestBed().configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
MatRadioModule,
|
||||
MatButtonModule,
|
||||
FormsModule,
|
||||
HttpClientTestingModule,
|
||||
MatIconModule,
|
||||
ErrorWidgetComponent,
|
||||
RadioButtonsWidgetComponent
|
||||
],
|
||||
imports: [NoopTranslateModule, RadioButtonsWidgetComponent],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
]
|
||||
|
@ -22,9 +22,12 @@ import { ProcessService } from '../../services/process.service';
|
||||
import { DownloadService } from '@alfresco/adf-core';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { ProcessInstanceAuditInfoRepresentation } from '@alfresco/js-api';
|
||||
import { ProcessAuditDirective } from '@alfresco/adf-process-services';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-basic-button',
|
||||
standalone: true,
|
||||
imports: [ProcessAuditDirective],
|
||||
template: ` <button
|
||||
id="auditButton"
|
||||
adf-process-audit
|
||||
@ -79,8 +82,7 @@ describe('ProcessAuditDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [BasicButtonComponent]
|
||||
imports: [ProcessTestingModule, BasicButtonComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(BasicButtonComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -28,7 +28,11 @@ import {
|
||||
ObjectDataRow,
|
||||
ObjectDataTableAdapter,
|
||||
DataCellEvent,
|
||||
ObjectDataColumn
|
||||
ObjectDataColumn,
|
||||
DataColumnComponent,
|
||||
DataColumnListComponent,
|
||||
FullNamePipe,
|
||||
CustomEmptyContentTemplateDirective
|
||||
} from '@alfresco/adf-core';
|
||||
import { fakeProcessInstance, fakeProcessInstancesWithNoName, fakeProcessInstancesEmpty, fakeProcessColumnSchema } from '../../../testing/mock';
|
||||
import { ProcessService } from '../../services/process.service';
|
||||
@ -438,6 +442,8 @@ describe('ProcessInstanceListComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [ProcessInstanceListComponent, DataColumnListComponent, DataColumnComponent, FullNamePipe],
|
||||
template: ` <adf-process-instance-list #processListComponentInstance>
|
||||
<data-columns>
|
||||
<data-column key="name" title="ADF_PROCESS_LIST.PROPERTIES.NAME" class="adf-full-width adf-name-column" [order]="3"></data-column>
|
||||
@ -461,8 +467,7 @@ describe('CustomProcessListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [CustomProcessListComponent]
|
||||
imports: [ProcessTestingModule, CustomProcessListComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(CustomProcessListComponent);
|
||||
fixture.detectChanges();
|
||||
@ -480,6 +485,8 @@ describe('CustomProcessListComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CustomEmptyContentTemplateDirective, ProcessInstanceListComponent],
|
||||
template: `
|
||||
<adf-process-instance-list [appId]="1">
|
||||
<adf-custom-empty-content-template>
|
||||
@ -489,14 +496,14 @@ describe('CustomProcessListComponent', () => {
|
||||
`
|
||||
})
|
||||
class EmptyTemplateComponent {}
|
||||
|
||||
describe('Process List: Custom EmptyTemplateComponent', () => {
|
||||
let fixture: ComponentFixture<EmptyTemplateComponent>;
|
||||
let processService: ProcessService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [EmptyTemplateComponent]
|
||||
imports: [ProcessTestingModule, EmptyTemplateComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(EmptyTemplateComponent);
|
||||
processService = TestBed.inject(ProcessService);
|
||||
@ -521,6 +528,8 @@ describe('Process List: Custom EmptyTemplateComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [ProcessInstanceListComponent, DataColumnComponent, DataColumnListComponent, FullNamePipe],
|
||||
template: ` <adf-process-instance-list
|
||||
[appId]="appId"
|
||||
[showContextMenu]="true"
|
||||
@ -591,8 +600,7 @@ describe('ProcessListContextMenuComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [ProcessListContextMenuComponent]
|
||||
imports: [ProcessTestingModule, ProcessListContextMenuComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(ProcessListContextMenuComponent);
|
||||
customComponent = fixture.componentInstance;
|
||||
|
@ -17,14 +17,7 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
AppConfigService,
|
||||
AppConfigServiceMock,
|
||||
FormRenderingService,
|
||||
LocalizedDatePipe,
|
||||
TranslationMock,
|
||||
TranslationService
|
||||
} from '@alfresco/adf-core';
|
||||
import { AppConfigService, AppConfigServiceMock, FormRenderingService, LocalizedDatePipe, NoopTranslateModule } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { ProcessService } from '../../services/process.service';
|
||||
@ -37,19 +30,15 @@ import {
|
||||
testProcessDefinitions
|
||||
} from '../../../testing/mock';
|
||||
import { StartProcessInstanceComponent } from './start-process.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { MatFormFieldHarness } from '@angular/material/form-field/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatAutocompleteHarness } from '@angular/material/autocomplete/testing';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { RestVariable } from '@alfresco/js-api';
|
||||
import { ActivitiContentService } from '../../../form/services/activiti-alfresco.service';
|
||||
import { AppsProcessService } from '../../../services/apps-process.service';
|
||||
|
||||
import { ProcessFormRenderingService } from '../../../form';
|
||||
import { FORM_FIELD_MODEL_RENDER_MIDDLEWARE } from 'lib/core/src/lib/form/components/middlewares/middleware';
|
||||
import { deployedApps } from '../../../testing/mock/apps-list.mock';
|
||||
|
||||
describe('StartProcessComponent', () => {
|
||||
@ -68,17 +57,11 @@ describe('StartProcessComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
getTestBed().configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, HttpClientTestingModule, StartProcessInstanceComponent],
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, StartProcessInstanceComponent],
|
||||
providers: [
|
||||
LocalizedDatePipe,
|
||||
ActivitiContentService,
|
||||
ProcessService,
|
||||
AppsProcessService,
|
||||
FormRenderingService,
|
||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE, useValue: [] }
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
]
|
||||
});
|
||||
});
|
||||
|
@ -20,12 +20,15 @@ import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { TaskAuditDirective } from '@alfresco/adf-process-services';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
describe('TaskAuditDirective', () => {
|
||||
@Component({
|
||||
selector: 'adf-basic-button',
|
||||
standalone: true,
|
||||
imports: [TaskAuditDirective],
|
||||
template: ` <button
|
||||
id="auditButton"
|
||||
adf-task-audit
|
||||
@ -71,8 +74,7 @@ describe('TaskAuditDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [BasicButtonComponent]
|
||||
imports: [ProcessTestingModule, BasicButtonComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(BasicButtonComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@ -20,10 +20,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { ClaimTaskDirective } from '@alfresco/adf-process-services';
|
||||
|
||||
describe('ClaimTaskDirective', () => {
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [ClaimTaskDirective],
|
||||
selector: 'adf-claim-test-component',
|
||||
template: '<button adf-claim-task [taskId]="taskId" (success)="onClaim($event)">Claim</button>'
|
||||
})
|
||||
@ -43,12 +45,7 @@ describe('ClaimTaskDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
imports: [ProcessTestingModule, TestComponent]
|
||||
});
|
||||
taskListService = TestBed.inject(TaskListService);
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
@ -78,14 +75,17 @@ describe('ClaimTaskDirective', () => {
|
||||
});
|
||||
|
||||
describe('Claim Task Directive validation errors', () => {
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [ClaimTaskDirective],
|
||||
selector: 'adf-claim-no-fields-validation-component',
|
||||
template: '<button adf-claim-task></button>'
|
||||
})
|
||||
class ClaimTestMissingInputDirectiveComponent {}
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [ClaimTaskDirective],
|
||||
selector: 'adf-claim-no-taskid-validation-component',
|
||||
template: '<button adf-claim-task [taskId]=""></button>'
|
||||
})
|
||||
@ -95,13 +95,7 @@ describe('Claim Task Directive validation errors', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
imports: [ProcessTestingModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestMissingInputDirectiveComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent);
|
||||
});
|
||||
|
@ -20,10 +20,12 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { UnclaimTaskDirective } from '@alfresco/adf-process-services';
|
||||
|
||||
describe('UnclaimTaskDirective', () => {
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [UnclaimTaskDirective],
|
||||
selector: 'adf-unclaim-test-component',
|
||||
template: '<button adf-unclaim-task [taskId]="taskId" (success)="onUnclaim($event)">Unclaim</button>'
|
||||
})
|
||||
@ -43,12 +45,7 @@ describe('UnclaimTaskDirective', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
imports: [ProcessTestingModule, TestComponent]
|
||||
});
|
||||
taskListService = TestBed.inject(TaskListService);
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
@ -78,34 +75,27 @@ describe('UnclaimTaskDirective', () => {
|
||||
});
|
||||
|
||||
describe('Claim Task Directive validation errors', () => {
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [UnclaimTaskDirective],
|
||||
selector: 'adf-unclaim-no-fields-validation-component',
|
||||
template: '<button adf-unclaim-task></button>'
|
||||
})
|
||||
class ClaimTestMissingInputDirectiveComponent {
|
||||
|
||||
}
|
||||
class ClaimTestMissingInputDirectiveComponent {}
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [UnclaimTaskDirective],
|
||||
selector: 'adf-claim-no-taskid-validation-component',
|
||||
template: '<button adf-unclaim-task [taskId]=""></button>'
|
||||
})
|
||||
class ClaimTestMissingTaskIdDirectiveComponent {
|
||||
|
||||
}
|
||||
class ClaimTestMissingTaskIdDirectiveComponent {}
|
||||
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
imports: [ProcessTestingModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestMissingInputDirectiveComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent);
|
||||
});
|
||||
|
@ -26,21 +26,25 @@ import {
|
||||
ObjectDataColumn,
|
||||
AppConfigServiceMock,
|
||||
AlfrescoApiServiceMock,
|
||||
AlfrescoApiService
|
||||
AlfrescoApiService,
|
||||
DataColumnComponent,
|
||||
DataColumnListComponent,
|
||||
FullNamePipe,
|
||||
NoopTranslateModule,
|
||||
CustomEmptyContentTemplateDirective
|
||||
} from '@alfresco/adf-core';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { TaskListComponent } from './task-list.component';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { fakeGlobalTask, fakeEmptyTask, paginatedTask, fakeColumnSchema, fakeCustomSchema } from '../../../testing/mock';
|
||||
import { TranslateModule, TranslateService } from '@ngx-translate/core';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { MatCheckboxHarness } from '@angular/material/checkbox/testing';
|
||||
import { MatMenuItemHarness } from '@angular/material/menu/testing';
|
||||
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@ -105,7 +109,7 @@ describe('TaskListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), NoopAnimationsModule, MatProgressSpinnerModule, HttpClientTestingModule, TaskListComponent],
|
||||
imports: [NoopTranslateModule, NoopAnimationsModule, TaskListComponent],
|
||||
providers: [
|
||||
TaskListService,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
@ -644,6 +648,8 @@ describe('TaskListComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [DataColumnComponent, DataColumnListComponent, TaskListComponent, FullNamePipe],
|
||||
template: ` <adf-tasklist #taskList>
|
||||
<data-columns>
|
||||
<data-column key="name" title="ADF_TASK_LIST.PROPERTIES.NAME" class="full-width name-column" [order]="3"></data-column>
|
||||
@ -667,8 +673,7 @@ describe('CustomTaskListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [CustomTaskListComponent]
|
||||
imports: [ProcessTestingModule, CustomTaskListComponent, CustomTaskListComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(CustomTaskListComponent);
|
||||
fixture.detectChanges();
|
||||
@ -690,6 +695,8 @@ describe('CustomTaskListComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CustomEmptyContentTemplateDirective, TaskListComponent],
|
||||
template: `
|
||||
<adf-tasklist [appId]="1">
|
||||
<adf-custom-empty-content-template>
|
||||
@ -707,8 +714,7 @@ describe('Task List: Custom EmptyTemplateComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ProcessTestingModule],
|
||||
declarations: [EmptyTemplateComponent]
|
||||
imports: [ProcessTestingModule, EmptyTemplateComponent]
|
||||
});
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
taskListService = TestBed.inject(TaskListService);
|
||||
@ -733,6 +739,8 @@ describe('Task List: Custom EmptyTemplateComponent', () => {
|
||||
});
|
||||
|
||||
@Component({
|
||||
standalone: true,
|
||||
imports: [CommonModule, TaskListComponent, DataColumnComponent, DataColumnListComponent, FullNamePipe],
|
||||
template: ` <adf-tasklist [showContextMenu]="true" (showRowContextMenu)="onShowRowContextMenu($event)" #taskList>
|
||||
<data-columns>
|
||||
<data-column key="name" title="ADF_TASK_LIST.PROPERTIES.NAME" class="full-width name-column"></data-column>
|
||||
@ -795,8 +803,7 @@ describe('TaskListContextMenuComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), MatProgressSpinnerModule, ProcessTestingModule],
|
||||
declarations: [TaskListContextMenuComponent]
|
||||
imports: [ProcessTestingModule, TaskListContextMenuComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(TaskListContextMenuComponent);
|
||||
customComponent = fixture.componentInstance;
|
||||
|
@ -23,34 +23,29 @@ import {
|
||||
AlfrescoApiServiceMock,
|
||||
AppConfigService,
|
||||
AppConfigServiceMock,
|
||||
TranslationService,
|
||||
TranslationMock,
|
||||
CoreModule,
|
||||
FormRenderingService,
|
||||
AuthModule
|
||||
AuthModule,
|
||||
NoopTranslateModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ProcessFormRenderingService } from '../form/process-form-rendering.service';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
AuthModule.forRoot({ useHash: true }),
|
||||
NoopAnimationsModule,
|
||||
HttpClientTestingModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot(),
|
||||
ProcessModule.forRoot(),
|
||||
RouterTestingModule
|
||||
RouterTestingModule,
|
||||
NoopTranslateModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
FormRenderingService,
|
||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService }
|
||||
],
|
||||
exports: [NoopAnimationsModule, TranslateModule, CoreModule, ProcessModule]
|
||||
exports: [NoopAnimationsModule, CoreModule, ProcessModule]
|
||||
})
|
||||
export class ProcessTestingModule {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user