Skip to content

Commit

Permalink
fix: FEEL text fields
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul99ahad committed Feb 25, 2025
1 parent d8f833d commit fe044f4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/components/entries/FEEL/Feel.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function FeelTextfieldComponent(props) {
label,
hostLanguage,
onInput,
onBlur,
onError,
placeholder,
feel,
Expand Down Expand Up @@ -130,6 +131,13 @@ function FeelTextfieldComponent(props) {
}
};

const handleOnBlur = e => {
if (onBlur) {
onBlur(e);
}
setLocalValue(e.target.value.trim());
};

const handleLint = useStaticCallback((lint = []) => {

const syntaxError = lint.some(report => report.type === 'Syntax Error');
Expand Down Expand Up @@ -256,6 +264,7 @@ function FeelTextfieldComponent(props) {
{ ...props }
popupOpen={ popuOpen }
onInput={ handleLocalInput }
onBlur={ handleOnBlur }
contentAttributes={ { 'id': prefixId(id), 'aria-label': label } }
value={ localValue }
ref={ editorRef }
Expand Down Expand Up @@ -314,7 +323,7 @@ const OptionalFeelInput = forwardRef((props, ref) => {
class="bio-properties-panel-input"
onInput={ e => onInput(e.target.value) }
onFocus={ onFocus }
onBlur={ onBlur }
onBlur={ e => onBlur(e) }
placeholder={ placeholder }
value={ value || '' } />;
});
Expand Down Expand Up @@ -411,7 +420,7 @@ const OptionalFeelTextArea = forwardRef((props, ref) => {
class="bio-properties-panel-input"
onInput={ e => onInput(e.target.value) }
onFocus={ onFocus }
onBlur={ onBlur }
onBlur={ e => onBlur(e) }
placeholder={ placeholder }
value={ value || '' }
data-gramm="false"
Expand Down
21 changes: 21 additions & 0 deletions test/spec/components/Feel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1871,6 +1871,27 @@ describe('<FeelField>', function() {
});


it('should have no trailing spaces', async function() {

// given
const result = createFeelField({ container });

const input = domQuery('.bio-properties-panel-input', result.container);

// when
changeInput(input, 'foo ');

input.focus();
input.blur();

// then
await waitFor(() => {
expect(input.value).to.equal('foo');
});

});


describe('#isEdited', function() {

it('should NOT be edited', function() {
Expand Down

0 comments on commit fe044f4

Please sign in to comment.