bulma/docs/cypress/integration/components/dropdown.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

65 lines
2.1 KiB
JavaScript

describe("Components/Dropdown", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/dropdown/");
});
it("has a Dropdown", () => {
cy.get(".dropdown").should("exist");
});
it("has a correct Dropdown Content", () => {
cy.get("#dropdown .dropdown-content").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.borderRadius).to.equal("4px");
expect(cs.boxShadow).to.equal(
"rgba(10, 10, 10, 0.1) 0px 8px 16px -2px, rgba(10, 10, 10, 0.02) 0px 0px 0px 1px"
);
expect(cs.paddingBottom).to.equal("8px");
expect(cs.paddingTop).to.equal("8px");
});
});
it("has a correct Dropdown Menu", () => {
cy.get("#dropdown .dropdown-menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("none");
expect(cs.paddingTop).to.equal("4px");
expect(cs.position).to.equal("absolute");
expect(cs.zIndex).to.equal("20");
});
cy.get("#dropdown-active .dropdown-menu").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.display).to.equal("block");
});
});
it("has a correct Dropdown Item", () => {
cy.get("#dropdown .dropdown-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text"));
expect(cs.display).to.equal("block");
});
cy.get("#dropdown a.dropdown-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.width).to.equal("100%");
});
cy.get("#dropdown a.dropdown-item.is-active").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("link"));
expect(cs.color).to.equal(Cypress.env("link-invert"));
});
});
it("has a correct Dropdown Divider", () => {
cy.get("#dropdown .dropdown-divider").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("grey-lightest"));
expect(cs.height).to.equal("1px");
});
});
});