mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Add swimlanes component unit test
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
/*!
|
||||||
|
* @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 pool = {
|
||||||
|
id: 'sid-0FF10DA3-E2BD-4E6A-9013-6D66FC8A4716',
|
||||||
|
name: 'Activiti',
|
||||||
|
width: 600,
|
||||||
|
height: 500,
|
||||||
|
x: 60,
|
||||||
|
y: 45,
|
||||||
|
properties: [{}]
|
||||||
|
};
|
||||||
|
|
||||||
|
export let poolLanes = {
|
||||||
|
id: 'sid-0FF10DA3-E2BD-4E6A-9013-6D66FC8A4716',
|
||||||
|
name: 'Activiti',
|
||||||
|
width: 600,
|
||||||
|
height: 500,
|
||||||
|
x: 60,
|
||||||
|
y: 45,
|
||||||
|
lanes: [{
|
||||||
|
id: 'sid-332204AB-D0F8-44CD-87B3-BF9DF59FF8AB',
|
||||||
|
name: 'Beckend',
|
||||||
|
width: 570,
|
||||||
|
height: 250,
|
||||||
|
x: 90,
|
||||||
|
y: 45
|
||||||
|
}],
|
||||||
|
properties: [{}]
|
||||||
|
};
|
@@ -31,6 +31,7 @@ import * as intermediateCatchingMock from '../assets/diagramIntermediate.mock';
|
|||||||
import * as boundaryEventMock from '../assets/diagramBoundary.mock';
|
import * as boundaryEventMock from '../assets/diagramBoundary.mock';
|
||||||
import * as throwEventMock from '../assets/diagramThrow.mock';
|
import * as throwEventMock from '../assets/diagramThrow.mock';
|
||||||
import * as structuralMock from '../assets/diagramStructural.mock';
|
import * as structuralMock from '../assets/diagramStructural.mock';
|
||||||
|
import * as swimLanesMock from '../assets/diagramSwimlanes.mock';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
@@ -1158,4 +1159,63 @@ describe('Test ng2-activiti-diagrams ', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Diagrams component Swim lane: ', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jasmine.Ajax.install();
|
||||||
|
component.processDefinitionId = 'fakeprocess:24:38399';
|
||||||
|
component.metricPercentages = {startEvent: 0};
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jasmine.Ajax.uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should render the Pool', async(() => {
|
||||||
|
component.onSuccess.subscribe((res) => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(res).not.toBeNull();
|
||||||
|
let shape: any = element.querySelector('diagram-pool > raphael-rect');
|
||||||
|
expect(shape).not.toBeNull();
|
||||||
|
|
||||||
|
let shapeText: any = element.querySelector('diagram-pool > raphael-text');
|
||||||
|
expect(shapeText).not.toBeNull();
|
||||||
|
expect(shapeText.attributes[2].value).toEqual('Activiti');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
component.ngOnChanges();
|
||||||
|
let resp = {pools: [swimLanesMock.pool]};
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'json',
|
||||||
|
responseText: resp
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('Should render the Pool with Lanes', async(() => {
|
||||||
|
component.onSuccess.subscribe((res) => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(res).not.toBeNull();
|
||||||
|
let shapeLane: any = element.querySelector('diagram-lanes > div > div > diagram-lane');
|
||||||
|
expect(shapeLane).not.toBeNull();
|
||||||
|
|
||||||
|
let shapeRect: any = element.querySelector('diagram-lanes > div > div > diagram-lane > raphael-rect');
|
||||||
|
expect(shapeRect).not.toBeNull();
|
||||||
|
|
||||||
|
let shapeText: any = element.querySelector('diagram-lanes > div > div > diagram-lane > raphael-text');
|
||||||
|
expect(shapeText).not.toBeNull();
|
||||||
|
expect(shapeText.attributes[2].value).toEqual('Beckend');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
component.ngOnChanges();
|
||||||
|
let resp = {pools: [swimLanesMock.poolLanes]};
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'json',
|
||||||
|
responseText: resp
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user