]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add breadcrumb specs
authorJeremy Thomas <bbxdesign@gmail.com>
Mon, 1 Nov 2021 23:36:18 +0000 (23:36 +0000)
committerJeremy Thomas <bbxdesign@gmail.com>
Mon, 1 Nov 2021 23:36:18 +0000 (23:36 +0000)
docs/cyp/components/breadcrumb.html [new file with mode: 0644]
docs/cypress.json
docs/cypress/integration/components/breadcrumb.spec.js [new file with mode: 0644]

diff --git a/docs/cyp/components/breadcrumb.html b/docs/cyp/components/breadcrumb.html
new file mode 100644 (file)
index 0000000..16d03ae
--- /dev/null
@@ -0,0 +1,61 @@
+---
+layout: cypress
+title: Components/Breadcrumb
+---
+
+{% capture content %}
+  <li><a href="#">Bulma</a></li>
+  <li><a href="#">Documentation</a></li>
+  <li><a href="#">Components</a></li>
+  <li class="is-active"><a href="#" aria-current="page">Breadcrumb</a></li>
+{% endcapture %}
+
+<nav id="breadcrumb" class="breadcrumb">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
+
+<nav id="breadcrumb-centered" class="breadcrumb is-centered">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
+
+<nav id="breadcrumb-right" class="breadcrumb is-right">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
+
+{% for size in site.data.sizes %}
+  <nav id="breadcrumb-{{ size }}" class="breadcrumb is-{{ size }}">
+    <ul>
+      {{ content }}
+    </ul>
+  </nav>
+{% endfor %}
+
+<nav id="breadcrumb-arrow" class="breadcrumb has-arrow-separator">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
+
+<nav id="breadcrumb-bullet" class="breadcrumb has-bullet-separator">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
+
+<nav id="breadcrumb-dot" class="breadcrumb has-dot-separator">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
+
+<nav id="breadcrumb-succeeds" class="breadcrumb has-succeeds-separator">
+  <ul>
+    {{ content }}
+  </ul>
+</nav>
index bdb54028a537a9927c758d5705a2ace5be59eed2..9d3a36ddff18701b676a32c89a8dcbfabe4dece1 100644 (file)
@@ -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 (file)
index 0000000..e935b2f
--- /dev/null
@@ -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('"≻"');
+    });
+  });
+});