fix: added default value for switch view type (#15215)
This commit is contained in:
parent
af2e55ef31
commit
458715f0ac
|
|
@ -388,6 +388,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -403,6 +406,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -422,20 +428,8 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
},
|
node6: {
|
||||||
},
|
viewType: ViewTypes.COMPONENT,
|
||||||
},
|
|
||||||
{
|
|
||||||
actionConfiguration: {
|
|
||||||
formData: {
|
|
||||||
node1: { data: "value1" },
|
|
||||||
node3: { data: "value1" },
|
|
||||||
node2: { data: "value1", viewType: ViewTypes.JSON },
|
|
||||||
node4: { data: "value1", viewType: ViewTypes.COMPONENT },
|
|
||||||
node5: {
|
|
||||||
data: "value1",
|
|
||||||
viewType: ViewTypes.JSON,
|
|
||||||
componentData: "value2",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -452,6 +446,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -467,6 +464,27 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
actionConfiguration: {
|
||||||
|
formData: {
|
||||||
|
node1: { data: "value1" },
|
||||||
|
node3: { data: "value1" },
|
||||||
|
node2: { data: "value1", viewType: ViewTypes.JSON },
|
||||||
|
node4: { data: "value1", viewType: ViewTypes.COMPONENT },
|
||||||
|
node5: {
|
||||||
|
data: "value1",
|
||||||
|
viewType: ViewTypes.JSON,
|
||||||
|
componentData: "value2",
|
||||||
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -494,6 +512,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
@ -514,6 +535,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -533,6 +557,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -553,6 +580,9 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -569,6 +599,9 @@ describe("json/form viewTypes test", () => {
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
jsonData: "value1",
|
jsonData: "value1",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -588,6 +621,32 @@ describe("json/form viewTypes test", () => {
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
componentData: "value2",
|
componentData: "value2",
|
||||||
},
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
actionConfiguration: {
|
||||||
|
formData: {
|
||||||
|
node1: { data: "value1" },
|
||||||
|
node2: { data: "value1", viewType: ViewTypes.JSON },
|
||||||
|
node3: { data: "value1" },
|
||||||
|
node4: {
|
||||||
|
data: "value1",
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
|
node5: {
|
||||||
|
data: "value1",
|
||||||
|
viewType: ViewTypes.JSON,
|
||||||
|
componentData: "value2",
|
||||||
|
},
|
||||||
|
node6: {
|
||||||
|
viewType: ViewTypes.JSON,
|
||||||
|
data: "",
|
||||||
|
componentData: "",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
@ -613,6 +672,10 @@ describe("json/form viewTypes test", () => {
|
||||||
path: "actionConfiguration.formData.node3.data",
|
path: "actionConfiguration.formData.node3.data",
|
||||||
viewType: ViewTypes.JSON,
|
viewType: ViewTypes.JSON,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "actionConfiguration.formData.node6.data",
|
||||||
|
viewType: ViewTypes.COMPONENT,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
testCases.forEach((testCase, index) => {
|
testCases.forEach((testCase, index) => {
|
||||||
const formName = `testForm-${index}`;
|
const formName = `testForm-${index}`;
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,7 @@ export const switchViewType = (
|
||||||
);
|
);
|
||||||
const jsonData = get(values, pathForJsonData);
|
const jsonData = get(values, pathForJsonData);
|
||||||
const componentData = get(values, pathForComponentData);
|
const componentData = get(values, pathForComponentData);
|
||||||
const currentData = get(values, configProperty);
|
const currentData = get(values, configProperty, "");
|
||||||
const stringifiedCurrentData = JSON.stringify(currentData, null, "\t");
|
const stringifiedCurrentData = JSON.stringify(currentData, null, "\t");
|
||||||
|
|
||||||
if (newViewType === ViewTypes.JSON) {
|
if (newViewType === ViewTypes.JSON) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user