Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checkedValue="true"
fieldType="checkbox">
</approvalcheckbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
jcr:primaryType="nt:unstructured"
jcr:title="I agree to the terms &amp; conditions"
sling:resourceType="core/fd/components/form/checkbox/v1/checkbox"
required="true"
enabled="false"
checkedValue="true"
fieldType="checkbox">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
})
})
})

})