mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Add Flow component unit test
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/*!
|
||||
* @license
|
||||
* Copyright 2016 Alfresco Software, Ltd.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export let flow = {
|
||||
id: 'sid-5BA99724-A3BD-4F8E-B69F-222F9FF66335',
|
||||
sourceRef: 'startEvent1',
|
||||
targetRef: 'sid-811B9223-E72E-4991-AAA5-4E1A01095D08',
|
||||
type: 'sequenceFlow',
|
||||
waypoints: [{x: 165, y: 122}, {x: 210, y: 122}]
|
||||
};
|
@@ -32,6 +32,7 @@ import * as boundaryEventMock from '../assets/diagramBoundary.mock';
|
||||
import * as throwEventMock from '../assets/diagramThrow.mock';
|
||||
import * as structuralMock from '../assets/diagramStructural.mock';
|
||||
import * as swimLanesMock from '../assets/diagramSwimlanes.mock';
|
||||
import * as flowsMock from '../assets/diagramFlows.mock';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -1218,4 +1219,34 @@ describe('Test ng2-activiti-diagrams ', () => {
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('Diagrams component Flows: ', () => {
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
component.processDefinitionId = 'fakeprocess:24:38399';
|
||||
component.metricPercentages = {startEvent: 0};
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
});
|
||||
|
||||
it('Should render the flow', async(() => {
|
||||
component.onSuccess.subscribe((res) => {
|
||||
fixture.detectChanges();
|
||||
fixture.whenStable().then(() => {
|
||||
expect(res).not.toBeNull();
|
||||
let shape: any = element.querySelector('diagram-sequence-flow > raphael-flow-arrow');
|
||||
expect(shape).not.toBeNull();
|
||||
});
|
||||
});
|
||||
component.ngOnChanges();
|
||||
let resp = {flows: [flowsMock.flow]};
|
||||
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||
status: 200,
|
||||
contentType: 'json',
|
||||
responseText: resp
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user