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

Integrate first-item FEEL validation gracefully, as a warning #381

Merged
merged 2 commits into from
Sep 20, 2024
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
13 changes: 6 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions src/components/entries/FEEL/Feel.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,15 @@ function FeelTextfieldComponent(props) {
}
};

const handleLint = useStaticCallback(lint => {
const handleLint = useStaticCallback((lint = []) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Positive change


if (!(lint && lint.length)) {
const syntaxError = lint.some(report => report.type === 'Syntax Error');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one


if (syntaxError) {
onError('Unparsable FEEL expression.');
} else {
onError(undefined);
return;
}

onError('Unparsable FEEL expression.');
});

const handlePopupOpen = (type = 'feel') => {
Expand Down
20 changes: 20 additions & 0 deletions test/spec/components/Feel.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1986,6 +1986,26 @@ describe('<FeelField>', function() {
});


it('should not indicate field error on non-syntax errors', async function() {

// given
const clock = sinon.useFakeTimers();
const result = createFeelField({ container, getValue: () => '= friend[0]', feel: 'required' });

// when
// trigger debounced validation
await act(() => { clock.tick(1000); });
await act(() => { clock.restore(); });

// then
await waitFor(() => {
const entry = domQuery('.bio-properties-panel-entry', result.container);

expect(isValid(entry)).to.be.true;
});
});


it('should show global error over local error', async function() {

// given
Expand Down