mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
ACS-8652: Noop Translation Module for better unit testing ergonomics (#10118)
This commit is contained in:
@@ -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,11 +20,13 @@ 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({
|
||||
selector: 'adf-claim-test-component',
|
||||
standalone: true,
|
||||
imports: [ClaimTaskDirective],
|
||||
selector: 'adf-claim-test-component',
|
||||
template: '<button adf-claim-task [taskId]="taskId" (success)="onClaim($event)">Claim</button>'
|
||||
})
|
||||
class TestComponent {
|
||||
@@ -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,30 +75,27 @@ describe('ClaimTaskDirective', () => {
|
||||
});
|
||||
|
||||
describe('Claim Task Directive validation errors', () => {
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-no-fields-validation-component',
|
||||
standalone: true,
|
||||
imports: [ClaimTaskDirective],
|
||||
selector: 'adf-claim-no-fields-validation-component',
|
||||
template: '<button adf-claim-task></button>'
|
||||
})
|
||||
class ClaimTestMissingInputDirectiveComponent { }
|
||||
class ClaimTestMissingInputDirectiveComponent {}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-no-taskid-validation-component',
|
||||
standalone: true,
|
||||
imports: [ClaimTaskDirective],
|
||||
selector: 'adf-claim-no-taskid-validation-component',
|
||||
template: '<button adf-claim-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);
|
||||
});
|
||||
@@ -115,6 +109,6 @@ describe('Claim Task Directive validation errors', () => {
|
||||
it('should throw error when taskId is not set', () => {
|
||||
fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent);
|
||||
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute taskId is required');
|
||||
expect(() => fixture.detectChanges()).toThrowError('Attribute taskId is required');
|
||||
});
|
||||
});
|
||||
|
@@ -20,11 +20,13 @@ 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({
|
||||
selector: 'adf-unclaim-test-component',
|
||||
standalone: true,
|
||||
imports: [UnclaimTaskDirective],
|
||||
selector: 'adf-unclaim-test-component',
|
||||
template: '<button adf-unclaim-task [taskId]="taskId" (success)="onUnclaim($event)">Unclaim</button>'
|
||||
})
|
||||
class TestComponent {
|
||||
@@ -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({
|
||||
selector: 'adf-unclaim-no-fields-validation-component',
|
||||
standalone: true,
|
||||
imports: [UnclaimTaskDirective],
|
||||
selector: 'adf-unclaim-no-fields-validation-component',
|
||||
template: '<button adf-unclaim-task></button>'
|
||||
})
|
||||
class ClaimTestMissingInputDirectiveComponent {
|
||||
|
||||
}
|
||||
class ClaimTestMissingInputDirectiveComponent {}
|
||||
|
||||
@Component({
|
||||
selector: 'adf-claim-no-taskid-validation-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);
|
||||
});
|
||||
@@ -119,6 +109,6 @@ describe('Claim Task Directive validation errors', () => {
|
||||
it('should throw error when taskId is not set', () => {
|
||||
fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent);
|
||||
|
||||
expect( () => fixture.detectChanges()).toThrowError('Attribute taskId is required');
|
||||
expect(() => fixture.detectChanges()).toThrowError('Attribute taskId is required');
|
||||
});
|
||||
});
|
||||
|
@@ -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 {}
|
||||
|
Reference in New Issue
Block a user