mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-19 17:14:57 +00:00
Fix select current process (#2601)
This commit is contained in:
parent
861d44f021
commit
189bc6513d
@ -199,6 +199,26 @@ describe('ProcessInstanceListComponent', () => {
|
|||||||
expect(component.getCurrentId()).toBeNull();
|
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(() => {
|
it('should throw an exception when the response is wrong', fakeAsync(() => {
|
||||||
let emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
|
let emitSpy: jasmine.Spy = spyOn(component.error, 'emit');
|
||||||
let fakeError = 'Fake server error';
|
let fakeError = 'Fake server error';
|
||||||
|
@ -198,6 +198,7 @@ export class ProcessInstanceListComponent implements OnChanges, AfterContentInit
|
|||||||
selectFirst() {
|
selectFirst() {
|
||||||
if (!this.isListEmpty()) {
|
if (!this.isListEmpty()) {
|
||||||
let row = this.data.getRows()[0];
|
let row = this.data.getRows()[0];
|
||||||
|
row.isSelected = true;
|
||||||
this.data.selectedRow = row;
|
this.data.selectedRow = row;
|
||||||
this.currentInstanceId = row.getValue('id');
|
this.currentInstanceId = row.getValue('id');
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user