mirror of
https://github.com/jgthms/bulma
synced 2026-03-20 12:24:28 -07:00
Move cypress to docs folder
This commit is contained in:
1
docs/cypress/.gitignore
vendored
Normal file
1
docs/cypress/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
videos
|
||||
@@ -1,8 +0,0 @@
|
||||
---
|
||||
layout: cypress
|
||||
title: Elements/Box
|
||||
---
|
||||
|
||||
<div class="box">
|
||||
I'm in a box.
|
||||
</div>
|
||||
@@ -1,66 +0,0 @@
|
||||
---
|
||||
layout: cypress
|
||||
title: Elements/Button
|
||||
---
|
||||
|
||||
<div class="block">
|
||||
<button id="button-default" class="button">
|
||||
Button
|
||||
</button>
|
||||
|
||||
<button id="button-hover" class="button is-hovered">
|
||||
Hover
|
||||
</button>
|
||||
|
||||
<button id="button-focus" class="button is-focused">
|
||||
Focus
|
||||
</button>
|
||||
|
||||
<button id="button-active" class="button is-active">
|
||||
Active
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{% for color in site.data.colors.justColors %}
|
||||
<div class="block">
|
||||
<button id="button-{{ color }}" class="button is-{{ color }}">
|
||||
{{ color | capitalize }}
|
||||
</button>
|
||||
|
||||
<button id="button-{{ color }}-hover" class="button is-hovered is-{{ color }}">
|
||||
Hover
|
||||
</button>
|
||||
|
||||
<button id="button-{{ color }}-focus" class="button is-focused is-{{ color }}">
|
||||
Focus
|
||||
</button>
|
||||
|
||||
<button id="button-{{ color }}-active" class="button is-active is-{{ color }}">
|
||||
Active
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<button id="button-{{ color }}-outlined" class="button is-outlined is-{{ color }}">
|
||||
Outlined
|
||||
</button>
|
||||
|
||||
<button id="button-{{ color }}-outlined-hover" class="button is-outlined is-hovered is-{{ color }}">
|
||||
Hover
|
||||
</button>
|
||||
|
||||
<button id="button-{{ color }}-inverted" class="button is-inverted is-{{ color }}">
|
||||
Inverted
|
||||
</button>
|
||||
|
||||
<button id="button-{{ color }}-inverted-outlined" class="button is-inverted is-outlined is-{{ color }}">
|
||||
Inverted Outlined
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<button id="button-{{ color }}-light" class="button is-light is-{{ color }}">
|
||||
Light
|
||||
</button>
|
||||
</div>
|
||||
{% endfor %}
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
layout: cypress
|
||||
title: Elements/Container
|
||||
---
|
||||
|
||||
<div id="container" class="container">
|
||||
I'm a container
|
||||
</div>
|
||||
|
||||
<div id="container-max-desktop" class="container is-max-desktop">
|
||||
I'm a max desktop container
|
||||
</div>
|
||||
|
||||
<div id="container-max-widescreen" class="container is-max-widescreen">
|
||||
I'm a max widescreen container
|
||||
</div>
|
||||
|
||||
<div id="container-widescreen" class="container is-widescreen">
|
||||
I'm a widescreen container
|
||||
</div>
|
||||
|
||||
<div id="container-fullhd" class="container is-fullhd">
|
||||
I'm a fullhd container
|
||||
</div>
|
||||
|
||||
<div id="container-fluid" class="container is-fluid">
|
||||
I'm a fluid container
|
||||
</div>
|
||||
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')
|
||||
Reference in New Issue
Block a user