Skip to content

Commit

Permalink
Add more explicit empty string conversion to account for 0 value (#2531)
Browse files Browse the repository at this point in the history
* Add more explicit empty string conversion to account for 0 value

* Add test cases

* handle animation timing
  • Loading branch information
agalin920 authored Feb 7, 2024
1 parent 4204bd8 commit e0e6213
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions cypress/e2e/content/content.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,43 @@ describe("Content Specs", () => {

// TODO: Need to confirm toggling of value
it("Yes/No Field", () => {
// Click the "Yes" button to select it
cy.get("#12-575f7c-trw1w3 button").contains("Yes").click({ force: true });

// Check if the "Yes" button has the ".Mui-selected" class
cy.get("#12-575f7c-trw1w3 button")
.contains("Yes")
.should("have.class", "Mui-selected");

// Click the "Yes" button again to deselect it
cy.get("#12-575f7c-trw1w3 button").contains("Yes").click();

// Check if neither "Yes" nor "No" buttons have the ".Mui-selected" class
cy.get("#12-575f7c-trw1w3 button")
.contains("Yes")
.should("not.have.class", "Mui-selected");
cy.get("#12-575f7c-trw1w3 button")
.contains("No")
.should("not.have.class", "Mui-selected");

// Click the "No" button to select it
cy.get("#12-575f7c-trw1w3 button").contains("No").click();

// Check if the "No" button has the ".Mui-selected" class
cy.get("#12-575f7c-trw1w3 button")
.contains("No")
.should("have.class", "Mui-selected");

// Click the "No" button again to deselect it
cy.get("#12-575f7c-trw1w3 button").contains("No").click();

// Check again if neither "Yes" nor "No" buttons have the ".Mui-selected" class
cy.get("#12-575f7c-trw1w3 button")
.contains("Yes")
.should("not.have.class", "Mui-selected");
cy.get("#12-575f7c-trw1w3 button")
.contains("No")
.should("not.have.class", "Mui-selected");
});

// TODO: Need to confirm toggling of value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default memo(function Editor({
itemZUID: itemZUID,
key: name,
// convert empty strings to null
value: value || null,
value: value === "" ? null : value,
});

// If we are working with a new item
Expand Down

0 comments on commit e0e6213

Please sign in to comment.