Skip to content

Commit

Permalink
fix: do not render simple label in datetime component
Browse files Browse the repository at this point in the history
Closes #983
  • Loading branch information
Skaiir committed Jan 15, 2024
1 parent 0ab6054 commit 9bcf2af
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export const LABELED_NON_INPUTS = [
'button',
'group',
'dynamiclist',
'iframe'
'iframe',
'table'
];

export const INPUTS = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { INPUTS } from '../Util';
import { INPUTS, LABELED_NON_INPUTS } from '../Util';
import { DATETIME_SUBTYPES, DATE_LABEL_PATH, TIME_LABEL_PATH } from '@bpmn-io/form-js-viewer';
import { useService, useVariables } from '../hooks';
import { FeelTemplatingEntry, isFeelEntryEdited } from '@bpmn-io/properties-panel';
Expand Down Expand Up @@ -44,14 +44,18 @@ export function LabelEntry(props) {
}
);

const isSimplyLabled = (field) => {
return [ ...INPUTS.filter(input => input !== 'datetime'), ...LABELED_NON_INPUTS ].includes(field.type);
};

entries.push(
{
id: 'label',
component: Label,
editField,
field,
isEdited: isFeelEntryEdited,
isDefaultVisible: (field) => [ ...INPUTS, 'button', 'group', 'table', 'iframe', 'dynamiclist' ].includes(field.type)
isDefaultVisible: isSimplyLabled
}
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ describe('GeneralGroup', function() {
});


it('should NOT render for datetime', function() {

// given
const field = { type: 'datetime' };

// when
const { container } = renderGeneralGroup({ field });

// then
const labelInput = findFeelers('label', container);

expect(labelInput).to.not.exist;
});


it('should render for button', function() {

// given
Expand Down

0 comments on commit 9bcf2af

Please sign in to comment.