From 63ca93779ea08c8d25d8a553bceb80c4dedd1b37 Mon Sep 17 00:00:00 2001 From: Pavitra Khatri Date: Thu, 18 Jul 2024 12:34:36 +0530 Subject: [PATCH 1/2] Approval checkbox required by default --- .../_cq_template/.content.xml | 1 + .../termsandconditions/tnc.runtime.spec.js | 22 ++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml index 95a10387e4..6b2bdabe8f 100644 --- a/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml +++ b/examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml @@ -19,6 +19,7 @@ jcr:title="I agree to the terms & conditions" sling:resourceType="core/fd/components/form/checkbox/v1/checkbox" enabled="false" + required="true" checkedValue="true" fieldType="checkbox"> diff --git a/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js b/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js index d2a12800fa..6858432dfd 100644 --- a/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js +++ b/ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js @@ -110,5 +110,25 @@ describe("Form Runtime with Terms and Conditions", () => { }) }) }); -}) + it('checkbox should be required by default', () => { + const tncWithLinksID = formContainer._model.items[1].id; + const model = formContainer._model.getElement(tncWithLinksID) + expect(model.getState().items[0].enabled).to.equal(false); + cy.get(`#${tncWithLinksID}`).get('a').click() + .then(() => { + expect(model.getState().items[0].enabled).to.equal(true); + cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox`).invoke('attr', 'data-cmp-enabled') + .should('eq', 'true'); + cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox`).click() + .then(() => { + cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox__errormessage`).should('be.empty'); + }) + cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox`).dblclick().should('not.be.checked') + .then(() => { + cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox__errormessage`).should('not.be.null'); + }) + }) + }) + + }) From 5e070ea571c692f278a4cc8f76312e1c91f2ebdc Mon Sep 17 00:00:00 2001 From: Rishi Mehta <69448117+rismehta@users.noreply.github.com> Date: Tue, 23 Jul 2024 17:10:00 +0530 Subject: [PATCH 2/2] FORMS-15481 Adding ui change event to update model value (#1327) * updating eventsource while updating model value * Adding ui change event to update model value * Fixing package lock * Fixing text input code --------- Co-authored-by: vdua --- .../termsandconditions/v1/termsandconditions/_cq_template.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml index 95a10387e4..856d620fbc 100644 --- a/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml +++ b/ui.af.apps/src/main/content/jcr_root/apps/core/fd/components/form/termsandconditions/v1/termsandconditions/_cq_template.xml @@ -18,6 +18,7 @@ jcr:primaryType="nt:unstructured" jcr:title="I agree to the terms & conditions" sling:resourceType="core/fd/components/form/checkbox/v1/checkbox" + required="true" enabled="false" checkedValue="true" fieldType="checkbox">