Skip to content

Commit

Permalink
feat: add test for computed value handling in TableV2 with nested pro…
Browse files Browse the repository at this point in the history
…perties

- Introduced a new test case to verify that computed values in TableV2 correctly handle missing nested properties using try-catch blocks.
- The test checks the behavior of the table when provided with data containing nested objects and missing properties, ensuring that it returns expected values or empty strings as appropriate.
  • Loading branch information
rahulbarwal committed Dec 27, 2024
1 parent 0289d1f commit 36d974f
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,36 @@ describe(
cy.get(".draggable-header:contains('CustomColumn')").should("be.visible");
cy.closePropertyPane();
});

it("5. Verify computed value with try-catch blocks handles missing nested properties", function () {
cy.openPropertyPane("tablewidgetv2");

// Set table data with nested object and missing property
propPane.UpdatePropertyFieldValue(
"Table data",
`{{[{"name": "Rahul", age: {value: 31}}, {"name": "Jacq", age: {}}, {"name": "John"}]}`,
);

cy.editColumn("age");
propPane.UpdatePropertyFieldValue(
"Computed value",
"{{currentRow.age.value}}",
);

cy.readTableV2data(0, 1).then((val) => {
expect(val).to.equal("31");
});

cy.readTableV2data(1, 1).then((val) => {
expect(val).to.equal("");
});

cy.readTableV2data(2, 1).then((val) => {
expect(val).to.equal("");
});

// Clean up
cy.backFromPropertyPanel();
});
},
);

0 comments on commit 36d974f

Please sign in to comment.