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

77 lines
2.6 KiB
JavaScript

describe("Components/Card", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/card/");
});
it("has a Card", () => {
cy.get(".card").should("exist");
});
it("has a correct Card", () => {
cy.get("#card").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
expect(cs.color).to.equal(Cypress.env("text"));
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"
);
});
});
it("has correct Card Item border-radius", () => {
cy.get("#card-only-content > .card-content:first-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderTopLeftRadius).to.equal("4px");
expect(cs.borderTopRightRadius).to.equal("4px");
});
cy.get("#card-only-content > .card-content:last-child").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.borderBottomLeftRadius).to.equal("4px");
expect(cs.borderBottomRightRadius).to.equal("4px");
});
});
it("has correct Card Header", () => {
cy.get("#card-header-content > .card-header").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.boxShadow).to.equal("rgba(10, 10, 10, 0.1) 0px 2px 4px 0px");
});
cy.get("#card-header-content .card-header-title").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.fontWeight).to.equal("700");
expect(cs.padding).to.equal("12px 16px");
});
cy.get("#card-header-content .card-header-icon").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("12px 16px");
});
});
it("has correct Card Content", () => {
cy.get("#card .card-content").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("24px");
});
});
it("has correct Card Footer", () => {
cy.get("#card .card-footer").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
expect(cs.borderTopColor).to.equal(Cypress.env("grey-lightest"));
expect(cs.borderTopStyle).to.equal("solid");
expect(cs.borderTopWidth).to.equal("1px");
});
cy.get("#card .card-footer-item").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.padding).to.equal("12px");
});
});
});