mirror of
https://github.com/jgthms/bulma
synced 2026-03-19 11:54:30 -07:00
Update dependencies
This commit is contained in:
77
docs/cypress/e2e/form/checkbox-radio.spec.js
Normal file
77
docs/cypress/e2e/form/checkbox-radio.spec.js
Normal file
@@ -0,0 +1,77 @@
|
||||
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");
|
||||
});
|
||||
});
|
||||
});
|
||||
156
docs/cypress/e2e/form/file.spec.js
Normal file
156
docs/cypress/e2e/form/file.spec.js
Normal file
@@ -0,0 +1,156 @@
|
||||
describe("Form/File", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/file/");
|
||||
});
|
||||
|
||||
it("has a File", () => {
|
||||
cy.get(".file").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct File", () => {
|
||||
cy.get("#file").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
expect(cs.justifyContent).to.equal("flex-start");
|
||||
expect(cs.position).to.equal("relative");
|
||||
});
|
||||
|
||||
cy.get("#file .file-input").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.opacity).to.equal("0");
|
||||
expect(cs.position).to.equal("absolute");
|
||||
});
|
||||
|
||||
cy.get("#file .file-cta, #file .file-name").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderColor).to.equal(Cypress.env("border"));
|
||||
expect(cs.borderRadius).to.equal("4px");
|
||||
});
|
||||
|
||||
cy.get("#file .file-cta").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main-ter"));
|
||||
expect(cs.color).to.equal(Cypress.env("text"));
|
||||
});
|
||||
|
||||
cy.get("#file .file-icon").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.alignItems).to.equal("center");
|
||||
expect(cs.display).to.equal("flex");
|
||||
expect(cs.height).to.equal("16px");
|
||||
expect(cs.justifyContent).to.equal("center");
|
||||
expect(cs.width).to.equal("16px");
|
||||
});
|
||||
});
|
||||
|
||||
it(`has correct color File`, () => {
|
||||
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(`#file-${name} .file-cta`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(baseColor);
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has correct File sizes", () => {
|
||||
cy.get("#file-small").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").small}px`);
|
||||
});
|
||||
|
||||
cy.get("#file-normal").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").normal}px`);
|
||||
});
|
||||
|
||||
cy.get("#file-medium").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").medium}px`);
|
||||
});
|
||||
|
||||
cy.get("#file-large").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").large}px`);
|
||||
});
|
||||
});
|
||||
|
||||
it("has correct File With Name", () => {
|
||||
cy.get("#file-with-name .file-cta").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderBottomRightRadius).to.equal("0px");
|
||||
expect(cs.borderTopRightRadius).to.equal("0px");
|
||||
});
|
||||
|
||||
cy.get("#file-with-name .file-name").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderColor).to.equal(Cypress.env("border"));
|
||||
expect(cs.borderStyle).to.equal("solid");
|
||||
expect(cs.borderWidth).to.equal("1px 1px 1px 0px");
|
||||
expect(cs.borderBottomLeftRadius).to.equal("0px");
|
||||
expect(cs.borderTopLeftRadius).to.equal("0px");
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.overflow).to.equal("hidden");
|
||||
});
|
||||
});
|
||||
|
||||
it("has correct File Boxed", () => {
|
||||
cy.get("#file-boxed .file-label").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexDirection).to.equal("column");
|
||||
});
|
||||
|
||||
cy.get("#file-boxed .file-cta").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexDirection).to.equal("column");
|
||||
expect(cs.padding).to.equal("16px 48px");
|
||||
});
|
||||
|
||||
cy.get("#file-boxed .file-name").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderWidth).to.equal("0px 1px 1px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has correct File Centered", () => {
|
||||
cy.get("#file-centered").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("center");
|
||||
});
|
||||
});
|
||||
|
||||
it("has correct File Right", () => {
|
||||
cy.get("#file-right").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("flex-end");
|
||||
});
|
||||
|
||||
cy.get("#file-right .file-cta").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderBottomLeftRadius).to.equal("0px");
|
||||
expect(cs.borderTopLeftRadius).to.equal("0px");
|
||||
});
|
||||
|
||||
cy.get("#file-right .file-name").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderBottomRightRadius).to.equal("0px");
|
||||
expect(cs.borderTopRightRadius).to.equal("0px");
|
||||
expect(cs.borderWidth).to.equal("1px 0px 1px 1px");
|
||||
expect(cs.order).to.equal("-1");
|
||||
});
|
||||
});
|
||||
|
||||
it("has correct File fullwidth", () => {
|
||||
cy.get("#file-fullwidth .file-name").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexGrow).to.equal("1");
|
||||
expect(cs.maxWidth).to.equal("none");
|
||||
});
|
||||
});
|
||||
});
|
||||
153
docs/cypress/e2e/form/input-textarea.spec.js
Normal file
153
docs/cypress/e2e/form/input-textarea.spec.js
Normal file
@@ -0,0 +1,153 @@
|
||||
describe("Form/Input", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/input-textarea/");
|
||||
});
|
||||
|
||||
it("has a Input", () => {
|
||||
cy.get(".input").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Input", () => {
|
||||
cy.get("#input").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.alignItems).to.equal("center");
|
||||
expect(cs.borderStyle).to.equal("solid");
|
||||
expect(cs.borderWidth).to.equal("1px");
|
||||
expect(cs.borderRadius).to.equal(Cypress.env("control-radius"));
|
||||
expect(cs.boxShadow).to.equal(Cypress.env("input-shadow"));
|
||||
expect(cs.display).to.equal("inline-flex");
|
||||
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
|
||||
expect(cs.height).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.justifyContent).to.equal("flex-start");
|
||||
expect(cs.lineHeight).to.equal(Cypress.env("control-line-height"));
|
||||
expect(cs.paddingBottom).to.equal(
|
||||
Cypress.env("control-padding-vertical")
|
||||
);
|
||||
expect(cs.paddingLeft).to.equal(
|
||||
Cypress.env("control-padding-horizontal")
|
||||
);
|
||||
expect(cs.paddingRight).to.equal(
|
||||
Cypress.env("control-padding-horizontal")
|
||||
);
|
||||
expect(cs.paddingTop).to.equal(Cypress.env("control-padding-vertical"));
|
||||
expect(cs.position).to.equal("relative");
|
||||
expect(cs.verticalAlign).to.equal("top");
|
||||
});
|
||||
});
|
||||
|
||||
it(`has correct color Input`, () => {
|
||||
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(`#input-${name}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderColor).to.equal(baseColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has correct Input sizes", () => {
|
||||
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
|
||||
const size = Cypress.env("just-sizes")[i];
|
||||
|
||||
cy.get(`#input-${size}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[size]}px`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has a correct fullwidth Input", () => {
|
||||
let viewport;
|
||||
|
||||
cy.document()
|
||||
.then((doc) => {
|
||||
return doc.documentElement.getBoundingClientRect();
|
||||
})
|
||||
.then((rect) => {
|
||||
viewport = rect;
|
||||
});
|
||||
|
||||
cy.get("#input-fullwidth").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.width).to.equal(`${viewport.width}px`);
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct fullwidth Input", () => {
|
||||
cy.get("#input-inline").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("inline");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct rounded Input", () => {
|
||||
cy.get("#input-rounded").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderRadius).to.equal("9999px");
|
||||
expect(cs.paddingLeft).to.equal("17px");
|
||||
expect(cs.paddingRight).to.equal("17px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct static Input", () => {
|
||||
cy.get("#input-static").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.borderColor).to.equal(Cypress.env("transparent"));
|
||||
expect(cs.boxShadow).to.equal("none");
|
||||
expect(cs.paddingLeft).to.equal("0px");
|
||||
expect(cs.paddingRight).to.equal("0px");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form/Textarea", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/input-textarea/");
|
||||
});
|
||||
|
||||
it("has a Textarea", () => {
|
||||
cy.get(".textarea").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Textarea", () => {
|
||||
cy.get("#textarea").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.alignItems).to.equal("center");
|
||||
expect(cs.borderStyle).to.equal("solid");
|
||||
expect(cs.borderWidth).to.equal("1px");
|
||||
expect(cs.borderRadius).to.equal(Cypress.env("control-radius"));
|
||||
expect(cs.boxShadow).to.equal(Cypress.env("input-shadow"));
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
|
||||
expect(cs.justifyContent).to.equal("flex-start");
|
||||
expect(cs.lineHeight).to.equal(Cypress.env("control-line-height"));
|
||||
expect(cs.paddingBottom).to.equal(
|
||||
Cypress.env("control-padding-horizontal")
|
||||
);
|
||||
expect(cs.paddingLeft).to.equal(
|
||||
Cypress.env("control-padding-horizontal")
|
||||
);
|
||||
expect(cs.paddingRight).to.equal(
|
||||
Cypress.env("control-padding-horizontal")
|
||||
);
|
||||
expect(cs.paddingTop).to.equal(Cypress.env("control-padding-horizontal"));
|
||||
expect(cs.position).to.equal("relative");
|
||||
expect(cs.resize).to.equal("vertical");
|
||||
expect(cs.verticalAlign).to.equal("top");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Textarea fixed", () => {
|
||||
cy.get("#textarea-fixed").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.resize).to.equal("none");
|
||||
});
|
||||
});
|
||||
});
|
||||
86
docs/cypress/e2e/form/select.spec.js
Normal file
86
docs/cypress/e2e/form/select.spec.js
Normal file
@@ -0,0 +1,86 @@
|
||||
describe("Form/Select", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/select/");
|
||||
});
|
||||
|
||||
it("has a Select", () => {
|
||||
cy.get(".select").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Select", () => {
|
||||
cy.get("#select").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("inline-block");
|
||||
expect(cs.height).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.maxWidth).to.equal("100%");
|
||||
expect(cs.position).to.equal("relative");
|
||||
expect(cs.verticalAlign).to.equal("top");
|
||||
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.borderColor).to.equal(Cypress.env("link"));
|
||||
});
|
||||
|
||||
cy.get("#select select").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.cursor).to.equal("pointer");
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.fontSize).to.equal("16px");
|
||||
expect(cs.height).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.maxWidth).to.equal("100%");
|
||||
});
|
||||
});
|
||||
|
||||
it(`has correct color Select`, () => {
|
||||
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(`#select-${name}`).then(($) => {
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.borderColor).to.equal(baseColor);
|
||||
});
|
||||
|
||||
cy.get(`#select-${name} select`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderColor).to.equal(baseColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has correct Select sizes", () => {
|
||||
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
|
||||
const size = Cypress.env("just-sizes")[i];
|
||||
|
||||
cy.get(`#select-${size}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[size]}px`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has a correct Select multiple", () => {
|
||||
cy.get("#select-multiple").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.height).to.not.equal(Cypress.env("control-height"));
|
||||
});
|
||||
|
||||
cy.get("#select-multiple select").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.cursor).to.equal("pointer");
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.fontSize).to.equal("16px");
|
||||
expect(cs.height).to.not.equal(Cypress.env("control-height"));
|
||||
expect(cs.maxWidth).to.equal("100%");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Select disabled", () => {
|
||||
cy.get("#select-disabled").then(($) => {
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.borderColor).to.equal(Cypress.env("text-light"));
|
||||
});
|
||||
});
|
||||
});
|
||||
316
docs/cypress/e2e/form/tools.spec.js
Normal file
316
docs/cypress/e2e/form/tools.spec.js
Normal file
@@ -0,0 +1,316 @@
|
||||
import { setDesktop } from "../utils";
|
||||
|
||||
describe("Form/Label", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
|
||||
});
|
||||
|
||||
it("has a Label", () => {
|
||||
cy.get(".label").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Label", () => {
|
||||
cy.get("#label").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.color).to.equal(Cypress.env("text-strong"));
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
|
||||
expect(cs.fontWeight).to.equal(Cypress.env("weight-bold"));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("has correct Label sizes", () => {
|
||||
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
|
||||
const size = Cypress.env("just-sizes")[i];
|
||||
|
||||
cy.get(`#label-${size}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal(`${Cypress.env("sizes")[size]}px`);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form/Help", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
|
||||
});
|
||||
|
||||
it("has a Help", () => {
|
||||
cy.get(".help").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Help", () => {
|
||||
cy.get("#help").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("block");
|
||||
expect(cs.fontSize).to.equal(Cypress.env("size-small"));
|
||||
expect(cs.marginTop).to.equal("4px");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("has correct Help colors", () => {
|
||||
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(`#help-${name}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.color).to.equal(baseColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form/Field", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
|
||||
setDesktop();
|
||||
});
|
||||
|
||||
it("has a Field", () => {
|
||||
cy.get(".field").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Field", () => {
|
||||
cy.get("#field").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.marginBottom).to.equal("12px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field with addons", () => {
|
||||
cy.get("#field-has-addons").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
expect(cs.justifyContent).to.equal("flex-start");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field with addons centered", () => {
|
||||
cy.get("#field-has-addons-centered").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("center");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field with addons right", () => {
|
||||
cy.get("#field-has-addons-right").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("flex-end");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field with addons fullwidth .control", () => {
|
||||
cy.get("#field-has-addons-fullwidth .control").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexGrow).to.equal("1");
|
||||
expect(cs.flexShrink).to.equal("0");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field grouped", () => {
|
||||
cy.get("#field-is-grouped").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
expect(cs.justifyContent).to.equal("flex-start");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field grouped centered", () => {
|
||||
cy.get("#field-is-grouped-centered").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("center");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field grouped right", () => {
|
||||
cy.get("#field-is-grouped-right").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("flex-end");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field grouped multiline", () => {
|
||||
cy.get("#field-is-grouped-multiline").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexWrap).to.equal("wrap");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Field horizontal", () => {
|
||||
cy.get("#field-is-horizontal").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form/Field Label", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
|
||||
setDesktop();
|
||||
});
|
||||
|
||||
it("has a Field Label", () => {
|
||||
cy.get(".field-label").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Field Label", () => {
|
||||
cy.get("#field-label").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexBasis).to.equal("0px");
|
||||
expect(cs.flexGrow).to.equal("1");
|
||||
expect(cs.flexShrink).to.equal("0");
|
||||
expect(cs.textAlign).to.equal("right");
|
||||
});
|
||||
|
||||
cy.get("#field-label .label").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal("16px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has correct Field Label sizes", () => {
|
||||
for (let i = 0; i < Cypress.env("just-sizes").length; i++) {
|
||||
const size = Cypress.env("just-sizes")[i];
|
||||
|
||||
cy.get(`#field-label-${size}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
const sizeValue = Cypress.env("sizes")[size];
|
||||
expect(cs.fontSize).to.equal(`${sizeValue}px`);
|
||||
expect(cs.paddingTop).to.equal(`${sizeValue * 0.375}px`);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form/Field Body", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
|
||||
setDesktop();
|
||||
});
|
||||
|
||||
it("has a Field Body", () => {
|
||||
cy.get(".field-body").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Field Body", () => {
|
||||
cy.get("#field-body").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
expect(cs.flexBasis).to.equal("0px");
|
||||
expect(cs.flexGrow).to.equal("5");
|
||||
expect(cs.flexShrink).to.equal("1");
|
||||
});
|
||||
|
||||
cy.get("#field-body .field").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.marginBottom).to.equal("0px");
|
||||
});
|
||||
|
||||
cy.get("#field-body > .field").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexShrink).to.equal("1");
|
||||
});
|
||||
|
||||
cy.get("#field-body .field .field").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.marginBottom).to.equal("0px");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("Form/Control", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/form/tools/");
|
||||
setDesktop();
|
||||
});
|
||||
|
||||
it("has a Control", () => {
|
||||
cy.get(".control").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Control", () => {
|
||||
cy.get("#control").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.boxSizing).to.equal("border-box");
|
||||
expect(cs.clear).to.equal("both");
|
||||
expect(cs.fontSize).to.equal(Cypress.env("size-normal"));
|
||||
expect(cs.position).to.equal("relative");
|
||||
expect(cs.textAlign).to.equal("start");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Control with icons left", () => {
|
||||
cy.get("#control-has-icons-left .icon").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.color).to.equal(Cypress.env("grey-lighter"));
|
||||
expect(cs.height).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.left).to.equal("0px");
|
||||
expect(cs.pointerEvents).to.equal("none");
|
||||
expect(cs.position).to.equal("absolute");
|
||||
expect(cs.top).to.equal("0px");
|
||||
expect(cs.width).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.zIndex).to.equal("4");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Control with icons right", () => {
|
||||
cy.get("#control-has-icons-right .icon").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.color).to.equal(Cypress.env("grey-lighter"));
|
||||
expect(cs.height).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.pointerEvents).to.equal("none");
|
||||
expect(cs.position).to.equal("absolute");
|
||||
expect(cs.right).to.equal("0px");
|
||||
expect(cs.top).to.equal("0px");
|
||||
expect(cs.width).to.equal(Cypress.env("control-height"));
|
||||
expect(cs.zIndex).to.equal("4");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct loading Control", () => {
|
||||
cy.get("#control-loading").then(($) => {
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.animationDuration).to.equal("0.5s");
|
||||
expect(after.animationIterationCount).to.equal("infinite");
|
||||
expect(after.animationName).to.equal("spinAround");
|
||||
expect(after.animationTimingFunction).to.equal("linear");
|
||||
expect(after.borderBottomColor).to.equal(Cypress.env("grey-lighter"));
|
||||
expect(after.borderLeftColor).to.equal(Cypress.env("grey-lighter"));
|
||||
expect(after.borderRightColor).to.equal(Cypress.env("transparent"));
|
||||
expect(after.borderTopColor).to.equal(Cypress.env("transparent"));
|
||||
expect(after.borderRadius).to.equal("9999px");
|
||||
expect(after.borderStyle).to.equal("solid");
|
||||
expect(after.borderWidth).to.equal("2px");
|
||||
expect(after.content).to.equal('""');
|
||||
expect(after.display).to.equal("block");
|
||||
expect(after.height).to.equal("16px");
|
||||
expect(after.position).to.equal("absolute");
|
||||
expect(after.top).to.equal(`${0.625 * 16}px`);
|
||||
expect(after.width).to.equal("16px");
|
||||
expect(after.zIndex).to.equal("4");
|
||||
});
|
||||
|
||||
cy.get("#control-loading-small").then(($) => {
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.fontSize).to.equal(Cypress.env("size-small"));
|
||||
});
|
||||
|
||||
cy.get("#control-loading-medium").then(($) => {
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.fontSize).to.equal(Cypress.env("size-medium"));
|
||||
});
|
||||
|
||||
cy.get("#control-loading-large").then(($) => {
|
||||
const after = window.getComputedStyle($[0], "after");
|
||||
expect(after.fontSize).to.equal(Cypress.env("size-large"));
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user