Add file specs

This commit is contained in:
Jeremy Thomas 2022-05-01 14:13:47 +02:00
parent 2a4ba6becd
commit 9edad35184
8 changed files with 10575 additions and 5092 deletions

71
docs/cyp/form/file.html Normal file
View File

@ -0,0 +1,71 @@
---
layout: cypress
title: Form/File
---
{% capture content %}
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
</label>
{% endcapture %}
{% capture content_with_name %}
<label class="file-label">
<input class="file-input" type="file" name="resume">
<span class="file-cta">
<span class="file-icon">
<i class="fas fa-upload"></i>
</span>
<span class="file-label">
Choose a file…
</span>
</span>
<span class="file-name">
Screen Shot 2017-07-29 at 15.54.25.png
</span>
</label>
{% endcapture %}
<div id="file" class="file">
{{ content }}
</div>
{% for color in site.data.colors.justColors %}
<div id="file-{{ color }}" class="file is-{{ color }}">
{{ content }}
</div>
{% endfor %}
{% for size in site.data.sizes %}
<div id="file-{{ size }}" class="file is-{{ size }}">
{{ content }}
</div>
{% endfor %}
<div id="file-with-name" class="file has-name">
{{ content_with_name }}
</div>
<div id="file-boxed" class="file is-boxed">
{{ content_with_name }}
</div>
<div id="file-centered" class="file is-centered">
{{ content_with_name }}
</div>
<div id="file-right" class="file is-right">
{{ content_with_name }}
</div>
<div id="file-fullwidth" class="file is-fullwidth">
{{ content_with_name }}
</div>

View File

@ -59,6 +59,8 @@
"danger-dark": "rgb(204, 15, 53)",
"scheme-main": "rgb(255, 255, 255)",
"scheme-main-bis": "rgb(250, 250, 250)",
"scheme-main-ter": "rgb(245, 245, 245)",
"border": "rgb(219, 219, 219)",
"border-hover": "rgb(181, 181, 181)",
"text": "rgb(74, 74, 74)",

View File

@ -1,4 +1,4 @@
import { setMobile, setDesktop } from "../utils";
import { setMobile, setDesktop, setWidescreen, setFullHD } from "../utils";
describe("Elements/Container", () => {
beforeEach(() => {

View 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");
});
});
});

11836
docs/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,16 +5,16 @@
"author": "Jeremy Thomas <bbxdesign@gmail.com> (https://jgthms.com)",
"license": "MIT",
"devDependencies": {
"autoprefixer": "^9.7.6",
"autoprefixer": "^10.4.5",
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.7.0",
"babel-preset-es2015-ie": "^6.7.0",
"clean-css-cli": "^4.3.0",
"cypress": "^8.7.0",
"metalsmith": "^2.3.0",
"clean-css-cli": "^5.6.0",
"cypress": "^9.6.0",
"metalsmith": "^2.4.2",
"metalsmith-filter": "^1.0.2",
"node-sass": "^4.13.1",
"postcss-cli": "^7.1.0"
"node-sass": "^7.0.1",
"postcss-cli": "^9.1.0"
},
"scripts": {
"bulma-sass": "node-sass --output-style expanded bulma.scss css/bulma.css",

3570
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -27,11 +27,11 @@
"url": "https://github.com/jgthms/bulma/issues"
},
"devDependencies": {
"autoprefixer": "^9.8.6",
"clean-css-cli": "^4.3.0",
"cypress": "^8.7.0",
"node-sass": "^4.14.1",
"postcss-cli": "^7.1.2",
"autoprefixer": "^10.4.5",
"clean-css-cli": "^5.6.0",
"cypress": "^9.6.0",
"node-sass": "^7.0.1",
"postcss-cli": "^9.1.0",
"rimraf": "^3.0.2"
},
"scripts": {