]> git.ipfire.org Git - thirdparty/bulma.git/commitdiff
Add Notification specs
authorJeremy Thomas <bbxdesign@gmail.com>
Sun, 31 Oct 2021 19:58:15 +0000 (19:58 +0000)
committerJeremy Thomas <bbxdesign@gmail.com>
Sun, 31 Oct 2021 19:58:15 +0000 (19:58 +0000)
docs/cyp/elements/notification.html [new file with mode: 0644]
docs/cypress/integration/elements/box.spec.js
docs/cypress/integration/elements/notification.spec.js [new file with mode: 0644]

diff --git a/docs/cyp/elements/notification.html b/docs/cyp/elements/notification.html
new file mode 100644 (file)
index 0000000..a005346
--- /dev/null
@@ -0,0 +1,24 @@
+---
+layout: cypress
+title: Elements/Notification
+---
+
+<div id="notification" class="notification">
+  <button class="delete"></button>
+  Lorem ipsum dolor sit amet, consectetur
+  adipiscing elit lorem ipsum dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum <a>felis venenatis</a> efficitur.
+</div>
+
+{% for color in site.data.colors.justColors %}
+  <div id="notification-{{ color }}" class="notification is-{{ color }}">
+    <button class="delete"></button>
+    Lorem ipsum dolor sit amet, consectetur
+    adipiscing elit lorem ipsum dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum <a>felis venenatis</a> efficitur.
+  </div>
+
+  <div id="notification-{{ color }}-light" class="notification is-{{ color }} is-light">
+    <button class="delete"></button>
+    Lorem ipsum dolor sit amet, consectetur
+    adipiscing elit lorem ipsum dolor. <strong>Pellentesque risus mi</strong>, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum <a>felis venenatis</a> efficitur.
+  </div>
+{% endfor %}
index f47b64f34dded9808f0e9cab1c6e321be29f492c..d1c7c16b8c9f850d6dc3457d619b5d8fdfa720bd 100644 (file)
@@ -3,11 +3,11 @@ describe("Elements/Box", () => {
     cy.visit("http://127.0.0.1:4000/cyp/elements/box/");
   });
 
-  it("has a .box element", () => {
+  it("has a Box element", () => {
     cy.get(".box").should("exist");
   });
 
-  it("has a correct .box element", () => {
+  it("has a correct Box", () => {
     cy.get(".box").then(($) => {
       const cs = window.getComputedStyle($[0]);
       expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
diff --git a/docs/cypress/integration/elements/notification.spec.js b/docs/cypress/integration/elements/notification.spec.js
new file mode 100644 (file)
index 0000000..f5b1148
--- /dev/null
@@ -0,0 +1,40 @@
+describe("Elements/notification", () => {
+  beforeEach(() => {
+    cy.visit("http://127.0.0.1:4000/cyp/elements/notification/");
+  });
+
+  it("has a Notification element", () => {
+    cy.get("#notification").should("exist");
+  });
+
+  it("has a correct Notification", () => {
+    cy.get("#notification").then(($) => {
+      const cs = window.getComputedStyle($[0]);
+      expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
+      expect(cs.borderRadius).to.equal("4px");
+      expect(cs.padding).to.equal("20px 40px 20px 24px");
+    });
+  });
+
+  it(`has correct color Notifications`, () => {
+    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(`#notification-${name}`).then(($) => {
+        const cs = window.getComputedStyle($[0]);
+        expect(cs.backgroundColor).to.equal(baseColor);
+        expect(cs.color).to.equal(invertColor);
+      });
+
+      cy.get(`#notification-${name}-light`).then(($) => {
+        const cs = window.getComputedStyle($[0]);
+        expect(cs.backgroundColor).to.equal(lightColor);
+        expect(cs.color).to.equal(darkColor);
+      });
+    }
+  });
+});