| /* |
| ****************************************************************************** |
| * Copyright © 2018 PTA GmbH. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| ****************************************************************************** |
| */ |
| |
| |
| import { TestBed } from '@angular/core/testing'; |
| import { StepsAgGridConfiguration } from './steps-ag-grid-configuration'; |
| |
| describe('StepsAgGridConfiguration', () => { |
| |
| beforeEach(() => { |
| TestBed.configureTestingModule({ |
| }); |
| }); |
| |
| it('should provide the correct functions', (() => { |
| const configArray: any = StepsAgGridConfiguration.createColumnDefs(); |
| |
| const idSegment = configArray[1]; |
| expect(idSegment.field).toBe('sortorder'); |
| |
| const switchingObjectSegment = configArray[2]; |
| expect(switchingObjectSegment.field).toBe('switchingObject'); |
| |
| const sortOrderSegment = configArray[4]; |
| expect(sortOrderSegment.field).toBe('targetState'); |
| })); |
| |
| it('should provide the correct modeCellRenderer', (() => { |
| const configArray: any = (StepsAgGridConfiguration as any).modeCellRenderer( |
| { |
| context: |
| { |
| componentParent: |
| { |
| sessionContext: { |
| isLocked: function (data: any) { return true; } |
| }, |
| modeValidator: |
| { |
| isEditModeAllowed: function (data: any) { return true; } |
| }, |
| deleteStep: function (data: any) { return true; } |
| } |
| }, |
| params: {}, |
| data: { id: 1, sortorder: 1, switchingObject: 'Schalter 1', targetState: 'aus', singleGridmeasureId: 3, delete: false } |
| } |
| ); |
| |
| })); |
| |
| }); |