Comparing version 0.14.0 to 0.14.1
@@ -5,2 +5,3 @@ 'use strict'; | ||
any = require('lodash/collection/any'), | ||
filter = require('lodash/collection/filter'), | ||
forEach = require('lodash/collection/forEach'), | ||
@@ -95,2 +96,9 @@ inherits = require('inherits'); | ||
this.addRule([ 'elements.delete' ], function(context) { | ||
// do not allow deletion of labels | ||
return filter(context.elements, function(e) { | ||
return !isLabel(e); | ||
}); | ||
}); | ||
}; | ||
@@ -97,0 +105,0 @@ |
{ | ||
"name": "bpmn-js", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"description": "A bpmn 2.0 toolkit and web modeler", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -67,3 +67,3 @@ 'use strict'; | ||
// given | ||
customRules.addRule('elements.delete', function() { | ||
customRules.addRule('elements.delete', 1500, function() { | ||
return true; | ||
@@ -86,3 +86,3 @@ }); | ||
// given | ||
customRules.addRule('elements.delete', function() { | ||
customRules.addRule('elements.delete', 1500, function() { | ||
return false; | ||
@@ -106,3 +106,3 @@ }); | ||
customRules.addRule('elements.delete', function(context) { | ||
customRules.addRule('elements.delete', 1500, function(context) { | ||
@@ -126,3 +126,3 @@ // element array is actually passed | ||
// given | ||
customRules.addRule('elements.delete', function(context) { | ||
customRules.addRule('elements.delete', 1500, function(context) { | ||
return context.elements; | ||
@@ -145,3 +145,3 @@ }); | ||
// given | ||
customRules.addRule('elements.delete', function() { | ||
customRules.addRule('elements.delete', 1500, function() { | ||
return []; | ||
@@ -148,0 +148,0 @@ }); |
@@ -1320,2 +1320,27 @@ 'use strict'; | ||
describe('labels', function() { | ||
var testXML = require('./BpmnRules.process.bpmn'); | ||
beforeEach(bootstrapModeler(testXML, { modules: testModules })); | ||
it('should filter labels', inject(function(elementRegistry, rules) { | ||
// given | ||
var startEventShape = elementRegistry.get('StartEvent_None'), | ||
startEventLabel = startEventShape.label; | ||
// when | ||
var allowed = rules.allowed('elements.delete', { | ||
elements: [ startEventShape, startEventLabel ] | ||
}); | ||
// then | ||
expect(allowed).to.eql([ startEventShape ]); | ||
})); | ||
}); | ||
}); |
@@ -377,6 +377,11 @@ 'use strict'; | ||
var diagramXML = require('./BpmnSnapping.subProcess-resize.bpmn'); | ||
var testResizeModules = [ coreModule, resizeModule, rulesModule, snappingModule ]; | ||
var testResizeModules = [ | ||
coreModule, | ||
modelingModule, | ||
resizeModule, | ||
rulesModule, | ||
snappingModule | ||
]; | ||
@@ -403,6 +408,11 @@ beforeEach(bootstrapModeler(diagramXML, { modules: testResizeModules })); | ||
var diagramXML = require('./BpmnSnapping.textAnnotation-resize.bpmn'); | ||
var testResizeModules = [ coreModule, resizeModule, rulesModule, snappingModule ]; | ||
var testResizeModules = [ | ||
coreModule, | ||
modelingModule, | ||
resizeModule, | ||
rulesModule, | ||
snappingModule | ||
]; | ||
@@ -412,3 +422,3 @@ beforeEach(bootstrapModeler(diagramXML, { modules: testResizeModules })); | ||
it('should snap a TextAnnotation to minimum bounds', inject(function(elementRegistry, resize, dragging) { | ||
it('should snap to minimum bounds', inject(function(elementRegistry, resize, dragging) { | ||
@@ -415,0 +425,0 @@ var textAnnotation = elementRegistry.get('TextAnnotation'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1928340
21953