bulma/docs/cypress/integration/form/checkbox-radio.spec.js
Jeremy Thomas 0ce084170a
Setup cypress (#3436)
* Setup Cypress tests for box and button

* Add container tests

* Add Cypress workflow

* Use npm install

* Update Cypress workflow

* Add Jekyll build

* Test other action

* Test custom setup

* Use other ruby action

* Test without flag

* Move cypress to docs folder

* Record runs

* Add Content, Icon, Image specs

* Add Notification specs

* Add Progress and Table specs

* Add Tags specs

* Add Title specs

* Add breadcrumb specs

* Add more specs

* Add media specs

* Add menu specs

* Add modal specs

* Add navbar specs

* Add pagination specs

* Add panel specs

* Add tabs specs, Add form checkbox radio specs

* Add utils

* Add file specs

* Add input textarea specs

* Add select specs

* Add form tools specs

* Add other elements specs

* Add footer and hero specs

* Add Hero specs

* Add section specs

* Add grid specs

* Add column sizes specs

* Add tiles specs

* Add generic specs

* Fix generic tests

* Make font family test looser

* Remove system-ui test

* Remove important flag

* Fix disabled select color
2022-05-08 13:55:16 +01:00

78 lines
2.2 KiB
JavaScript

describe("Form/Checkbox", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/checkbox-radio/");
});
it("has a Checkbox", () => {
cy.get(".checkbox").should("exist");
});
it("has a correct Checkbox", () => {
cy.get("#checkbox").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("inline-block");
expect(cs.lineHeight).to.equal("20px");
expect(cs.position).to.equal("relative");
});
cy.get("#checkbox input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
});
});
it("has a correct disabled Checkbox", () => {
cy.get("#checkbox-disabled").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-light"));
expect(cs.cursor).to.equal("not-allowed");
});
cy.get("#checkbox-disabled input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("not-allowed");
});
});
});
describe("Form/Radio", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/form/checkbox-radio/");
});
it("has a Radio", () => {
cy.get(".radio").should("exist");
});
it("has a correct Radio", () => {
cy.get("#radio .radio").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
expect(cs.display).to.equal("inline-block");
expect(cs.lineHeight).to.equal("20px");
expect(cs.position).to.equal("relative");
});
cy.get("#radio input").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.cursor).to.equal("pointer");
});
});
it("has a correct disabled Radio", () => {
cy.get("#radio .radio[disabled]").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-light"));
expect(cs.cursor).to.equal("not-allowed");
});
});
it("has correct Radio spacing", () => {
cy.get("#radio .radio + .radio").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.marginLeft).to.equal("8px");
});
});
});