mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
#1301 - fixed test on activiti form
This commit is contained in:
parent
12c4de2c1e
commit
e92abf99d9
@ -28,18 +28,17 @@ describe('ActivitiForm', () => {
|
|||||||
let componentHandler: any;
|
let componentHandler: any;
|
||||||
let formService: FormService;
|
let formService: FormService;
|
||||||
let formComponent: ActivitiForm;
|
let formComponent: ActivitiForm;
|
||||||
let visibilityService: WidgetVisibilityService;
|
let visibilityService: WidgetVisibilityService;
|
||||||
let nodeService: NodeService;
|
let nodeService: NodeService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
componentHandler = jasmine.createSpyObj('componentHandler', [
|
componentHandler = jasmine.createSpyObj('componentHandler', [
|
||||||
'upgradeAllRegistered'
|
'upgradeAllRegistered'
|
||||||
]);
|
]);
|
||||||
visibilityService = jasmine.createSpyObj('WidgetVisibilityService', [
|
|
||||||
'refreshVisibility', 'getTaskProcessVariable'
|
|
||||||
]);
|
|
||||||
window['componentHandler'] = componentHandler;
|
window['componentHandler'] = componentHandler;
|
||||||
|
|
||||||
|
visibilityService = new WidgetVisibilityService(null);
|
||||||
|
spyOn(visibilityService, 'refreshVisibility').and.stub();
|
||||||
formService = new FormService(null, null);
|
formService = new FormService(null, null);
|
||||||
nodeService = new NodeService(null, null);
|
nodeService = new NodeService(null, null);
|
||||||
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService);
|
formComponent = new ActivitiForm(formService, visibilityService, null, nodeService);
|
||||||
@ -139,6 +138,7 @@ describe('ActivitiForm', () => {
|
|||||||
|
|
||||||
it('should get form by task id on load', () => {
|
it('should get form by task id on load', () => {
|
||||||
spyOn(formComponent, 'getFormByTaskId').and.stub();
|
spyOn(formComponent, 'getFormByTaskId').and.stub();
|
||||||
|
spyOn(visibilityService, 'getTaskProcessVariable').and.returnValue(Observable.of({}));
|
||||||
const taskId = '123';
|
const taskId = '123';
|
||||||
|
|
||||||
formComponent.taskId = taskId;
|
formComponent.taskId = taskId;
|
||||||
@ -218,7 +218,7 @@ describe('ActivitiForm', () => {
|
|||||||
spyOn(formComponent, 'getFormDefinitionByFormId').and.stub();
|
spyOn(formComponent, 'getFormDefinitionByFormId').and.stub();
|
||||||
spyOn(formComponent, 'getFormDefinitionByFormName').and.stub();
|
spyOn(formComponent, 'getFormDefinitionByFormName').and.stub();
|
||||||
|
|
||||||
formComponent.ngOnChanges({ 'tag': new SimpleChange(null, 'hello world')});
|
formComponent.ngOnChanges({ 'tag': new SimpleChange(null, 'hello world') });
|
||||||
|
|
||||||
expect(formComponent.getFormByTaskId).not.toHaveBeenCalled();
|
expect(formComponent.getFormByTaskId).not.toHaveBeenCalled();
|
||||||
expect(formComponent.getFormDefinitionByFormId).not.toHaveBeenCalled();
|
expect(formComponent.getFormDefinitionByFormId).not.toHaveBeenCalled();
|
||||||
@ -521,10 +521,10 @@ describe('ActivitiForm', () => {
|
|||||||
|
|
||||||
it('should complete form form and raise corresponding event', () => {
|
it('should complete form form and raise corresponding event', () => {
|
||||||
spyOn(formService, 'completeTaskForm').and.callFake(() => {
|
spyOn(formService, 'completeTaskForm').and.callFake(() => {
|
||||||
return Observable.create(observer => {
|
return Observable.create(observer => {
|
||||||
observer.next();
|
observer.next();
|
||||||
observer.complete();
|
observer.complete();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const outcome = 'complete';
|
const outcome = 'complete';
|
||||||
@ -572,17 +572,17 @@ describe('ActivitiForm', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
/*
|
/*
|
||||||
it('should update the visibility when the container raise the change event', (valueChanged) => {
|
it('should update the visibility when the container raise the change event', (valueChanged) => {
|
||||||
spyOn(formComponent, 'checkVisibility').and.callThrough();
|
spyOn(formComponent, 'checkVisibility').and.callThrough();
|
||||||
let widget = new ContainerWidget();
|
let widget = new ContainerWidget();
|
||||||
let fakeForm = new FormModel();
|
let fakeForm = new FormModel();
|
||||||
let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'});
|
let fakeField = new FormFieldModel(fakeForm, {id: 'fakeField', value: 'fakeValue'});
|
||||||
widget.formValueChanged.subscribe(field => { valueChanged(); });
|
widget.formValueChanged.subscribe(field => { valueChanged(); });
|
||||||
widget.fieldChanged(fakeField);
|
widget.fieldChanged(fakeField);
|
||||||
|
|
||||||
expect(formComponent.checkVisibility).toHaveBeenCalledWith(fakeField);
|
expect(formComponent.checkVisibility).toHaveBeenCalledWith(fakeField);
|
||||||
});
|
});
|
||||||
*/
|
*/
|
||||||
|
|
||||||
it('should prevent default outcome execution', () => {
|
it('should prevent default outcome execution', () => {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user