From 6ec2520b1a649e240540fda090e11025a9ac7249 Mon Sep 17 00:00:00 2001 From: Jeremy Thomas Date: Sun, 31 Oct 2021 19:58:15 +0000 Subject: [PATCH] Add Notification specs --- docs/cyp/elements/notification.html | 24 +++++++++++ docs/cypress/integration/elements/box.spec.js | 4 +- .../integration/elements/notification.spec.js | 40 +++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 docs/cyp/elements/notification.html create mode 100644 docs/cypress/integration/elements/notification.spec.js diff --git a/docs/cyp/elements/notification.html b/docs/cyp/elements/notification.html new file mode 100644 index 00000000..a005346c --- /dev/null +++ b/docs/cyp/elements/notification.html @@ -0,0 +1,24 @@ +--- +layout: cypress +title: Elements/Notification +--- + +
+ + Lorem ipsum dolor sit amet, consectetur + adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. +
+ +{% for color in site.data.colors.justColors %} +
+ + Lorem ipsum dolor sit amet, consectetur + adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. +
+ +
+ + Lorem ipsum dolor sit amet, consectetur + adipiscing elit lorem ipsum dolor. Pellentesque risus mi, tempus quis placerat ut, porta nec nulla. Vestibulum rhoncus ac ex sit amet fringilla. Nullam gravida purus diam, et dictum felis venenatis efficitur. +
+{% endfor %} diff --git a/docs/cypress/integration/elements/box.spec.js b/docs/cypress/integration/elements/box.spec.js index f47b64f3..d1c7c16b 100644 --- a/docs/cypress/integration/elements/box.spec.js +++ b/docs/cypress/integration/elements/box.spec.js @@ -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 index 00000000..f5b1148c --- /dev/null +++ b/docs/cypress/integration/elements/notification.spec.js @@ -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); + }); + } + }); +});