From df5d91737550cb901773125e4ab141474ea57869 Mon Sep 17 00:00:00 2001 From: Parth Bhattacharya <parthget@gmail.com> Date: Fri, 14 Feb 2025 10:34:17 +0530 Subject: [PATCH 1/4] issue-3498485: fixed false appearing in input text fields --- ui/src/components/form/inputBehaviors.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/components/form/inputBehaviors.tsx b/ui/src/components/form/inputBehaviors.tsx index 129dc40dd8..5171ec944d 100644 --- a/ui/src/components/form/inputBehaviors.tsx +++ b/ui/src/components/form/inputBehaviors.tsx @@ -400,12 +400,15 @@ const InputBehaviorsEntityForm = ( const parseNewValue = (e: React.ChangeEvent) => { const target = e.target as HTMLInputElement; - if (target.value) { + // If the target is an input element, return its value + if (target.value !== undefined) { return target.value; } + // If the target is a checkbox or radio button, return its checked if ('checked' in target) { return target.checked; } + // If the target is neither an input element nor a checkbox/radio button, return null return null; }; -- GitLab From 3708cbcdd1eb1a5bdf3060297cd5b84a1ea7d2c2 Mon Sep 17 00:00:00 2001 From: Jesse Baker <jesse.baker@acquia.com> Date: Fri, 14 Feb 2025 17:54:21 +0000 Subject: [PATCH 2/4] Removed workaround in tests that was in place to account for false being inserted when clearing the page title field which means the new fix is being tested --- ui/tests/e2e/page-data-form.cy.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ui/tests/e2e/page-data-form.cy.js b/ui/tests/e2e/page-data-form.cy.js index bb219d2ce0..079ed754fb 100644 --- a/ui/tests/e2e/page-data-form.cy.js +++ b/ui/tests/e2e/page-data-form.cy.js @@ -31,7 +31,8 @@ describe('Page data form', () => { .findByLabelText('Title') .as('titleField'); cy.get('@titleField').focus(); - cy.get('@titleField').type('{selectall}This is a new title'); + cy.get('@titleField').clear(); + cy.get('@titleField').type('This is a new title'); cy.get('@titleField').should('have.value', 'This is a new title'); cy.get('button[aria-label="Undo"]').should('be.enabled'); cy.get('button[aria-label="Redo"]').should('be.disabled'); @@ -56,7 +57,8 @@ describe('Page data form', () => { .as('heroTitle'); cy.get('@heroTitle').should('have.value', 'hello, world!'); cy.get('@heroTitle').focus(); - cy.get('@heroTitle').type('{selectall}This is a new hero title'); + cy.get('@heroTitle').clear(); + cy.get('@heroTitle').type('This is a new hero title'); cy.wait('@patchPreview'); // Editing a component field should push that onto the undo state. cy.get('button[aria-label="Undo"]').should('be.enabled'); @@ -87,7 +89,8 @@ describe('Page data form', () => { .should('have.value', 'XB Needs This For The Time Being'); cy.get('@titleField').focus(); - cy.get('@titleField').type('{selectall}This is a new title'); + cy.get('@titleField').clear(); + cy.get('@titleField').type('This is a new title'); cy.get('@titleField').should('have.value', 'This is a new title'); cy.get('button[aria-label="Undo"]').should('be.enabled'); cy.get('button[aria-label="Redo"]').should('be.disabled'); -- GitLab From 950573da3588f6709527c0583743b4a1707a7670 Mon Sep 17 00:00:00 2001 From: Lauri Timmanee <23758-lauriii@users.noreply.drupalcode.org> Date: Fri, 14 Feb 2025 18:48:57 +0000 Subject: [PATCH 3/4] Apply 1 suggestion(s) to 1 file(s) --- ui/tests/e2e/page-data-form.cy.js | 1 + 1 file changed, 1 insertion(+) diff --git a/ui/tests/e2e/page-data-form.cy.js b/ui/tests/e2e/page-data-form.cy.js index 079ed754fb..c7de8d289f 100644 --- a/ui/tests/e2e/page-data-form.cy.js +++ b/ui/tests/e2e/page-data-form.cy.js @@ -89,6 +89,7 @@ describe('Page data form', () => { .should('have.value', 'XB Needs This For The Time Being'); cy.get('@titleField').focus(); + cy.get('@titleField').should('have.value', ''); cy.get('@titleField').clear(); cy.get('@titleField').type('This is a new title'); cy.get('@titleField').should('have.value', 'This is a new title'); -- GitLab From 60c5a0275078f47f0fae30c593da484ca1b378ff Mon Sep 17 00:00:00 2001 From: Lauri Timmanee <23758-lauriii@users.noreply.drupalcode.org> Date: Fri, 14 Feb 2025 18:50:30 +0000 Subject: [PATCH 4/4] Fix mistake from suggestion --- ui/tests/e2e/page-data-form.cy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/tests/e2e/page-data-form.cy.js b/ui/tests/e2e/page-data-form.cy.js index c7de8d289f..7c63266b4a 100644 --- a/ui/tests/e2e/page-data-form.cy.js +++ b/ui/tests/e2e/page-data-form.cy.js @@ -89,8 +89,8 @@ describe('Page data form', () => { .should('have.value', 'XB Needs This For The Time Being'); cy.get('@titleField').focus(); - cy.get('@titleField').should('have.value', ''); cy.get('@titleField').clear(); + cy.get('@titleField').should('have.value', ''); cy.get('@titleField').type('This is a new title'); cy.get('@titleField').should('have.value', 'This is a new title'); cy.get('button[aria-label="Undo"]').should('be.enabled'); -- GitLab