onChangeExpressionModel(language.model.name, model)}
- />
+
+ onChangeExpressionModel(language.model.name, model)}
+ />
+
)}
>
)
diff --git a/packages/ui/src/components/Form/expression/expression.service.ts b/packages/ui/src/components/Form/expression/expression.service.ts
index 06496df9f..74bc8b0b3 100644
--- a/packages/ui/src/components/Form/expression/expression.service.ts
+++ b/packages/ui/src/components/Form/expression/expression.service.ts
@@ -138,6 +138,12 @@ export class ExpressionService {
(parentModel.expression as Record)[languageModelName] = newExpressionModel;
}
+ static deleteStepExpressionModel(parentModel: Record): void {
+ if (parentModel.expression) {
+ delete parentModel.expression;
+ }
+ }
+
/**
* Parse the property expression model from the parent parameter model object.
* @param languageCatalogMap The language catalog map to use as a dictionary.
diff --git a/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.test.tsx b/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.test.tsx
index f04d7f77f..66c5a14ef 100644
--- a/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.test.tsx
+++ b/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.test.tsx
@@ -54,11 +54,11 @@ describe('StepExpressionEditor', () => {
await act(async () => {
fireEvent.click(launcherButton[0]);
});
- const dropdownButton = screen
- .getAllByRole('button')
- .filter((button) => button.innerHTML.includes(SchemaService.DROPDOWN_PLACEHOLDER));
+ const dropdown = screen
+ .getAllByTestId('typeahead-select-input')
+ .filter((input) => input.innerHTML.includes(SchemaService.DROPDOWN_PLACEHOLDER));
await act(async () => {
- fireEvent.click(dropdownButton[0]);
+ fireEvent.click(dropdown[0]);
});
const jsonpath = screen.getByTestId('expression-dropdownitem-jsonpath');
fireEvent.click(jsonpath.getElementsByTagName('button')[0]);
diff --git a/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.tsx b/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.tsx
index a4f83431f..55662b48f 100644
--- a/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.tsx
+++ b/packages/ui/src/components/Form/stepExpression/StepExpressionEditor.tsx
@@ -51,9 +51,11 @@ export const StepExpressionEditor: FunctionComponent
const model = props.selectedNode.data?.vizNode?.getComponentSchema()?.definition || {};
if (preparedLanguage && preparedModel) {
ExpressionService.setStepExpressionModel(languageCatalogMap, model, preparedLanguage.model.name, preparedModel);
- props.selectedNode.data?.vizNode?.updateModel(model);
- entitiesContext?.updateSourceCodeFromEntities();
+ } else {
+ ExpressionService.deleteStepExpressionModel(model);
}
+ props.selectedNode.data?.vizNode?.updateModel(model);
+ entitiesContext?.updateSourceCodeFromEntities();
}, [entitiesContext, languageCatalogMap, preparedLanguage, preparedModel, props.selectedNode.data?.vizNode]);
const handleCancel = useCallback(() => {
diff --git a/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx b/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx
index f69d73997..6b7c680ad 100644
--- a/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx
+++ b/packages/ui/src/components/Visualization/Canvas/CanvasForm.test.tsx
@@ -197,8 +197,8 @@ describe('CanvasForm', () => {
fireEvent.click(launchExpression);
});
const button = screen
- .getAllByRole('button')
- .filter((button) => button.innerHTML.includes(SchemaService.DROPDOWN_PLACEHOLDER));
+ .getAllByTestId('typeahead-select-input')
+ .filter((input) => input.innerHTML.includes(SchemaService.DROPDOWN_PLACEHOLDER));
act(() => {
fireEvent.click(button[0]);
});
@@ -268,8 +268,8 @@ describe('CanvasForm', () => {
fireEvent.click(launchExpression);
});
const button = screen
- .getAllByRole('button')
- .filter((button) => button.innerHTML.includes(SchemaService.DROPDOWN_PLACEHOLDER));
+ .getAllByTestId('typeahead-select-input')
+ .filter((input) => input.innerHTML.includes(SchemaService.DROPDOWN_PLACEHOLDER));
act(() => {
fireEvent.click(button[0]);
});