mirror of
https://github.com/jgthms/bulma
synced 2026-03-15 02:04:29 -07:00
Add Hero specs
This commit is contained in:
@@ -18,6 +18,12 @@ title: Layout/Hero
|
|||||||
{{ content }}
|
{{ content }}
|
||||||
</section>
|
</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">
|
<section id="hero-small" class="hero is-small">
|
||||||
{{ content }}
|
{{ content }}
|
||||||
</section>
|
</section>
|
||||||
@@ -43,3 +49,8 @@ title: Layout/Hero
|
|||||||
{{ content }}
|
{{ content }}
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</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", () => {
|
describe("Layout/Hero", () => {
|
||||||
beforeEach(() => {
|
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", () => {
|
it("has a correct small Hero", () => {
|
||||||
cy.get("#hero-small .hero-body").then(($) => {
|
cy.get("#hero-small .hero-body").then(($) => {
|
||||||
const cs = window.getComputedStyle($[0]);
|
const cs = window.getComputedStyle($[0]);
|
||||||
@@ -74,4 +90,61 @@ describe("Layout/Hero", () => {
|
|||||||
expect(cs.flexShrink).to.equal("1");
|
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");
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user