mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
Fix appId not mandatory (#2038)
This commit is contained in:
parent
2e03ef3548
commit
e33f6cf670
@ -78,12 +78,20 @@ describe('ActivitiStartProcessInstance', () => {
|
||||
|
||||
describe('process definitions list', () => {
|
||||
|
||||
it('should call service to fetch process definitions', () => {
|
||||
it('should call service to fetch process definitions with appId', () => {
|
||||
let change = new SimpleChange(null, '123', true);
|
||||
component.ngOnChanges({'appId': change});
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(getDefinitionsSpy).toHaveBeenCalled();
|
||||
expect(getDefinitionsSpy).toHaveBeenCalledWith('123');
|
||||
});
|
||||
|
||||
it('should call service to fetch process definitions without appId', () => {
|
||||
let change = new SimpleChange(null, null, true);
|
||||
component.ngOnChanges({'appId': change});
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(getDefinitionsSpy).toHaveBeenCalledWith(null);
|
||||
});
|
||||
|
||||
it('should call service to fetch process definitions with appId when provided', () => {
|
||||
@ -167,11 +175,6 @@ describe('ActivitiStartProcessInstance', () => {
|
||||
expect(getDefinitionsSpy).toHaveBeenCalledWith(null);
|
||||
});
|
||||
|
||||
it('should not reload processes when changes do not include appId input', () => {
|
||||
component.ngOnChanges({});
|
||||
expect(getDefinitionsSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('start process', () => {
|
||||
|
@ -65,14 +65,12 @@ export class ActivitiStartProcessInstance implements OnChanges {
|
||||
}
|
||||
|
||||
ngOnChanges(changes: SimpleChanges) {
|
||||
let appId = changes['appId'];
|
||||
if (appId && (appId.currentValue || appId.currentValue === null)) {
|
||||
this.load(appId.currentValue);
|
||||
return;
|
||||
}
|
||||
let appIdChange = changes['appId'];
|
||||
let appId = appIdChange ? appIdChange.currentValue : null;
|
||||
this.load(appId);
|
||||
}
|
||||
|
||||
public load(appId: string) {
|
||||
public load(appId?: string) {
|
||||
this.resetSelectedProcessDefinition();
|
||||
this.resetErrorMessage();
|
||||
this.activitiProcess.getProcessDefinitions(appId).subscribe(
|
||||
|
Loading…
x
Reference in New Issue
Block a user