mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-14 11:14:24 +00:00
Add Hero specs
This commit is contained in:
parent
a35710d012
commit
e093e7b45d
@ -18,6 +18,12 @@ title: Layout/Hero
|
||||
{{ content }}
|
||||
</section>
|
||||
|
||||
{% for color in site.data.colors.justColors %}
|
||||
<section id="hero-{{ color }}" class="hero is-{{ color }}">
|
||||
{{ content }}
|
||||
</section>
|
||||
{% endfor %}
|
||||
|
||||
<section id="hero-small" class="hero is-small">
|
||||
{{ content }}
|
||||
</section>
|
||||
@ -43,3 +49,8 @@ title: Layout/Hero
|
||||
{{ content }}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div id="hero-buttons" class="hero-buttons"></div>
|
||||
<div id="hero-head" class="hero-head"></div>
|
||||
<div id="hero-foot" class="hero-foot"></div>
|
||||
<div id="hero-body" class="hero-body"></div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { setDesktop } from "../utils";
|
||||
import { setMobile, setDesktop } from "../utils";
|
||||
|
||||
describe("Layout/Hero", () => {
|
||||
beforeEach(() => {
|
||||
@ -20,6 +20,22 @@ describe("Layout/Hero", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Hero 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(`#hero-${name}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(baseColor);
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has a correct small Hero", () => {
|
||||
cy.get("#hero-small .hero-body").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
@ -74,4 +90,61 @@ describe("Layout/Hero", () => {
|
||||
expect(cs.flexShrink).to.equal("1");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a Hero Buttons", () => {
|
||||
cy.get(".hero-buttons").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Hero Buttons", () => {
|
||||
cy.get("#hero-buttons").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
expect(cs.justifyContent).to.equal("center");
|
||||
expect(cs.marginTop).to.equal("24px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a Hero Head", () => {
|
||||
cy.get(".hero-head").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Hero Head", () => {
|
||||
cy.get("#hero-head").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexGrow).to.equal("0");
|
||||
expect(cs.flexShrink).to.equal("0");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a Hero Foot", () => {
|
||||
cy.get(".hero-foot").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Hero Foot", () => {
|
||||
cy.get("#hero-foot").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexGrow).to.equal("0");
|
||||
expect(cs.flexShrink).to.equal("0");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a Hero Body", () => {
|
||||
cy.get(".hero-body").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Hero Body", () => {
|
||||
cy.get("#hero-body").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.flexGrow).to.equal("1");
|
||||
expect(cs.flexShrink).to.equal("0");
|
||||
expect(cs.padding).to.equal("48px");
|
||||
});
|
||||
|
||||
setMobile();
|
||||
|
||||
cy.get("#hero-body").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.padding).to.equal("48px 24px");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user