bulma/docs/cypress/integration/components/breadcrumb.spec.js
Jeremy Thomas 0ce084170a
Setup cypress (#3436)
* Setup Cypress tests for box and button

* Add container tests

* Add Cypress workflow

* Use npm install

* Update Cypress workflow

* Add Jekyll build

* Test other action

* Test custom setup

* Use other ruby action

* Test without flag

* Move cypress to docs folder

* Record runs

* Add Content, Icon, Image specs

* Add Notification specs

* Add Progress and Table specs

* Add Tags specs

* Add Title specs

* Add breadcrumb specs

* Add more specs

* Add media specs

* Add menu specs

* Add modal specs

* Add navbar specs

* Add pagination specs

* Add panel specs

* Add tabs specs, Add form checkbox radio specs

* Add utils

* Add file specs

* Add input textarea specs

* Add select specs

* Add form tools specs

* Add other elements specs

* Add footer and hero specs

* Add Hero specs

* Add section specs

* Add grid specs

* Add column sizes specs

* Add tiles specs

* Add generic specs

* Fix generic tests

* Make font family test looser

* Remove system-ui test

* Remove important flag

* Fix disabled select color
2022-05-08 13:55:16 +01:00

99 lines
3.0 KiB
JavaScript

describe("Components/Breadcrumb", () => {
beforeEach(() => {
cy.visit("http://127.0.0.1:4000/cyp/components/breadcrumb/");
});
it("has a Breadcrumb", () => {
cy.get(".breadcrumb").should("exist");
});
it("has a correct Breadcrumb", () => {
cy.get("#breadcrumb").then(($) => {
const cs = window.getComputedStyle($[0]);
});
cy.get("#breadcrumb li:nth-child(2) a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("link"));
expect(cs.padding).to.equal("0px 12px");
});
cy.get("#breadcrumb li.is-active a").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.color).to.equal(Cypress.env("text-strong"));
expect(cs.padding).to.equal("0px 12px");
});
});
it("has correct Breadcrumb alignments", () => {
cy.get("#breadcrumb-centered ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("center");
});
cy.get("#breadcrumb-right ul").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.justifyContent).to.equal("flex-end");
});
});
it("has correct Breadcrumb sizes", () => {
cy.get("#breadcrumb-small").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").small}px`);
});
cy.get("#breadcrumb-normal").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").normal}px`);
});
cy.get("#breadcrumb-medium").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").medium}px`);
});
cy.get("#breadcrumb-large").then(($) => {
const cs = window.getComputedStyle($[0]);
expect(cs.fontSize).to.equal(`${Cypress.env("sizes").large}px`);
});
});
it("has correct Breadcrumb separators", () => {
cy.get("#breadcrumb li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"/"');
});
cy.get("#breadcrumb-arrow li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"→"');
});
cy.get("#breadcrumb-bullet li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"•"');
});
cy.get("#breadcrumb-dot li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"·"');
});
cy.get("#breadcrumb-succeeds li:nth-child(2)").then(($) => {
const content = window
.getComputedStyle($[0], "before")
.getPropertyValue("content");
expect(content).to.equal('"≻"');
});
});
});