Skip to content

Commit

Permalink
fix: expose isVisible field in JSONFom widget autocomplete (#34869)
Browse files Browse the repository at this point in the history
Fixes [#31114](#31114)
Added missing field isVisible in getAutocompleteDefinition fn
Added cypress test

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

## Summary by CodeRabbit

- **New Features**
- Enhanced autocomplete functionality in the JSONForm Widget to include
the `isVisible` property.

- **Tests**
- Added a new test case to verify object properties in the autocomplete
list for the `isVisible` field in the JSONForm Widget.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
SaiCharanChetpelly31 authored Jul 17, 2024
1 parent eff3c59 commit e58b10d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,17 @@ describe("Autocomplete bug fixes", { tags: ["@tag.JS"] }, function () {
"console.log('hello')",
);
});

it("11. Bug #31114 Verify Object Properties in Autocomplete List for isVisible Field in JSONForm Widget", function () {
entityExplorer.DragDropWidgetNVerify(draggableWidgets.JSONFORM, 400, 800);
EditorNavigation.SelectEntityByName("Text1", EntityType.Widget);
propPane.EnterJSContext("Visible", "");
propPane.TypeTextIntoField("Visible", "{{JSONForm1.isVis");
agHelper.AssertElementExist(locators._hints);
agHelper.GetNAssertElementText(
locators._hints,
"isVisible",
"contain.text",
);
});
});
6 changes: 5 additions & 1 deletion app/client/src/widgets/JSONFormWidget/widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ import type {
Stylesheet,
} from "entities/AppTheming";
import type { BatchPropertyUpdatePayload } from "actions/controlActions";
import { isAutoHeightEnabledForWidget } from "widgets/WidgetUtils";
import {
isAutoHeightEnabledForWidget,
DefaultAutocompleteDefinitions,
} from "widgets/WidgetUtils";
import { generateTypeDef } from "utils/autocomplete/defCreatorUtils";
import type {
AnvilConfig,
Expand Down Expand Up @@ -461,6 +464,7 @@ class JSONFormWidget extends BaseWidget<
sourceData: generateTypeDef(widget.sourceData),
fieldState: generateTypeDef(widget.fieldState),
isValid: "bool",
isVisible: DefaultAutocompleteDefinitions.isVisible,
};

return definitions;
Expand Down

0 comments on commit e58b10d

Please sign in to comment.