test(project): make sinon an allowed global

This commit is contained in:
Nico Rehwaldt 2019-12-01 13:21:06 +01:00 committed by Philipp Fromme
parent a66e9a5c8d
commit 1b576cda17
15 changed files with 22 additions and 50 deletions

5
test/spec/.eslintrc Normal file
View File

@ -0,0 +1,5 @@
{
"globals": {
"sinon": true
}
}

View File

@ -1574,7 +1574,6 @@ describe('Viewer', function() {
// assume // assume
expect(viewer._container.parentNode).not.to.exist; expect(viewer._container.parentNode).not.to.exist;
/* global sinon */
var resizedSpy = sinon.spy(); var resizedSpy = sinon.spy();
viewer.on('canvas.resized', resizedSpy); viewer.on('canvas.resized', resizedSpy);

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject

View File

@ -27,8 +27,6 @@ import {
is is
} from 'lib/util/ModelUtil'; } from 'lib/util/ModelUtil';
/* global sinon */
describe('features/copy-paste', function() { describe('features/copy-paste', function() {

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapViewer, bootstrapViewer,
inject inject

View File

@ -6,8 +6,6 @@ import {
import modelingModule from 'lib/features/modeling'; import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core'; import coreModule from 'lib/core';
/* global sinon */
var testModules = [ modelingModule, coreModule ]; var testModules = [ modelingModule, coreModule ];

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject
@ -15,10 +13,9 @@ var testModules = [
coreModule coreModule
]; ];
var spy = sinon.spy;
var ATTACH = { attach: true }; var ATTACH = { attach: true };
describe('modeling/behavior - AdaptiveLabelPositioningBehavior', function() { describe('modeling/behavior - AdaptiveLabelPositioningBehavior', function() {
function expectLabelOrientation(element, expectedOrientation) { function expectLabelOrientation(element, expectedOrientation) {
@ -431,7 +428,7 @@ describe('modeling/behavior - AdaptiveLabelPositioningBehavior', function() {
var exclusiveGateway = elementRegistry.get('ExclusiveGateway_1'), var exclusiveGateway = elementRegistry.get('ExclusiveGateway_1'),
endEvent = elementRegistry.get('EndEvent_1'); endEvent = elementRegistry.get('EndEvent_1');
var moveShapeSpy = spy(modeling, 'moveShape'); var moveShapeSpy = sinon.spy(modeling, 'moveShape');
// when // when
copyPaste.copy([ exclusiveGateway, endEvent ]); copyPaste.copy([ exclusiveGateway, endEvent ]);

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject

View File

@ -13,9 +13,6 @@ import bendpointsModule from 'diagram-js/lib/features/bendpoints';
import { createCanvasEvent as canvasEvent } from '../../../../util/MockEvents'; import { createCanvasEvent as canvasEvent } from '../../../../util/MockEvents';
/* global sinon */
var spy = sinon.spy;
var testModules = [ var testModules = [
coreModule, coreModule,
createModule, createModule,
@ -238,7 +235,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_lanes = elementRegistry.get('Participant_Lanes'); var participant_lanes = elementRegistry.get('Participant_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.context.startTarget).to.eql(participant_lanes); expect(event.context.startTarget).to.eql(participant_lanes);
}); });
@ -266,7 +263,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_lanes = elementRegistry.get('Participant_Lanes'); var participant_lanes = elementRegistry.get('Participant_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.hover).to.eql(participant_lanes); expect(event.hover).to.eql(participant_lanes);
}); });
@ -293,7 +290,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_lanes = elementRegistry.get('Participant_Lanes'); var participant_lanes = elementRegistry.get('Participant_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.hover).to.eql(participant_lanes); expect(event.hover).to.eql(participant_lanes);
}); });
@ -328,7 +325,7 @@ describe('features/modeling/behavior - fix hover', function() {
var messageFlow = elementRegistry.get('MessageFlow_2'); var messageFlow = elementRegistry.get('MessageFlow_2');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.context.hover).to.equal(participant_lanes); expect(event.context.hover).to.equal(participant_lanes);
}); });
@ -356,7 +353,7 @@ describe('features/modeling/behavior - fix hover', function() {
var messageFlow = elementRegistry.get('MessageFlow_1'); var messageFlow = elementRegistry.get('MessageFlow_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.context.target).to.eql(participant_lanes); expect(event.context.target).to.eql(participant_lanes);
}); });
@ -387,7 +384,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_no_lanes = elementRegistry.get('Participant_No_Lanes'); var participant_no_lanes = elementRegistry.get('Participant_No_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.context.source).to.eql(participant_lanes); expect(event.context.source).to.eql(participant_lanes);
}); });
@ -416,7 +413,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_no_lanes = elementRegistry.get('Participant_No_Lanes'); var participant_no_lanes = elementRegistry.get('Participant_No_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
var context = event.context, var context = event.context,
target = context.target; target = context.target;
@ -450,7 +447,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_no_lanes = elementRegistry.get('Participant_No_Lanes'); var participant_no_lanes = elementRegistry.get('Participant_No_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.hover).to.eql(participant_lanes); expect(event.hover).to.eql(participant_lanes);
}); });
@ -478,7 +475,7 @@ describe('features/modeling/behavior - fix hover', function() {
var participant_no_lanes = elementRegistry.get('Participant_No_Lanes'); var participant_no_lanes = elementRegistry.get('Participant_No_Lanes');
var lane_1 = elementRegistry.get('Lane_1'); var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) { var connectSpy = sinon.spy(function(event) {
expect(event.hover).to.eql(participant_lanes); expect(event.hover).to.eql(participant_lanes);
}); });
@ -531,7 +528,7 @@ describe('features/modeling/behavior - fix hover', function() {
var rootElement = canvas.getRootElement(), var rootElement = canvas.getRootElement(),
rootElementGfx = canvas.getGraphics(rootElement); rootElementGfx = canvas.getGraphics(rootElement);
var moveEndSpy = spy(function(event) { var moveEndSpy = sinon.spy(function(event) {
expect(event.context.shape).to.equal(participant); expect(event.context.shape).to.equal(participant);
}); });

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject
@ -22,8 +20,6 @@ import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core'; import coreModule from 'lib/core';
import gridSnappingModule from 'lib/features/grid-snapping'; import gridSnappingModule from 'lib/features/grid-snapping';
var spy = sinon.spy;
describe('behavior - LabelBehavior', function() { describe('behavior - LabelBehavior', function() {
@ -209,7 +205,7 @@ describe('behavior - LabelBehavior', function() {
// given // given
var parentShape = elementRegistry.get('Process_1'); var parentShape = elementRegistry.get('Process_1');
var createLabelSpy = spy(modeling, 'createLabel'); var createLabelSpy = sinon.spy(modeling, 'createLabel');
var exclusiveGatewayBo = bpmnFactory.create('bpmn:ExclusiveGateway', { var exclusiveGatewayBo = bpmnFactory.create('bpmn:ExclusiveGateway', {
name: 'Foo' name: 'Foo'

View File

@ -1,5 +1,3 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
getBpmnJS, getBpmnJS,
@ -26,8 +24,6 @@ import { is } from 'lib/util/ModelUtil';
import { isExpanded } from 'lib/util/DiUtil'; import { isExpanded } from 'lib/util/DiUtil';
var spy = sinon.spy;
describe('features/popup-menu - replace menu provider', function() { describe('features/popup-menu - replace menu provider', function() {
@ -1685,7 +1681,7 @@ describe('features/popup-menu - replace menu provider', function() {
// given // given
var subProcess = elementRegistry.get('SubProcess_1'); var subProcess = elementRegistry.get('SubProcess_1');
var resizeShapeSpy = spy(modeling, 'resizeShape'); var resizeShapeSpy = sinon.spy(modeling, 'resizeShape');
// when // when
openPopup(subProcess); openPopup(subProcess);
@ -1702,7 +1698,7 @@ describe('features/popup-menu - replace menu provider', function() {
// given // given
var subProcess = elementRegistry.get('SubProcess_1'); var subProcess = elementRegistry.get('SubProcess_1');
var layoutConnectionSpy = spy(modeling, 'layoutConnection'); var layoutConnectionSpy = sinon.spy(modeling, 'layoutConnection');
// when // when
openPopup(subProcess); openPopup(subProcess);
@ -1722,7 +1718,7 @@ describe('features/popup-menu - replace menu provider', function() {
// given // given
var adhocSubProcess = elementRegistry.get('AdhocSubProcess_1'); var adhocSubProcess = elementRegistry.get('AdhocSubProcess_1');
var resizeShapeSpy = spy(modeling, 'resizeShape'); var resizeShapeSpy = sinon.spy(modeling, 'resizeShape');
// when // when
openPopup(adhocSubProcess); openPopup(adhocSubProcess);
@ -1739,7 +1735,7 @@ describe('features/popup-menu - replace menu provider', function() {
// given // given
var adhocSubProcess = elementRegistry.get('AdhocSubProcess_1'); var adhocSubProcess = elementRegistry.get('AdhocSubProcess_1');
var layoutConnectionSpy = spy(modeling, 'layoutConnection'); var layoutConnectionSpy = sinon.spy(modeling, 'layoutConnection');
// when // when
openPopup(adhocSubProcess); openPopup(adhocSubProcess);

View File

@ -1,5 +1,3 @@
/* global sinon */
import BpmnTreeWalker from 'lib/import/BpmnTreeWalker'; import BpmnTreeWalker from 'lib/import/BpmnTreeWalker';
import BpmnModdle from 'bpmn-moddle'; import BpmnModdle from 'bpmn-moddle';