mirror of
https://github.com/jgthms/bulma
synced 2026-03-18 19:34:30 -07:00
Move cypress to docs folder
This commit is contained in:
74
docs/cypress.json
Normal file
74
docs/cypress.json
Normal file
@@ -0,0 +1,74 @@
|
||||
{
|
||||
"projectId": "tnstsp",
|
||||
"env": {
|
||||
"black": "rgb(10, 10, 10)",
|
||||
"black-bis": "rgb(18, 18, 18)",
|
||||
"black-ter": "rgb(36, 36, 36)",
|
||||
"grey-darker": "rgb(54, 54, 54)",
|
||||
"grey-dark": "rgb(74, 74, 74)",
|
||||
"grey": "rgb(122, 122, 122)",
|
||||
"grey-light": "rgb(181, 181, 181)",
|
||||
"grey-lighter": "rgb(219, 219, 219)",
|
||||
"grey-lightest": "rgb(237, 237, 237)",
|
||||
"white-ter": "rgb(245, 245, 245)",
|
||||
"white-bis": "rgb(250, 250, 250)",
|
||||
"white": "rgb(255, 255, 255)",
|
||||
|
||||
"transparent": "rgba(0, 0, 0, 0)",
|
||||
"black-transparent": "rgba(0, 0, 0, 0.7)",
|
||||
|
||||
"orange": "rgb(255, 71, 15)",
|
||||
"yellow": "rgb(255, 224, 138)",
|
||||
"green": "rgb(72, 199, 142)",
|
||||
"turquoise": "rgb(0, 209, 178)",
|
||||
"cyan": "rgb(62, 142, 208)",
|
||||
"blue": "rgb(72, 95, 199)",
|
||||
"purple": "rgb(184, 107, 255)",
|
||||
"red": "rgb(241, 70, 104)",
|
||||
|
||||
"color-names": ["primary", "link", "info", "success", "warning", "danger"],
|
||||
|
||||
"primary": "rgb(0, 209, 178)",
|
||||
"primary-invert": "rgb(255, 255, 255)",
|
||||
"primary-light": "rgb(235, 255, 252)",
|
||||
"primary-dark": "rgb(0, 148, 126)",
|
||||
|
||||
"link": "rgb(72, 95, 199)",
|
||||
"link-invert": "rgb(255, 255, 255)",
|
||||
"link-light": "rgb(239, 241, 250)",
|
||||
"link-dark": "rgb(56, 80, 183)",
|
||||
|
||||
"info": "rgb(62, 142, 208)",
|
||||
"info-invert": "rgb(255, 255, 255)",
|
||||
"info-light": "rgb(239, 245, 251)",
|
||||
"info-dark": "rgb(41, 111, 168)",
|
||||
|
||||
"success": "rgb(72, 199, 142)",
|
||||
"success-invert": "rgb(255, 255, 255)",
|
||||
"success-light": "rgb(239, 250, 245)",
|
||||
"success-dark": "rgb(37, 121, 83)",
|
||||
|
||||
"warning": "rgb(255, 224, 138)",
|
||||
"warning-invert": "rgba(0, 0, 0, 0.7)",
|
||||
"warning-light": "rgb(255, 250, 235)",
|
||||
"warning-dark": "rgb(148, 108, 0)",
|
||||
|
||||
"danger": "rgb(241, 70, 104)",
|
||||
"danger-invert": "rgb(255, 255, 255)",
|
||||
"danger-light": "rgb(254, 236, 240)",
|
||||
"danger-dark": "rgb(204, 15, 53)",
|
||||
|
||||
"scheme-main": "rgb(255, 255, 255)",
|
||||
"border": "rgb(219, 219, 219)",
|
||||
"text": "rgb(74, 74, 74)",
|
||||
"text-strong": "rgb(54, 54, 54)",
|
||||
|
||||
"viewports": {
|
||||
"mobile": [320, 480],
|
||||
"tablet": [769, 640],
|
||||
"desktop": [1024, 800],
|
||||
"widescreen": [1216, 900],
|
||||
"fullhd": [1408, 1200]
|
||||
}
|
||||
}
|
||||
}
|
||||
1
docs/cypress/.gitignore
vendored
Normal file
1
docs/cypress/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
videos
|
||||
5
docs/cypress/fixtures/example.json
Normal file
5
docs/cypress/fixtures/example.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "Using fixtures to represent data",
|
||||
"email": "hello@cypress.io",
|
||||
"body": "Fixtures are a great way to mock data for responses to routes"
|
||||
}
|
||||
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`);
|
||||
});
|
||||
});
|
||||
});
|
||||
22
docs/cypress/plugins/index.js
Normal file
22
docs/cypress/plugins/index.js
Normal file
@@ -0,0 +1,22 @@
|
||||
/// <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
/**
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
31
docs/cypress/support/commands.js
Normal file
31
docs/cypress/support/commands.js
Normal file
@@ -0,0 +1,31 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add('login', (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
|
||||
|
||||
// function colorDarken(color, amount) {
|
||||
// return cy.wrap(color);
|
||||
// }
|
||||
|
||||
// Cypress.Commands.add("colorDarken", colorDarken);
|
||||
20
docs/cypress/support/index.js
Normal file
20
docs/cypress/support/index.js
Normal file
@@ -0,0 +1,20 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
1141
docs/package-lock.json
generated
1141
docs/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,7 @@
|
||||
"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",
|
||||
"metalsmith-filter": "^1.0.2",
|
||||
"node-sass": "^4.13.1",
|
||||
|
||||
Reference in New Issue
Block a user