Skip to content

Commit 25e9b2b

Browse files
Pavitra Khatrici-build
Pavitra Khatri
authored and
ci-build
committed
Approval checkbox required by default
1 parent 41e4b47 commit 25e9b2b

File tree

2 files changed

+22
-1
lines changed
  • examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template
  • ui.tests/test-module/specs/termsandconditions

2 files changed

+22
-1
lines changed

examples/ui.apps/src/main/content/jcr_root/apps/forms-components-examples/components/form/termsandconditions/_cq_template/.content.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
jcr:title="I agree to the terms & conditions"
2020
sling:resourceType="core/fd/components/form/checkbox/v1/checkbox"
2121
enabled="false"
22+
required="true"
2223
checkedValue="true"
2324
fieldType="checkbox">
2425
</approvalcheckbox>

ui.tests/test-module/specs/termsandconditions/tnc.runtime.spec.js

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,5 +110,25 @@ describe("Form Runtime with Terms and Conditions", () => {
110110
})
111111
})
112112
});
113-
})
114113

114+
it('checkbox should be required by default', () => {
115+
const tncWithLinksID = formContainer._model.items[1].id;
116+
const model = formContainer._model.getElement(tncWithLinksID)
117+
expect(model.getState().items[0].enabled).to.equal(false);
118+
cy.get(`#${tncWithLinksID}`).get('a').click()
119+
.then(() => {
120+
expect(model.getState().items[0].enabled).to.equal(true);
121+
cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox`).invoke('attr', 'data-cmp-enabled')
122+
.should('eq', 'true');
123+
cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox`).click()
124+
.then(() => {
125+
cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox__errormessage`).should('be.empty');
126+
})
127+
cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox`).dblclick().should('not.be.checked')
128+
.then(() => {
129+
cy.get(`#${tncWithLinksID} .cmp-adaptiveform-checkbox__errormessage`).should('not.be.null');
130+
})
131+
})
132+
})
133+
134+
})

0 commit comments

Comments
 (0)