mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2188] Start Process - Change processDefinition property and fix bug (#2884)
* Change processDefinition property and fix bug * Fix unit test * Fix async * Fix id
This commit is contained in:
committed by
Eugenio Romano
parent
abca6e481d
commit
657c28491a
@@ -274,7 +274,7 @@ describe('StartFormComponent', () => {
|
||||
it('should select processDefinition based on processDefinition input', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of(testMultipleProcessDefs));
|
||||
component.appId = 123;
|
||||
component.processDefinition = 'My Process 2';
|
||||
component.processDefinitionName = 'My Process 2';
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -292,16 +292,6 @@ describe('StartFormComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should select automatically the first processDefinition if the app contain multiple process and there is no processDefinition in input', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of(testMultipleProcessDefs));
|
||||
component.appId = 123;
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(component.selectedProcessDef.name).toBe(JSON.parse(JSON.stringify(testMultipleProcessDefs[0])).name);
|
||||
});
|
||||
}));
|
||||
|
||||
describe('dropdown', () => {
|
||||
|
||||
it('should hide the process dropdown if showSelectProcessDropdown is false', async(() => {
|
||||
@@ -319,7 +309,7 @@ describe('StartFormComponent', () => {
|
||||
it('should show the process dropdown if showSelectProcessDropdown is false', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of(testMultipleProcessDefs));
|
||||
component.appId = 123;
|
||||
component.processDefinition = 'My Process 2';
|
||||
component.processDefinitionName = 'My Process 2';
|
||||
component.showSelectProcessDropdown = true;
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
@@ -332,7 +322,7 @@ describe('StartFormComponent', () => {
|
||||
it('should show the process dropdown by default', async(() => {
|
||||
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(Observable.of(testMultipleProcessDefs));
|
||||
component.appId = 123;
|
||||
component.processDefinition = 'My Process 2';
|
||||
component.processDefinitionName = 'My Process 2';
|
||||
component.ngOnChanges({});
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
@@ -454,14 +444,18 @@ describe('StartFormComponent', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('should emit start event when start select a process and add a name', () => {
|
||||
it('should emit start event when start select a process and add a name', async(() => {
|
||||
let startSpy: jasmine.Spy = spyOn(component.start, 'emit');
|
||||
component.selectedProcessDef.id = '1001';
|
||||
component.selectedProcessDef = testProcessDefRepr;
|
||||
component.name = 'my:Process';
|
||||
component.startProcess();
|
||||
fixture.detectChanges();
|
||||
expect(startSpy).toHaveBeenCalled();
|
||||
});
|
||||
fixture.whenStable().then(() => {
|
||||
let startButton = fixture.nativeElement.querySelector('#button-start');
|
||||
startButton.click();
|
||||
expect(startSpy).toHaveBeenCalled();
|
||||
});
|
||||
}));
|
||||
|
||||
it('should not emit start event when start the process without select a process and name', () => {
|
||||
component.name = null;
|
||||
|
Reference in New Issue
Block a user