Skip to content

Commit

Permalink
fix: make FEEL editor in literal expression save value
Browse files Browse the repository at this point in the history
This was caused by an API mismatch. `ContentEditable` and `LiteralExpression`
accept `onInput` while `EditableComponent` expects `onChange`.

Closes #786
  • Loading branch information
barmac committed Oct 4, 2023
1 parent ca04317 commit e1058d8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class FeelEditor extends Component {
return <LiteralExpression
className={ this.props.className }
value={ this.props.value }
onChange={ this.props.onChange }
onInput={ this.props.onChange }
/>;
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/dmn-js-literal-expression/test/helper/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export function inject(fn) {
throw new Error('DecisionTable instance not found');
}

view.invoke(fn);
return view.invoke(fn);
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ describe('textarea editor', function() {
// given
const editor = queryEditor('.textarea', testContainer);

editor.focus();
await act(() => editor.focus());

// when
await changeInput(editor, 'foo');
await changeInput(document.activeElement, 'foo');

// then
expect(viewer.getDecision().decisionLogic.text).to.equal('foo');
Expand Down Expand Up @@ -84,8 +84,11 @@ describe('textarea editor', function() {
* @param {string} value
*/
function changeInput(input, value) {
input.textContent = value;
return act(() => input.textContent = value);
}

function act(fn) {
fn();
return new Promise(resolve => {
requestAnimationFrame(() => {
resolve();
Expand Down

0 comments on commit e1058d8

Please sign in to comment.