PromucFlow_constructor/app/client/cypress/e2e/Regression/ClientSide
Jacques Ikot 9f387d5763
fix: Correct Select Widget Mapping for Dynamic Label and Value Keys (#35862)
## Description
**Problem**
When the Select widget's labelKey or valueKey properties are switched to
JS mode, passing a function that returns a string as the key causes the
dropdown options to break. Instead of correctly mapping the labels and
values, the options are incorrectly returned as an array of the key
itself.

**Root Cause**
The issue lies in the `getOptions` function in derived.js. The logic
that computes the select options based on the labelKey and valueKey was
not handling cases where these properties are functions that return
arrays. Instead of mapping through the source data and returning the
corresponding values for each key, the function was mistakenly returning
the entire array.

**Solution**
The `getOptions` function in derived.js has been updated to correctly
handle cases where labelKey or valueKey are arrays. The function now
maps through the sourceData and computes the correct labels and values
based on the provided properties, ensuring that the dropdown options are
displayed as expected.



Fixes #35269

## Automation

/ok-to-test tags="@tag.Sanity, @tag.Select, @tag.Widget, @tag.Binding"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/10560970428>
> Commit: 118badee07c47fe72f727f8ab248c29685f6f7a1
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=10560970428&attempt=1"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.Sanity, @tag.Select, @tag.Widget, @tag.Binding`
> Spec:
> <hr>Mon, 26 Aug 2024 15:24:26 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit


- **New Features**
- Enhanced test coverage for the Select widget by adding new test cases
to validate the correct functioning of JavaScript functions in the label
and value keys.
- Improved processing of `optionLabel` and `optionValue` properties for
the Select widget, ensuring accurate mapping to `sourceData`.
- Introduced a new helper function to streamline the validation of label
and value keys in the Select widget tests.

- **Bug Fixes**
- Corrected the handling of multiple options in the Select widget to
enhance data mapping accuracy and functionality.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-08-27 07:54:44 +01:00
..
ActionExecution fix: collapse params & query params in action selector if value is not changed (#35323) 2024-08-02 15:01:18 +05:30
AdminSettings chore: Make edit launch buttons as links & add upgrade ramps for session timeout setting (#31862) 2024-03-21 15:37:13 +05:30
Anvil chore: fix zone dotted highlight is not showing up on new anvil apps (#35787) 2024-08-22 12:46:48 +03:00
AppNavigation chore: Reorganise IDE Panels (#35114) 2024-07-31 21:23:35 +05:30
AuditLogs chore: Make edit launch buttons as links & add upgrade ramps for session timeout setting (#31862) 2024-03-21 15:37:13 +05:30
Autocomplete fix: expose isVisible field in JSONFom widget autocomplete (#34869) 2024-07-17 10:54:23 +05:30
Binding fix: collapse params & query params in action selector if value is not changed (#35323) 2024-08-02 15:01:18 +05:30
Branding test: Updating the locator for upgrade button on admin settings (#33872) 2024-05-31 21:07:28 +05:30
BugTests test: fixed skipped graphQL test (#35571) 2024-08-14 15:22:33 +05:30
CodeComment test: Cypress - added tag - @tag.AutoHeight, @tag.IDE (#29670) 2023-12-18 12:45:44 +05:30
CommunityTemplate fix: default port numbers for the datasources (#32901) 2024-04-30 13:15:11 +05:30
Debugger fix: property navigation spec (#32782) 2024-04-19 13:09:20 +05:30
DynamicHeight test: Updated duplicate file names (#34972) 2024-07-31 10:27:33 +05:30
Editor test: Cypress - separated exclude airgap cases and tagged them (#30588) 2024-01-24 16:47:58 +05:30
EmbedSettings test: Cypress | Added Dynamic checks for Flaky fix + Cypress upgrade (#30840) 2024-02-02 16:01:59 +05:30
ExplorerTests feat: move building blocks to bottom of widget explorer (#35270) 2024-08-01 14:01:40 +01:00
Fork test: fix flaky case for forkapp (#35376) 2024-08-07 13:55:22 +05:30
FormLogin test: Remove pause from code (#34798) 2024-07-10 11:54:40 +05:30
FormNativeToRawTests fix: commands title changed to command for each datasource query editor forms (#32526) 2024-04-10 17:05:01 +05:30
Git test: Update case base duplicate file name (#35672) 2024-08-20 10:48:52 +05:30
Github chore: Updating the login and signup page for cloud hosting as per new design (#32641) 2024-04-17 21:46:44 +05:30
Google chore: Updating the login and signup page for cloud hosting as per new design (#32641) 2024-04-17 21:46:44 +05:30
Homepage feat: Homepage experience v2 changes (#29282) 2024-01-25 19:11:48 +05:30
IDE fix: Overflow list new UI restore (#34658) 2024-07-05 11:55:29 +05:30
JSLibrary feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
JSObject test: fix JsObjectMutation flaky test (#32936) 2024-04-26 18:19:22 +05:30
Linting fix: show linting errors on browser API added (#32732) 2024-04-18 18:49:15 +05:30
MobileResponsiveTests test: updated tests with aghelper table methods (#33737) 2024-05-31 14:01:06 +05:30
Onboarding chore: Remove unnecessary flag ab_show_templates_instead_of_blank_canvas_enabled (#33313) 2024-05-13 09:32:00 +05:30
OneClickBinding test: Update case base duplicate file name (#35672) 2024-08-20 10:48:52 +05:30
OtherUIFeatures feat: cURL import now happens via a modal (#34830) 2024-07-10 14:22:39 +05:30
PartialImportExport test: PartialExport_Widgets_spec - updated test validation logic (#33371) 2024-05-21 18:40:02 +05:30
PeekOverlay feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
Performance feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
ProductRamps chore: rm dr ce (#34765) 2024-07-31 08:24:51 +05:30
PropertyPane test: Cypress - added tags - @tag.JS, @tag.Perf, @tag.Settings, @tag.PropertyPane, @tag.Theme (#29682) 2023-12-18 17:18:23 +05:30
PublishedApps test: Cypress - added tags - @tag.JS, @tag.Perf, @tag.Settings, @tag.PropertyPane, @tag.Theme (#29682) 2023-12-18 17:18:23 +05:30
Refactoring feat: enabled editor pane sidebar (#29882) 2024-01-12 20:13:58 +05:30
SetProperty chore: Add evalTreeWithDiff to evalWorkerAction (#34403) 2024-06-27 12:08:53 +05:30
SettingsPane test: Updated duplicate file names (#34972) 2024-07-31 10:27:33 +05:30
Templates chore: Remove empty canvas prompts and improve widget editor header (#33993) 2024-06-06 14:29:41 +05:30
ThemingTests test: Update case base duplicate file name (#35672) 2024-08-20 10:48:52 +05:30
UserProfile feat: Homepage experience v2 changes (#29282) 2024-01-25 19:11:48 +05:30
VisualTests test: Failing cypress tests due to removal of empty canvas prompts (#34037) 2024-06-07 15:24:07 +05:30
Widgets fix: Correct Select Widget Mapping for Dynamic Label and Value Keys (#35862) 2024-08-27 07:54:44 +01:00
Workspace test: replace LogintoApp with LoginFromAPI (#34040) 2024-06-14 20:52:49 +05:30