Fix select current process (#2601)

This commit is contained in:
Maurizio Vitale 2017-11-03 09:47:49 +00:00 committed by Eugenio Romano
parent 861d44f021
commit 189bc6513d
2 changed files with 21 additions and 0 deletions

View File

@ -199,6 +199,26 @@ describe('ProcessInstanceListComponent', () => {
expect(component.getCurrentId()).toBeNull();
});
it('should return selected true for the selected process', () => {
component.data = new ObjectDataTableAdapter(
[
{ id: '999', name: 'Fake-name' },
{ id: '888', name: 'Fake-name-888' }
],
[
{ type: 'text', key: 'id', title: 'Id' },
{ type: 'text', key: 'name', title: 'Name' }
]
);
component.selectFirst();
const dataRow = component.data.getRows();
expect(dataRow).toBeDefined();
expect(dataRow[0].getValue('id')).toEqual('999');
expect(dataRow[0].isSelected).toEqual(true);
expect(dataRow[1].getValue('id')).toEqual('888');
expect(dataRow[1].isSelected).toEqual(false);
});
it('should throw an exception when the response is wrong', fakeAsync(() => {
let emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
let fakeError = 'Fake server error';

View File

@ -198,6 +198,7 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit
selectFirst() {
if (!this.isListEmpty()) {
let row = this.data.getRows()[0];
row.isSelected = true;
this.data.selectedRow = row;
this.currentInstanceId = row.getValue('id');
} else {