mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[NO_ISSUE] - fix unit test on process-services (#4732)
* [NO_ISSUE] - fix unit test on process-services * [NO_ISSUE] - lint * remove unused code
This commit is contained in:
@@ -23,6 +23,7 @@ import { startFormAmountWidgetMock, startFormNumberWidgetMock, startFormRadioBut
|
|||||||
import { StartFormComponent } from './start-form.component';
|
import { StartFormComponent } from './start-form.component';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { FormService, WidgetVisibilityService, setupTestBed, CoreModule, FormModel, FormOutcomeModel } from '@alfresco/adf-core';
|
import { FormService, WidgetVisibilityService, setupTestBed, CoreModule, FormModel, FormOutcomeModel } from '@alfresco/adf-core';
|
||||||
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
|
||||||
describe('StartFormComponent', () => {
|
describe('StartFormComponent', () => {
|
||||||
|
|
||||||
@@ -31,6 +32,7 @@ describe('StartFormComponent', () => {
|
|||||||
let fixture: ComponentFixture<StartFormComponent>;
|
let fixture: ComponentFixture<StartFormComponent>;
|
||||||
let getStartFormSpy: jasmine.Spy;
|
let getStartFormSpy: jasmine.Spy;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
|
let translate: TranslateService;
|
||||||
|
|
||||||
const exampleId1 = 'my:process1';
|
const exampleId1 = 'my:process1';
|
||||||
const exampleId2 = 'my:process2';
|
const exampleId2 = 'my:process2';
|
||||||
@@ -51,10 +53,14 @@ describe('StartFormComponent', () => {
|
|||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
formService = TestBed.get(FormService);
|
formService = TestBed.get(FormService);
|
||||||
visibilityService = TestBed.get(WidgetVisibilityService);
|
visibilityService = TestBed.get(WidgetVisibilityService);
|
||||||
|
translate = TestBed.get(TranslateService);
|
||||||
|
|
||||||
getStartFormSpy = spyOn(formService, 'getStartFormDefinition').and.returnValue(of({
|
getStartFormSpy = spyOn(formService, 'getStartFormDefinition').and.returnValue(of({
|
||||||
processDefinitionName: 'my:process'
|
processDefinitionName: 'my:process'
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
spyOn(translate, 'instant').and.callFake((key) => { return key; });
|
||||||
|
spyOn(translate, 'get').and.callFake((key) => { return of(key); });
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
@@ -297,9 +303,15 @@ describe('StartFormComponent', () => {
|
|||||||
expect(inputElement).toBeDefined();
|
expect(inputElement).toBeDefined();
|
||||||
expect(dateElement).toBeDefined();
|
expect(dateElement).toBeDefined();
|
||||||
expect(selectElement).toBeDefined();
|
expect(selectElement).toBeDefined();
|
||||||
expect(inputLabelElement.innerText).toBe('ClientName*');
|
translate.get(inputLabelElement.textContent).subscribe( (value) => {
|
||||||
expect(dateLabelElement.innerText).toBe('BillDate (D-M-YYYY)');
|
expect(value).toBe('ClientName*');
|
||||||
expect(selectLabelElement.innerText).toBe('ClaimType');
|
});
|
||||||
|
translate.get(dateLabelElement.innerText).subscribe( (value) => {
|
||||||
|
expect(value).toBe('BillDate (D-M-YYYY)');
|
||||||
|
});
|
||||||
|
translate.get(selectLabelElement.innerText).subscribe( (value) => {
|
||||||
|
expect(value).toBe('ClaimType');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -319,7 +331,9 @@ describe('StartFormComponent', () => {
|
|||||||
const selectLabelElement = fixture.debugElement.nativeElement.querySelector('.adf-dropdown-widget > .adf-label');
|
const selectLabelElement = fixture.debugElement.nativeElement.querySelector('.adf-dropdown-widget > .adf-label');
|
||||||
expect(refreshElement).toBeDefined();
|
expect(refreshElement).toBeDefined();
|
||||||
expect(selectElement).toBeDefined();
|
expect(selectElement).toBeDefined();
|
||||||
expect(selectLabelElement.innerText).toBe('ClaimType');
|
translate.get(selectLabelElement.innerText).subscribe( (value) => {
|
||||||
|
expect(value).toBe('ClaimType');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user