card.spec.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. describe("Components/Card", () => {
  2. beforeEach(() => {
  3. cy.visit("http://127.0.0.1:4000/cyp/components/card/");
  4. });
  5. it("has a Card", () => {
  6. cy.get(".card").should("exist");
  7. });
  8. it("has a correct Card", () => {
  9. cy.get("#card").then(($) => {
  10. const cs = window.getComputedStyle($[0]);
  11. expect(cs.backgroundColor).to.equal(Cypress.env("white"));
  12. expect(cs.color).to.equal(Cypress.env("text"));
  13. expect(cs.boxShadow).to.equal(
  14. "rgba(10, 10, 10, 0.1) 0px 8px 16px -2px, rgba(10, 10, 10, 0.02) 0px 0px 0px 1px"
  15. );
  16. });
  17. });
  18. it("has correct Card Item border-radius", () => {
  19. cy.get("#card-only-content > .card-content:first-child").then(($) => {
  20. const cs = window.getComputedStyle($[0]);
  21. expect(cs.borderTopLeftRadius).to.equal("4px");
  22. expect(cs.borderTopRightRadius).to.equal("4px");
  23. });
  24. cy.get("#card-only-content > .card-content:last-child").then(($) => {
  25. const cs = window.getComputedStyle($[0]);
  26. expect(cs.borderBottomLeftRadius).to.equal("4px");
  27. expect(cs.borderBottomRightRadius).to.equal("4px");
  28. });
  29. });
  30. it("has correct Card Header", () => {
  31. cy.get("#card-header-content > .card-header").then(($) => {
  32. const cs = window.getComputedStyle($[0]);
  33. expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
  34. expect(cs.boxShadow).to.equal("rgba(10, 10, 10, 0.1) 0px 2px 4px 0px");
  35. });
  36. cy.get("#card-header-content .card-header-title").then(($) => {
  37. const cs = window.getComputedStyle($[0]);
  38. expect(cs.color).to.equal(Cypress.env("text-strong"));
  39. expect(cs.fontWeight).to.equal("700");
  40. expect(cs.padding).to.equal("12px 16px");
  41. });
  42. cy.get("#card-header-content .card-header-icon").then(($) => {
  43. const cs = window.getComputedStyle($[0]);
  44. expect(cs.padding).to.equal("12px 16px");
  45. });
  46. });
  47. it("has correct Card Content", () => {
  48. cy.get("#card .card-content").then(($) => {
  49. const cs = window.getComputedStyle($[0]);
  50. expect(cs.padding).to.equal("24px");
  51. });
  52. });
  53. it("has correct Card Footer", () => {
  54. cy.get("#card .card-footer").then(($) => {
  55. const cs = window.getComputedStyle($[0]);
  56. expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
  57. expect(cs.borderTopColor).to.equal(Cypress.env("grey-lightest"));
  58. expect(cs.borderTopStyle).to.equal("solid");
  59. expect(cs.borderTopWidth).to.equal("1px");
  60. });
  61. cy.get("#card .card-footer-item").then(($) => {
  62. const cs = window.getComputedStyle($[0]);
  63. expect(cs.padding).to.equal("12px");
  64. });
  65. });
  66. });