Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ImplementationProps): don't remove empty properties #811

Merged
merged 1 commit into from
Nov 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function DecisionRef(props) {
element,
moddleElement: businessObject,
properties: {
'camunda:decisionRef': value
'camunda:decisionRef': value || ''
}
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export function JavaClass(props) {
element,
moddleElement: businessObject,
properties: {
'camunda:class': value
'camunda:class': value || ''
}
});
};
Expand Down Expand Up @@ -139,7 +139,7 @@ export function Expression(props) {
element,
moddleElement: businessObject,
properties: {
'camunda:expression': value
'camunda:expression': value || ''
}
});
};
Expand Down Expand Up @@ -207,7 +207,7 @@ export function DelegateExpression(props) {
element,
moddleElement: businessObject,
properties: {
'camunda:delegateExpression': value
'camunda:delegateExpression': value || ''
}
});
};
Expand Down
3 changes: 3 additions & 0 deletions src/provider/camunda-platform/properties/ListenerProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ function ImplementationDetails(props) {
} else if (type === 'script') {
return ScriptProps({ element, script: listener.get('script'), prefix: idPrefix });
}

// should never happen
return [];
}

function EventTypeDetails(props) {
Expand Down
23 changes: 23 additions & 0 deletions test/spec/provider/camunda-platform/DmnImplementationProps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,29 @@ describe('provider/camunda-platform - DmnImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const businessRuleTask = elementRegistry.get('BusinessRuleTask_dmn');

await act(() => {
selection.select(businessRuleTask);
});

const input = domQuery('input[name=decisionRef]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const decisionRef = getBusinessObject(businessRuleTask).get('camunda:decisionRef');

expect(decisionRef).to.exist;
expect(decisionRef).to.eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down
138 changes: 138 additions & 0 deletions test/spec/provider/camunda-platform/ImplementationProps.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,29 @@ describe('provider/camunda-platform - ImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const serviceTask = elementRegistry.get('ServiceTask_class');

await act(() => {
selection.select(serviceTask);
});

const input = domQuery('input[name=javaClass]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const camundaClass = getBusinessObject(serviceTask).get('camunda:class');

expect(camundaClass).to.exist;
expect(camundaClass).eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down Expand Up @@ -216,6 +239,29 @@ describe('provider/camunda-platform - ImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const serviceTask = elementRegistry.get('ServiceTask_class');

await act(() => {
selection.select(serviceTask);
});

const input = domQuery('input[name=javaClass]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const camundaClass = getBusinessObject(serviceTask).get('camunda:class');

expect(camundaClass).to.exist;
expect(camundaClass).eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down Expand Up @@ -310,6 +356,29 @@ describe('provider/camunda-platform - ImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const serviceTask = elementRegistry.get('ServiceTask_expression');

await act(() => {
selection.select(serviceTask);
});

const input = domQuery('input[name=expression]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const expression = getBusinessObject(serviceTask).get('camunda:expression');

expect(expression).to.exist;
expect(expression).eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down Expand Up @@ -404,6 +473,29 @@ describe('provider/camunda-platform - ImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const messageEvent = elementRegistry.get('MessageEndEvent_Expression');

await act(() => {
selection.select(messageEvent);
});

const input = domQuery('input[name=expression]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const expression = getServiceTaskLikeBusinessObject(messageEvent).get('camunda:expression');

expect(expression).to.exist;
expect(expression).eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down Expand Up @@ -688,6 +780,29 @@ describe('provider/camunda-platform - ImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const serviceTask = elementRegistry.get('ServiceTask_delegateExpression');

await act(() => {
selection.select(serviceTask);
});

const input = domQuery('input[name=delegateExpression]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const delegateExpression = getBusinessObject(serviceTask).get('camunda:delegateExpression');

expect(delegateExpression).to.exist;
expect(delegateExpression).eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down Expand Up @@ -784,6 +899,29 @@ describe('provider/camunda-platform - ImplementationProps', function() {
}));


it('should NOT delete property on empty value', inject(async function(elementRegistry, selection) {

// given
const messageEvent = elementRegistry.get('MessageEndEvent_DelegateExpression');

await act(() => {
selection.select(messageEvent);
});

const input = domQuery('input[name=delegateExpression]', container);
changeInput(input, 'newValue');

// when
changeInput(input, '');

// then
const delegateExpression = getServiceTaskLikeBusinessObject(messageEvent).get('camunda:delegateExpression');

expect(delegateExpression).to.exist;
expect(delegateExpression).eql('');
}));


it('should update on external change',
inject(async function(elementRegistry, selection, commandStack) {

Expand Down