Skip to content

Commit 85188de

Browse files
nikkufake-join[bot]
authored andcommitted
chore(camunda-platform): drop compareFn
No longer necessary as we don't intend to sort anymore.
1 parent dbf239b commit 85188de

File tree

6 files changed

+10
-42
lines changed

6 files changed

+10
-42
lines changed

src/provider/camunda-platform/properties/FormField.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -592,21 +592,10 @@ function PropertiesList(props) {
592592
element={ element }
593593
autoFocusEntry={ true }
594594
id={ id }
595-
compareFn={ createAlphanumericCompare('id') }
596595
label={ translate('Properties') }
597596
items={ propertyEntries }
598597
component={ Property }
599598
onAdd={ addProperty }
600599
onRemove={ removeProperty }
601600
/>;
602601
}
603-
604-
// helper //////////////////
605-
606-
function createAlphanumericCompare(field) {
607-
return function(entry, anotherEntry) {
608-
const [ key = '', anotherKey = '' ] = [ entry[field], anotherEntry[field] ];
609-
610-
return key === anotherKey ? 0 : key > anotherKey ? 1 : -1;
611-
};
612-
}

src/provider/camunda-platform/properties/ListProps.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,9 @@ export function ListProps(props) {
7070
});
7171
}
7272

73-
function compareFn(item, anotherItem) {
74-
const [ value = '', anotherValue = '' ] = [ item.value, anotherItem.value ];
75-
76-
return value === anotherValue ? 0 : value > anotherValue ? 1 : -1;
77-
}
78-
7973
return ListEntry({
8074
element,
8175
autoFocusEntry: true,
82-
compareFn,
8376
id: idPrefix + '-list',
8477
items,
8578
label: translate('List values'),

src/provider/camunda-platform/properties/ListenerProps.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ function Fields(props) {
472472
component={ Field }
473473
onAdd={ addField }
474474
onRemove={ removeField }
475-
compareFn={ compareName }
476475
autoFocusEntry={ `[data-entry-id="${id}-field-${fields.length - 1}"] input` }
477476
/>;
478477
}
@@ -559,12 +558,6 @@ function getPrefixedId(prefix, id) {
559558
return `${prefix}-${id}`;
560559
}
561560

562-
function compareName(field, anotherField) {
563-
const [ name = '', anotherName = '' ] = [ field.name, anotherField.name ];
564-
565-
return name === anotherName ? 0 : name > anotherName ? 1 : -1;
566-
}
567-
568561
function getListenersContainer(element) {
569562
const businessObject = getBusinessObject(element);
570563

src/provider/camunda-platform/properties/MapProps.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,9 @@ export function MapProps(props) {
7878
});
7979
}
8080

81-
function compareFn(entry, anotherEntry) {
82-
const [ key = '', anotherKey = '' ] = [ entry.key, anotherEntry.key ];
83-
84-
return key === anotherKey ? 0 : key > anotherKey ? 1 : -1;
85-
}
86-
8781
return ListEntry({
8882
element,
8983
autoFocusEntry: true,
90-
compareFn,
9184
id: idPrefix + '-map',
9285
items: entries,
9386
label: translate('Map entries'),

test/spec/provider/camunda-platform/FormField.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ describe('provider/camunda-platform - FormField', function() {
866866
// then
867867
const properties = getFormFieldProperties(task, 0);
868868
const propertyEntries = domQueryAll('div[data-entry-id=UserTask_1-formField-0-formFieldProperties] li', container);
869-
const label = domQuery('.bio-properties-panel-collapsible-entry-header-title', propertyEntries[1]);
869+
const label = domQuery('.bio-properties-panel-collapsible-entry-header-title', propertyEntries[0]);
870870

871871
expect(properties.get('values')[0].id).to.equal(label.innerHTML);
872872
}));
@@ -883,7 +883,7 @@ describe('provider/camunda-platform - FormField', function() {
883883

884884
// then
885885
const propertyEntries = domQueryAll('div[data-entry-id=UserTask_1-formField-0-formFieldProperties] li', container);
886-
const label = domQuery('.bio-properties-panel-collapsible-entry-header-title', propertyEntries[0]);
886+
const label = domQuery('.bio-properties-panel-collapsible-entry-header-title', propertyEntries[1]);
887887

888888
expect(label.innerHTML).to.equal('<empty>');
889889
}));
@@ -911,9 +911,9 @@ describe('provider/camunda-platform - FormField', function() {
911911
container)).map(e => e.innerHTML);
912912

913913
expect(propertiesEntries).to.eql([
914+
'Property3',
914915
'Property1',
915-
'Property2',
916-
'Property3' ]);
916+
'Property2' ]);
917917
}));
918918

919919
});

test/spec/provider/camunda-platform/FormFieldProperty.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ describe('provider/camunda-platform - FormFieldProperty', function() {
7272
selection.select(task);
7373
});
7474

75-
const idInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-1-id', container);
75+
const idInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-0-id', container);
7676
const properties = getFormFieldProperties(task, 0);
7777

7878
// then
@@ -90,7 +90,7 @@ describe('provider/camunda-platform - FormFieldProperty', function() {
9090
selection.select(task);
9191
});
9292

93-
const idInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-1-id', container);
93+
const idInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-0-id', container);
9494
const properties = getFormFieldProperties(task, 0);
9595

9696
// when
@@ -113,7 +113,7 @@ describe('provider/camunda-platform - FormFieldProperty', function() {
113113
selection.select(task);
114114
});
115115

116-
const idInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-1-id', container);
116+
const idInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-0-id', container);
117117

118118
changeInput(idInput, 'newVal');
119119

@@ -140,7 +140,7 @@ describe('provider/camunda-platform - FormFieldProperty', function() {
140140
selection.select(task);
141141
});
142142

143-
const valueInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-1-value', container);
143+
const valueInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-0-value', container);
144144
const properties = getFormFieldProperties(task, 0);
145145

146146
// then
@@ -158,7 +158,7 @@ describe('provider/camunda-platform - FormFieldProperty', function() {
158158
selection.select(task);
159159
});
160160

161-
const valueInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-1-value', container);
161+
const valueInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-0-value', container);
162162
const properties = getFormFieldProperties(task, 0);
163163

164164
// when
@@ -181,7 +181,7 @@ describe('provider/camunda-platform - FormFieldProperty', function() {
181181
selection.select(task);
182182
});
183183

184-
const valueInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-1-value', container);
184+
const valueInput = domQuery('#bio-properties-panel-UserTask_1-formField-0-formFieldProperties-property-0-value', container);
185185

186186
changeInput(valueInput, 'newVal');
187187

0 commit comments

Comments
 (0)