From 6b1279d96f2cd0e0a22bf2825e7fe9ff646c5385 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 5 Feb 2024 14:04:19 -0800 Subject: [PATCH 1/3] Add more explicit empty string conversion to account for 0 value --- src/apps/content-editor/src/app/components/Editor/Editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/apps/content-editor/src/app/components/Editor/Editor.js b/src/apps/content-editor/src/app/components/Editor/Editor.js index fb1d93a2b6..1416531ad5 100644 --- a/src/apps/content-editor/src/app/components/Editor/Editor.js +++ b/src/apps/content-editor/src/app/components/Editor/Editor.js @@ -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 From 2d05faffca19e3a3b2ddebcb63537c0b4bbde5d1 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 5 Feb 2024 14:13:06 -0800 Subject: [PATCH 2/3] Add test cases --- cypress/e2e/content/content.spec.js | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/cypress/e2e/content/content.spec.js b/cypress/e2e/content/content.spec.js index e3459fcc11..db903f6662 100644 --- a/cypress/e2e/content/content.spec.js +++ b/cypress/e2e/content/content.spec.js @@ -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(); + + // 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 From ca67692a9fe21e6087c5debca3abf11806d81a29 Mon Sep 17 00:00:00 2001 From: Andres Date: Mon, 5 Feb 2024 15:32:17 -0800 Subject: [PATCH 3/3] handle animation timing --- cypress/e2e/content/content.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress/e2e/content/content.spec.js b/cypress/e2e/content/content.spec.js index db903f6662..774d0cc93f 100644 --- a/cypress/e2e/content/content.spec.js +++ b/cypress/e2e/content/content.spec.js @@ -143,7 +143,7 @@ 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(); + 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")