Add Notification specs
This commit is contained in:
parent
c78977869e
commit
6ec2520b1a
3 changed files with 66 additions and 2 deletions
24
docs/cyp/elements/notification.html
Normal file
24
docs/cyp/elements/notification.html
Normal file
|
@ -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 %}
|
|
@ -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"));
|
||||
|
|
40
docs/cypress/integration/elements/notification.spec.js
Normal file
40
docs/cypress/integration/elements/notification.spec.js
Normal file
|
@ -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);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
Loading…
Add table
Reference in a new issue