media.spec.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. describe("Components/Media", () => {
  2. beforeEach(() => {
  3. cy.visit("http://127.0.0.1:4000/cyp/layout/media/");
  4. });
  5. it("has a Media", () => {
  6. cy.get(".media").should("exist");
  7. });
  8. it("has a correct Media", () => {
  9. cy.get("#media").then(($) => {
  10. const cs = window.getComputedStyle($[0]);
  11. expect(cs.alignItems).to.equal("flex-start");
  12. expect(cs.display).to.equal("flex");
  13. });
  14. });
  15. it("has a correct nested Media", () => {
  16. cy.get("#media-nested .media-content .media + .media").then(($) => {
  17. const cs = window.getComputedStyle($[0]);
  18. expect(cs.borderTopColor).to.equal("rgba(219, 219, 219, 0.5)");
  19. expect(cs.borderTopStyle).to.equal("solid");
  20. expect(cs.borderTopWidth).to.equal("1px");
  21. expect(cs.marginTop).to.equal("8px");
  22. expect(cs.paddingTop).to.equal("8px");
  23. });
  24. });
  25. it("has a correct Media Content", () => {
  26. cy.get("#media .media-content").then(($) => {
  27. const cs = window.getComputedStyle($[0]);
  28. expect(cs.flexGrow).to.equal("1");
  29. expect(cs.flexShrink).to.equal("1");
  30. });
  31. });
  32. it("has correct Media Left and Right", () => {
  33. cy.get("#media .media-left").then(($) => {
  34. const cs = window.getComputedStyle($[0]);
  35. expect(cs.flexGrow).to.equal("0");
  36. expect(cs.flexShrink).to.equal("0");
  37. expect(cs.marginRight).to.equal("16px");
  38. });
  39. cy.get("#media .media-right").then(($) => {
  40. const cs = window.getComputedStyle($[0]);
  41. expect(cs.flexGrow).to.equal("0");
  42. expect(cs.flexShrink).to.equal("0");
  43. expect(cs.marginLeft).to.equal("16px");
  44. });
  45. });
  46. });