]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add menu specs
authorJeremy Thomas <bbxdesign@gmail.com>
Fri, 5 Nov 2021 19:39:09 +0000 (19:39 +0000)
committerJeremy Thomas <bbxdesign@gmail.com>
Fri, 5 Nov 2021 19:39:09 +0000 (19:39 +0000)
docs/cyp/components/menu.html [new file with mode: 0644]
docs/cypress.json
docs/cypress/integration/components/menu.spec.js [new file with mode: 0644]

diff --git a/docs/cyp/components/menu.html b/docs/cyp/components/menu.html
new file mode 100644 (file)
index 0000000..298b140
--- /dev/null
@@ -0,0 +1,44 @@
+---
+layout: cypress
+title: Components/Menu
+---
+
+<aside id="menu" class="menu">
+  <p class="menu-label">
+    General
+  </p>
+
+  <ul class="menu-list">
+    <li><a>Dashboard</a></li>
+    <li><a>Customers</a></li>
+  </ul>
+
+  <p class="menu-label">
+    Administration
+  </p>
+
+  <ul class="menu-list">
+    <li><a>Team Settings</a></li>
+    <li>
+      <a class="is-active">Manage Your Team</a>
+      <ul>
+        <li><a>Members</a></li>
+        <li><a>Plugins</a></li>
+        <li><a>Add a member</a></li>
+      </ul>
+    </li>
+    <li><a>Invitations</a></li>
+    <li><a>Cloud Storage Environment Settings</a></li>
+    <li><a>Authentication</a></li>
+  </ul>
+
+  <p class="menu-label">
+    Transactions
+  </p>
+
+  <ul class="menu-list">
+    <li><a>Payments</a></li>
+    <li><a>Transfers</a></li>
+    <li><a>Balance</a></li>
+  </ul>
+</aside>
index 9d3a36ddff18701b676a32c89a8dcbfabe4dece1..48bdb2cadc9ac0ed81bee1f69242d7de217a1d85 100644 (file)
@@ -63,6 +63,7 @@
     "border-hover": "rgb(181, 181, 181)",
     "text": "rgb(74, 74, 74)",
     "text-strong": "rgb(54, 54, 54)",
+    "text-light": "rgb(122, 122, 122)",
 
     "viewports": {
       "mobile": [320, 480],
diff --git a/docs/cypress/integration/components/menu.spec.js b/docs/cypress/integration/components/menu.spec.js
new file mode 100644 (file)
index 0000000..6707a08
--- /dev/null
@@ -0,0 +1,68 @@
+describe("Components/Menu", () => {
+  beforeEach(() => {
+    cy.visit("http://127.0.0.1:4000/cyp/components/menu/");
+  });
+
+  it("has a Menu", () => {
+    cy.get(".menu").should("exist");
+  });
+
+  it("has a correct Menu", () => {
+    cy.get("#menu").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.fontSize).to.equal("16px");
+    });
+  });
+
+  it("has a correct Menu List", () => {
+    cy.get("#menu .menu-list").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.lineHeight).to.equal("20px");
+    });
+
+    cy.get("#menu .menu-list a").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.borderRadius).to.equal("2px");
+      expect(cs.color).to.equal(Cypress.env("text"));
+      expect(cs.display).to.equal("block");
+      expect(cs.padding).to.equal("8px 12px");
+    });
+
+    cy.get("#menu .menu-list a.is-active").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.backgroundColor).to.equal(Cypress.env("link"));
+      expect(cs.color).to.equal(Cypress.env("link-invert"));
+    });
+  });
+
+  it("has a correct nested Menu List", () => {
+    cy.get("#menu .menu-list ul").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.borderLeftColor).to.equal(Cypress.env("border"));
+      expect(cs.borderLeftStyle).to.equal("solid");
+      expect(cs.borderLeftWidth).to.equal("1px");
+      expect(cs.margin).to.equal("12px");
+      expect(cs.paddingLeft).to.equal("12px");
+    });
+  });
+
+  it("has a correct Menu Label", () => {
+    cy.get("#menu .menu-label").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.color).to.equal(Cypress.env("text-light"));
+      expect(cs.fontSize).to.equal("12px");
+      expect(cs.letterSpacing).to.equal("1.2px");
+      expect(cs.textTransform).to.equal("uppercase");
+    });
+
+    cy.get("#menu .menu-label:not(:first-child)").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.marginTop).to.equal("12px");
+    });
+
+    cy.get("#menu .menu-label:not(:last-child)").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.marginBottom).to.equal("12px");
+    });
+  });
+});