mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Add Structural component unit test
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
/*!
|
||||||
|
* @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 subProcess = {
|
||||||
|
id: 'sid-C05B7CB7-1CFD-4AE4-9E01-C2C91E35E5A7',
|
||||||
|
type: 'SubProcess',
|
||||||
|
width: 300,
|
||||||
|
height: 200,
|
||||||
|
x: 40,
|
||||||
|
y: 30,
|
||||||
|
properties: [{}]
|
||||||
|
};
|
||||||
|
|
||||||
|
export let eventSubProcess = {
|
||||||
|
id: 'sid-C05B7CB7-1CFD-4AE4-9E01-C2C91E35E5A7',
|
||||||
|
type: 'EventSubProcess',
|
||||||
|
width: 300,
|
||||||
|
height: 200,
|
||||||
|
x: 40,
|
||||||
|
y: 30,
|
||||||
|
properties: [{}]
|
||||||
|
};
|
@@ -30,6 +30,7 @@ import * as diagramsGatewaysMock from '../assets/diagramGateways.mock';
|
|||||||
import * as intermediateCatchingMock from '../assets/diagramIntermediate.mock';
|
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';
|
||||||
|
|
||||||
declare let jasmine: any;
|
declare let jasmine: any;
|
||||||
|
|
||||||
@@ -1109,4 +1110,52 @@ describe('Test ng2-activiti-diagrams ', () => {
|
|||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Diagrams component Structural: ', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
jasmine.Ajax.install();
|
||||||
|
component.processDefinitionId = 'fakeprocess:24:38399';
|
||||||
|
component.metricPercentages = {startEvent: 0};
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jasmine.Ajax.uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('Should render the Subprocess', async(() => {
|
||||||
|
component.onSuccess.subscribe((res) => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(res).not.toBeNull();
|
||||||
|
let shape: any = element.querySelector('diagram-subprocess > raphael-rect');
|
||||||
|
expect(shape).not.toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
component.ngOnChanges();
|
||||||
|
let resp = {elements: [structuralMock.subProcess]};
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'json',
|
||||||
|
responseText: resp
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('Should render the Event Subprocess', async(() => {
|
||||||
|
component.onSuccess.subscribe((res) => {
|
||||||
|
fixture.detectChanges();
|
||||||
|
fixture.whenStable().then(() => {
|
||||||
|
expect(res).not.toBeNull();
|
||||||
|
let shape: any = element.querySelector('diagram-event-subprocess > raphael-rect');
|
||||||
|
expect(shape).not.toBeNull();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
component.ngOnChanges();
|
||||||
|
let resp = {elements: [structuralMock.eventSubProcess]};
|
||||||
|
jasmine.Ajax.requests.mostRecent().respondWith({
|
||||||
|
status: 200,
|
||||||
|
contentType: 'json',
|
||||||
|
responseText: resp
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user