From 86c083e48c8975a794653a5a74e2be3f68ff45e4 Mon Sep 17 00:00:00 2001 From: PrasadMadine Date: Tue, 9 Jul 2024 13:47:54 +0530 Subject: [PATCH] fixed the bug alert message is showing twice in select widget and added cypress testing for the same --- .../ClientSide/Widgets/Select/Select4_spec.ts | 37 +++++++++++++++++++ .../widgets/SelectWidget/component/index.tsx | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select4_spec.ts diff --git a/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select4_spec.ts b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select4_spec.ts new file mode 100644 index 00000000000..8e31985c240 --- /dev/null +++ b/app/client/cypress/e2e/Regression/ClientSide/Widgets/Select/Select4_spec.ts @@ -0,0 +1,37 @@ +import { + agHelper, + draggableWidgets, + deployMode, + entityExplorer, + locators, + propPane, +} from "../../../../../support/Objects/ObjectsCore"; + +describe( + "Select widget tests", + { tags: ["@tag.Widget", "@tag.Select"] }, + function () { + before(() => { + entityExplorer.DragDropWidgetNVerify(draggableWidgets.SELECT); + }); + + + it("Validate OnDropdownClose events are rendering show alert only once", () => { + propPane.EnterJSContext( + "onDropdownClose", + "{{showAlert('Dropdown closed!','success')}}", + true, + ); + propPane.ToggleJSMode("onDropdownClose", false); + deployMode.DeployApp(locators._widgetInDeployed(draggableWidgets.SELECT)); + agHelper.GetNClick(locators._widgetInDeployed(draggableWidgets.SELECT)); + agHelper.AssertElementVisibility( + locators._selectOptionValue("Red"), + true, + ); + agHelper.GetNClick(locators._selectOptionValue("Red")); + agHelper.ValidateToastMessage("Dropdown closed!"); + }); + }, +); + \ No newline at end of file diff --git a/app/client/src/widgets/SelectWidget/component/index.tsx b/app/client/src/widgets/SelectWidget/component/index.tsx index fba3aee71ec..26dc1995f3b 100644 --- a/app/client/src/widgets/SelectWidget/component/index.tsx +++ b/app/client/src/widgets/SelectWidget/component/index.tsx @@ -177,7 +177,7 @@ class SelectComponent extends React.Component< }; handleCloseList = () => { if (this.state.isOpen) { - this.togglePopoverVisibility(); + // this.togglePopoverVisibility(); if (!this.props.selectedIndex) return; return this.handleActiveItemChange( this.props.options[this.props.selectedIndex],