mirror of
https://github.com/jgthms/bulma
synced 2026-03-20 20:24:30 -07:00
Move cypress to docs folder
This commit is contained in:
2
docs/cypress/integration/.gitignore
vendored
Normal file
2
docs/cypress/integration/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
1-getting-started
|
||||
2-advanced-examples
|
||||
23
docs/cypress/integration/elements/box.spec.js
Normal file
23
docs/cypress/integration/elements/box.spec.js
Normal file
@@ -0,0 +1,23 @@
|
||||
describe("Elements/Box", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/elements/box/");
|
||||
});
|
||||
|
||||
it("has a .box element", () => {
|
||||
cy.get(".box").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct .box element", () => {
|
||||
cy.get(".box").then(($) => {
|
||||
const el = $[0];
|
||||
const cs = window.getComputedStyle(el);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
|
||||
expect(cs.borderRadius).to.equal("6px");
|
||||
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.color).to.equal(Cypress.env("text"));
|
||||
expect(cs.padding).to.equal("20px");
|
||||
});
|
||||
});
|
||||
});
|
||||
124
docs/cypress/integration/elements/button.spec.js
Normal file
124
docs/cypress/integration/elements/button.spec.js
Normal file
@@ -0,0 +1,124 @@
|
||||
describe("Elements/Button", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/elements/button/");
|
||||
});
|
||||
|
||||
it("has a Button", () => {
|
||||
cy.get(".button").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Button", () => {
|
||||
cy.get("#button-default").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
|
||||
expect(cs.borderColor).to.equal(Cypress.env("grey-lighter"));
|
||||
expect(cs.borderRadius).to.equal("4px");
|
||||
expect(cs.color).to.equal(Cypress.env("grey-darker"));
|
||||
expect(cs.height).to.equal("40px");
|
||||
expect(cs.lineHeight).to.equal("24px");
|
||||
expect(cs.padding).to.equal("7px 16px");
|
||||
});
|
||||
});
|
||||
|
||||
// States
|
||||
it("has a correct hover Button", () => {
|
||||
cy.get("#button-hover").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
|
||||
expect(cs.borderColor).to.equal(Cypress.env("grey-light"));
|
||||
expect(cs.borderRadius).to.equal("4px");
|
||||
expect(cs.color).to.equal(Cypress.env("grey-darker"));
|
||||
expect(cs.height).to.equal("40px");
|
||||
expect(cs.lineHeight).to.equal("24px");
|
||||
expect(cs.padding).to.equal("7px 16px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct focus Button", () => {
|
||||
cy.get("#button-focus").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
|
||||
expect(cs.borderColor).to.equal(Cypress.env("blue"));
|
||||
expect(cs.borderRadius).to.equal("4px");
|
||||
expect(cs.boxShadow).to.equal(
|
||||
`rgba${Cypress.env("blue").slice(3, -1)}, 0.25) 0px 0px 0px 2px`
|
||||
);
|
||||
expect(cs.color).to.equal(Cypress.env("grey-darker"));
|
||||
expect(cs.height).to.equal("40px");
|
||||
expect(cs.lineHeight).to.equal("24px");
|
||||
expect(cs.padding).to.equal("7px 16px");
|
||||
});
|
||||
});
|
||||
|
||||
// Colors
|
||||
it(`has correct color Buttons`, () => {
|
||||
for (let i = 0; i < Cypress.env("color-names").length; i++) {
|
||||
const name = Cypress.env("color-names")[i];
|
||||
const baseColor = Cypress.env(name);
|
||||
const invertColor = Cypress.env(`${name}-invert`);
|
||||
const lightColor = Cypress.env(`${name}-light`);
|
||||
const darkColor = Cypress.env(`${name}-dark`);
|
||||
|
||||
cy.get(`#button-${name}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(baseColor);
|
||||
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-hover`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-focus`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.boxShadow).to.equal(
|
||||
`rgba${baseColor.slice(3, -1)}, 0.25) 0px 0px 0px 2px`
|
||||
);
|
||||
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-active`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-inverted`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(invertColor);
|
||||
expect(cs.color).to.equal(baseColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-outlined`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.borderColor).to.equal(baseColor);
|
||||
expect(cs.color).to.equal(baseColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-outlined-hover`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(baseColor);
|
||||
expect(cs.borderColor).to.equal(baseColor);
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-inverted-outlined`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.borderColor).to.equal(invertColor);
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#button-${name}-light`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(lightColor);
|
||||
expect(cs.color).to.equal(darkColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
169
docs/cypress/integration/elements/container.spec.js
Normal file
169
docs/cypress/integration/elements/container.spec.js
Normal file
@@ -0,0 +1,169 @@
|
||||
describe("Elements/Container", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/elements/container/");
|
||||
});
|
||||
|
||||
it("has a Container element", () => {
|
||||
cy.get("#container").should("exist");
|
||||
});
|
||||
|
||||
it("has fullwidth mobile Containers", () => {
|
||||
cy.viewport(
|
||||
Cypress.env("viewports").mobile[0],
|
||||
Cypress.env("viewports").mobile[1]
|
||||
);
|
||||
|
||||
let viewport;
|
||||
|
||||
cy.document()
|
||||
.then((doc) => {
|
||||
return doc.documentElement.getBoundingClientRect();
|
||||
})
|
||||
.then((rect) => {
|
||||
viewport = rect;
|
||||
});
|
||||
|
||||
cy.get("#container").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
|
||||
cy.get("#container-fluid").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
|
||||
cy.get("#container-max-desktop").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
|
||||
cy.get("#container-max-widescreen").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
});
|
||||
|
||||
it("has centered desktop Containers", () => {
|
||||
cy.viewport(
|
||||
Cypress.env("viewports").desktop[0],
|
||||
Cypress.env("viewports").desktop[1]
|
||||
);
|
||||
|
||||
let viewport;
|
||||
|
||||
cy.document()
|
||||
.then((doc) => {
|
||||
return doc.documentElement.getBoundingClientRect();
|
||||
})
|
||||
.then((rect) => {
|
||||
viewport = rect;
|
||||
});
|
||||
|
||||
cy.get("#container").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("960px");
|
||||
});
|
||||
|
||||
cy.get("#container-widescreen").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
|
||||
cy.get("#container-fullhd").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
});
|
||||
|
||||
it("has centered widescreen Containers", () => {
|
||||
cy.viewport(
|
||||
Cypress.env("viewports").widescreen[0],
|
||||
Cypress.env("viewports").widescreen[1]
|
||||
);
|
||||
|
||||
let viewport;
|
||||
|
||||
cy.document()
|
||||
.then((doc) => {
|
||||
return doc.documentElement.getBoundingClientRect();
|
||||
})
|
||||
.then((rect) => {
|
||||
viewport = rect;
|
||||
});
|
||||
|
||||
cy.get("#container").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("1152px");
|
||||
});
|
||||
|
||||
cy.get("#container-max-desktop").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("960px");
|
||||
});
|
||||
|
||||
cy.get("#container-widescreen").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("1152px");
|
||||
});
|
||||
|
||||
cy.get("#container-fullhd").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
});
|
||||
|
||||
it("has centered fullhd Containers", () => {
|
||||
cy.viewport(
|
||||
Cypress.env("viewports").fullhd[0],
|
||||
Cypress.env("viewports").fullhd[1]
|
||||
);
|
||||
|
||||
cy.get("#container").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("1344px");
|
||||
});
|
||||
|
||||
cy.get("#container-max-desktop").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("960px");
|
||||
});
|
||||
|
||||
cy.get("#container-max-widescreen").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("1152px");
|
||||
});
|
||||
|
||||
cy.get("#container-widescreen").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("1344px");
|
||||
});
|
||||
|
||||
cy.get("#container-fullhd").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("1344px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a fullwidth fluid Container", () => {
|
||||
cy.viewport(
|
||||
Cypress.env("viewports").fullhd[0],
|
||||
Cypress.env("viewports").fullhd[1]
|
||||
);
|
||||
|
||||
let viewport;
|
||||
|
||||
cy.document()
|
||||
.then((doc) => {
|
||||
return doc.documentElement.getBoundingClientRect();
|
||||
})
|
||||
.then((rect) => {
|
||||
viewport = rect;
|
||||
});
|
||||
|
||||
cy.get("#container-fluid").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user