-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix:JSONForm > Switch Field: label position has no effect, label wrap… #34298
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
Open
Harshithazemoso
wants to merge
19
commits into
appsmithorg:release
Choose a base branch
from
Harshithazemoso:Issue-33793-fix/Switch-Field-in-JSONForm-label-position-has-no-effect-label-wraps-text-unnecessarily
base: release
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+715
−49
Open
Changes from 14 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
bf7cc79
fix:JSONForm > Switch Field: label position has no effect, label wrap…
ea3361c
fix:add assertions for label position
f3ab0fa
fix:changes in cypress testing for switchfield spec in jsonformwidget
36d870d
fix:solve merge conflicts
a62edd3
Revert "fix:reverted the chnages"
0bb8ff6
fix:change spec to .ts format
a71c61f
fix:functionality issues for switch field
bfd3bc8
fix:functionality issues in switch widget in json form
fa0bba4
fix:switchfield and checkbox in jsonform similar to default widgets
530e1b0
fix:write jest cases and modify the cypress spec file
a76c18b
fix:write migration code for the new features
c63bf04
Merge branch 'release' into Issue-33793-fix/Switch-Field-in-JSONForm-…
721ed5b
fix:made changes in migration code
058715c
fix:made changes in migration code 1
6025bf2
fix:unit test cases and lint issues
fd03737
fix:failing schema test cases in jsonform
9d4e6b6
fix:migration test cases
20a0eb2
fix:migration test case assertion
bb879f5
Merge branch 'release' into Issue-33793-fix/Switch-Field-in-JSONForm-…
Harshitha-busetti File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...client/cypress/e2e/Regression/ClientSide/Widgets/JSONForm/JSONForm_EditSwitchFied_spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| import { | ||
| agHelper, | ||
| draggableWidgets, | ||
| entityExplorer, | ||
| propPane | ||
| } from "../../../../../support/Objects/ObjectsCore"; | ||
|
|
||
| const commonlocators = require("../../../../../locators/commonlocators.json"); | ||
| const widgetsPage = require("../../../../../locators/Widgets.json"); | ||
|
|
||
| // this spec will have a json form with two textinput fields and one is updated to switch field | ||
| // We will check the position property by clicking on the left and right position buttons | ||
| // here only alignment changes and the fields order in the dom changes so no assertions were added | ||
|
|
||
| describe( | ||
| "JSON Form Widget Custom Field", | ||
| { tags: ["@tag.Widget", "@tag.JSONForm"] }, | ||
| () => { | ||
| const schema = { | ||
| name: "John", | ||
| education: "1", | ||
| }; | ||
|
|
||
| it("verifies the label position and alignment", () => { | ||
| entityExplorer.DragDropWidgetNVerify(draggableWidgets.JSONFORM, 300, 100); | ||
| propPane.EnterJSContext( | ||
| "sourcedata", | ||
| JSON.stringify(schema), | ||
| true, | ||
| false, | ||
| ); | ||
| propPane.ChangeJsonFormFieldType("Education", "Switch"); | ||
| agHelper.AssertClassExists(widgetsPage.switchlabel, widgetsPage.switchAlignRight); | ||
| agHelper | ||
| .GetNClick(commonlocators.optionposition) | ||
| .last() | ||
| .click({ force: true }); | ||
| agHelper | ||
| .GetNClick(widgetsPage.rightAlign) | ||
| .first() | ||
| .click({ force: true }); | ||
| agHelper.AssertClassExists(widgetsPage.switchlabel,widgetsPage.switchAlignLeft); | ||
| agHelper | ||
| .GetNClick(commonlocators.optionpositionL) | ||
| .last() | ||
| .click({ force: true }); | ||
| agHelper.AssertClassExists(widgetsPage.switchlabel, widgetsPage.switchAlignRight); | ||
| propPane.NavigateBackToPropertyPane(); | ||
| }); | ||
| }, | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ages/dsl/src/migrate/migrations/089-migrate-jsonformwidget-labelposition-and-alignment.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| import type { DSLWidget, WidgetProps } from "../types"; | ||
| import { traverseDSLAndMigrate } from "../utils"; | ||
|
|
||
| export const migrateJsonFormWidgetLabelPositonAndAlignment = ( | ||
| currentDSL: DSLWidget, | ||
| ) => { | ||
| return traverseDSLAndMigrate(currentDSL, (widget: WidgetProps) => { | ||
| if (widget.type == "JSON_FORM_WIDGET") { | ||
| const jsonFormWidgetProps = widget; | ||
| Object.keys(jsonFormWidgetProps.schema).forEach((key) => { | ||
| const field = jsonFormWidgetProps.schema[key]; | ||
| if (field.children) { | ||
| Object.keys(field.children).forEach((childKey) => { | ||
| const childField = field.children[childKey]; | ||
rahulbarwal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| if ( | ||
| childField.fieldType === "Switch" && | ||
| childField.alignWidget === "RIGHT" | ||
| ) { | ||
| childField.alignWidget = "LEFT"; | ||
| } | ||
|
|
||
| if ( | ||
| childField.fieldType === "Checkbox" && | ||
| childField.alignWidget === "LEFT" | ||
| ) { | ||
| field.children[childKey] = { | ||
| ...childField, | ||
| labelPosition: "Right", | ||
| }; | ||
rahulbarwal marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| if ( | ||
| childField.fieldType === "Checkbox" && | ||
| childField.alignWidget === "RIGHT" | ||
| ) { | ||
| childField.alignWidget = "LEFT"; | ||
| field.children[childKey] = { | ||
| ...childField, | ||
| labelPosition: "Left", | ||
| }; | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.