mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
[ADF-3684] not autoselect first process in start process when multi process are present in an app
fix failing unit test
This commit is contained in:
parent
7f448d78d1
commit
ddbb5b3d65
@ -152,7 +152,7 @@ describe('ContentMetadataCardComponent', () => {
|
|||||||
|
|
||||||
const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]'));
|
const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]'));
|
||||||
|
|
||||||
expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.MORE_INFORMATION');
|
expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.LESS_INFORMATION');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should have the proper text on button while collapsed', () => {
|
it('should have the proper text on button while collapsed', () => {
|
||||||
@ -161,7 +161,7 @@ describe('ContentMetadataCardComponent', () => {
|
|||||||
|
|
||||||
const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]'));
|
const buttonLabel = fixture.debugElement.query(By.css('[data-automation-id="meta-data-card-toggle-expand-label"]'));
|
||||||
|
|
||||||
expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.LESS_INFORMATION');
|
expect(buttonLabel.nativeElement.innerText.trim()).toBe('ADF_VIEWER.SIDEBAR.METADATA.MORE_INFORMATION');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should hide the edit button in readOnly is true', () => {
|
it('should hide the edit button in readOnly is true', () => {
|
||||||
|
@ -284,6 +284,16 @@ describe('StartFormComponent', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should not select automatically any processDefinition if the app contain multiple process and does not have any processDefinition as input', async(() => {
|
||||||
|
getDefinitionsSpy = getDefinitionsSpy.and.returnValue(of(testMultipleProcessDefs));
|
||||||
|
component.appId = 123;
|
||||||
|
component.ngOnChanges({});
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(component.selectedProcessDef.name).toBeNull();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
describe('dropdown', () => {
|
describe('dropdown', () => {
|
||||||
|
|
||||||
it('should hide the process dropdown button if showSelectProcessDropdown is false', async(() => {
|
it('should hide the process dropdown button if showSelectProcessDropdown is false', async(() => {
|
||||||
|
@ -135,13 +135,15 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _filter(value: string): ProcessDefinitionRepresentation[] {
|
private _filter(value: string): ProcessDefinitionRepresentation[] {
|
||||||
const filterValue = value.toLowerCase();
|
if (value !== null && value !== undefined) {
|
||||||
let filteredProcess = this.processDefinitions.filter(option => option.name.toLowerCase().includes(filterValue));
|
const filterValue = value.toLowerCase();
|
||||||
|
let filteredProcess = this.processDefinitions.filter(option => option.name.toLowerCase().includes(filterValue));
|
||||||
|
|
||||||
if (this.processFilterSelector) {
|
if (this.processFilterSelector) {
|
||||||
this.selectedProcessDef = this.getSelectedProcess(filterValue);
|
this.selectedProcessDef = this.getSelectedProcess(filterValue);
|
||||||
|
}
|
||||||
|
return filteredProcess;
|
||||||
}
|
}
|
||||||
return filteredProcess;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSelectedProcess(selectedProcess) {
|
getSelectedProcess(selectedProcess) {
|
||||||
@ -162,7 +164,10 @@ export class StartProcessInstanceComponent implements OnChanges, OnInit {
|
|||||||
this.processDefinitions = processDefinitionRepresentations;
|
this.processDefinitions = processDefinitionRepresentations;
|
||||||
|
|
||||||
if (!this.isProcessDefinitionsEmpty()) {
|
if (!this.isProcessDefinitionsEmpty()) {
|
||||||
this.selectedProcessDef = this.processDefinitions[0];
|
|
||||||
|
if (this.processDefinitions.length == 1) {
|
||||||
|
this.selectedProcessDef = this.processDefinitions[0];
|
||||||
|
}
|
||||||
|
|
||||||
if (this.processDefinitionName) {
|
if (this.processDefinitionName) {
|
||||||
let selectedProcess = this.processDefinitions.find((currentProcessDefinition) => {
|
let selectedProcess = this.processDefinitions.find((currentProcessDefinition) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user