breadcrumb.spec.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. describe("Components/Breadcrumb", () => {
  2. beforeEach(() => {
  3. cy.visit("http://127.0.0.1:4000/cyp/components/breadcrumb/");
  4. });
  5. it("has a Breadcrumb", () => {
  6. cy.get(".breadcrumb").should("exist");
  7. });
  8. it("has a correct Breadcrumb", () => {
  9. cy.get("#breadcrumb").then(($) => {
  10. const cs = window.getComputedStyle($[0]);
  11. });
  12. cy.get("#breadcrumb li:nth-child(2) a").then(($) => {
  13. const cs = window.getComputedStyle($[0]);
  14. expect(cs.color).to.equal(Cypress.env("link"));
  15. expect(cs.padding).to.equal("0px 12px");
  16. });
  17. cy.get("#breadcrumb li.is-active a").then(($) => {
  18. const cs = window.getComputedStyle($[0]);
  19. expect(cs.color).to.equal(Cypress.env("text-strong"));
  20. expect(cs.padding).to.equal("0px 12px");
  21. });
  22. });
  23. it("has correct Breadcrumb alignments", () => {
  24. cy.get("#breadcrumb-centered ul").then(($) => {
  25. const cs = window.getComputedStyle($[0]);
  26. expect(cs.justifyContent).to.equal("center");
  27. });
  28. cy.get("#breadcrumb-right ul").then(($) => {
  29. const cs = window.getComputedStyle($[0]);
  30. expect(cs.justifyContent).to.equal("flex-end");
  31. });
  32. });
  33. it("has correct Breadcrumb sizes", () => {
  34. cy.get("#breadcrumb-small").then(($) => {
  35. const cs = window.getComputedStyle($[0]);
  36. expect(cs.fontSize).to.equal(`${Cypress.env("sizes").small}px`);
  37. });
  38. cy.get("#breadcrumb-normal").then(($) => {
  39. const cs = window.getComputedStyle($[0]);
  40. expect(cs.fontSize).to.equal(`${Cypress.env("sizes").normal}px`);
  41. });
  42. cy.get("#breadcrumb-medium").then(($) => {
  43. const cs = window.getComputedStyle($[0]);
  44. expect(cs.fontSize).to.equal(`${Cypress.env("sizes").medium}px`);
  45. });
  46. cy.get("#breadcrumb-large").then(($) => {
  47. const cs = window.getComputedStyle($[0]);
  48. expect(cs.fontSize).to.equal(`${Cypress.env("sizes").large}px`);
  49. });
  50. });
  51. it("has correct Breadcrumb separators", () => {
  52. cy.get("#breadcrumb li:nth-child(2)").then(($) => {
  53. const content = window
  54. .getComputedStyle($[0], "before")
  55. .getPropertyValue("content");
  56. expect(content).to.equal('"/"');
  57. });
  58. cy.get("#breadcrumb-arrow li:nth-child(2)").then(($) => {
  59. const content = window
  60. .getComputedStyle($[0], "before")
  61. .getPropertyValue("content");
  62. expect(content).to.equal('"→"');
  63. });
  64. cy.get("#breadcrumb-bullet li:nth-child(2)").then(($) => {
  65. const content = window
  66. .getComputedStyle($[0], "before")
  67. .getPropertyValue("content");
  68. expect(content).to.equal('"•"');
  69. });
  70. cy.get("#breadcrumb-dot li:nth-child(2)").then(($) => {
  71. const content = window
  72. .getComputedStyle($[0], "before")
  73. .getPropertyValue("content");
  74. expect(content).to.equal('"·"');
  75. });
  76. cy.get("#breadcrumb-succeeds li:nth-child(2)").then(($) => {
  77. const content = window
  78. .getComputedStyle($[0], "before")
  79. .getPropertyValue("content");
  80. expect(content).to.equal('"≻"');
  81. });
  82. });
  83. });