From 0ef5fced34a9f33d7eaeced84caa4284ad07d6ac Mon Sep 17 00:00:00 2001 From: Jeremy Thomas Date: Mon, 1 Nov 2021 23:36:18 +0000 Subject: [PATCH] Add breadcrumb specs --- docs/cyp/components/breadcrumb.html | 61 ++++++++++++ docs/cypress.json | 1 + .../integration/components/breadcrumb.spec.js | 98 +++++++++++++++++++ 3 files changed, 160 insertions(+) create mode 100644 docs/cyp/components/breadcrumb.html create mode 100644 docs/cypress/integration/components/breadcrumb.spec.js diff --git a/docs/cyp/components/breadcrumb.html b/docs/cyp/components/breadcrumb.html new file mode 100644 index 00000000..16d03aef --- /dev/null +++ b/docs/cyp/components/breadcrumb.html @@ -0,0 +1,61 @@ +--- +layout: cypress +title: Components/Breadcrumb +--- + +{% capture content %} +
  • Bulma
  • +
  • Documentation
  • +
  • Components
  • +
  • Breadcrumb
  • +{% endcapture %} + + + + + + + +{% for size in site.data.sizes %} + +{% endfor %} + + + + + + + + diff --git a/docs/cypress.json b/docs/cypress.json index bdb54028..9d3a36dd 100644 --- a/docs/cypress.json +++ b/docs/cypress.json @@ -60,6 +60,7 @@ "scheme-main": "rgb(255, 255, 255)", "border": "rgb(219, 219, 219)", + "border-hover": "rgb(181, 181, 181)", "text": "rgb(74, 74, 74)", "text-strong": "rgb(54, 54, 54)", diff --git a/docs/cypress/integration/components/breadcrumb.spec.js b/docs/cypress/integration/components/breadcrumb.spec.js new file mode 100644 index 00000000..e935b2fa --- /dev/null +++ b/docs/cypress/integration/components/breadcrumb.spec.js @@ -0,0 +1,98 @@ +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('"≻"'); + }); + }); +});