Skip to content

Commit

Permalink
add test for checkbox (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
jay-deshmukh authored Nov 14, 2023
1 parent bda3d30 commit 98fa742
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions src/form/components/Checkbox/Checkbox.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,35 @@
import React from "react";
import Checkbox from './index';

describe('Checkbox', () => {
it('TODO', () => {
expect(true).to.equal(true);

it('Checkbox : with error', () => {
const label = "This is a checkbox";
const error = "Please fix the error"
cy.mount(<Checkbox
label={label}
error={error}
id="testCheckbox"
/>)

cy.contains(label).should('exist')
cy.contains(error).should('exist')
cy.get('#testCheckbox').should('not.be.checked');
cy.contains(label).should('exist').click();
cy.get('#testCheckbox').should('be.checked');
});

it('Checkbox : with disabled checked', () => {
const label = "This is a checkbox";
cy.mount(<Checkbox
label={label}
id="testCheckbox"
disabled
/>)

cy.contains(label).should('exist')
cy.get('#testCheckbox').should('not.be.checked');
cy.contains(label).should('exist').click();
cy.get('#testCheckbox').should('not.be.checked');
});
});

0 comments on commit 98fa742

Please sign in to comment.