diff --git a/lib/features/modeling/rules/ModelingRules.js b/lib/features/modeling/rules/ModelingRules.js index 56b620c3..41bf55a8 100644 --- a/lib/features/modeling/rules/ModelingRules.js +++ b/lib/features/modeling/rules/ModelingRules.js @@ -208,6 +208,12 @@ ModelingRules.prototype.init = function() { return true; } + if (businessObject.$instanceOf('bpmn:Association') && + targetBusinessObject.$instanceOf('bpmn:FlowElementsContainer')) { + + return true; + } + return false; } diff --git a/test/fixtures/bpmn/features/rules/text-annotation-association.bpmn b/test/fixtures/bpmn/features/rules/text-annotation-association.bpmn new file mode 100644 index 00000000..808d9fda --- /dev/null +++ b/test/fixtures/bpmn/features/rules/text-annotation-association.bpmn @@ -0,0 +1,30 @@ + + + + + + A label + + + + + + + + + + + + + + + + + + diff --git a/test/spec/features/rules/ModelingRulesSpec.js b/test/spec/features/rules/ModelingRulesSpec.js index cb077cff..c3d65ade 100644 --- a/test/spec/features/rules/ModelingRulesSpec.js +++ b/test/spec/features/rules/ModelingRulesSpec.js @@ -1,12 +1,9 @@ 'use strict'; -var Matchers = require('../../../Matchers'), -TestHelper = require('../../../TestHelper'); +var Matchers = require('../../../Matchers'); /* global bootstrapModeler, inject */ -var _ = require('lodash'); - var fs = require('fs'); var modelingModule = require('../../../../lib/features/modeling'), @@ -23,6 +20,7 @@ describe('features/ModelingRules', function() { var eventGatewaysEdgeXML = fs.readFileSync('test/fixtures/bpmn/features/rules/event-based-gateway-outgoing-edge.bpmn', 'utf8'); var linkEventXML = fs.readFileSync('test/fixtures/bpmn/features/rules/link-event.bpmn', 'utf8'); + var textAnnotationXML = fs.readFileSync('test/fixtures/bpmn/features/rules/text-annotation-association.bpmn', 'utf8'); var testModules = [ coreModule, modelingModule, rulesModule ]; @@ -278,4 +276,26 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(true); })); }); + + describe('Association', function() { + + beforeEach(bootstrapModeler(textAnnotationXML, { modules: testModules })); + + it('should allow drop on process', inject(function(elementRegistry, rules) { + + // given + var association = elementRegistry.get('Association_1'), + parent = elementRegistry.get('Process_1'); + + // when + var allowed = rules.allowed('shapes.move', { + connection: null, + shapes: [ association ], + newParent: parent + }); + + // then + expect(allowed).toBe(true); + })); + }); });