tabs.spec.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. describe("Components/Tabs", () => {
  2. beforeEach(() => {
  3. cy.visit("http://127.0.0.1:4000/cyp/components/tabs/");
  4. });
  5. it("has a Tabs", () => {
  6. cy.get(".tabs").should("exist");
  7. });
  8. it("has a correct Tabs", () => {
  9. cy.get("#tabs").then(($) => {
  10. const cs = window.getComputedStyle($[0]);
  11. expect(cs.alignItems).to.equal("stretch");
  12. expect(cs.display).to.equal("flex");
  13. expect(cs.fontSize).to.equal("16px");
  14. expect(cs.justifyContent).to.equal("space-between");
  15. expect(cs.whiteSpace).to.equal("nowrap");
  16. });
  17. cy.get("#tabs li:not(.is-active) a").then(($) => {
  18. const cs = window.getComputedStyle($[0]);
  19. expect(cs.alignItems).to.equal("center");
  20. expect(cs.borderBottomColor).to.equal(Cypress.env("border"));
  21. expect(cs.borderBottomStyle).to.equal("solid");
  22. expect(cs.borderBottomWidth).to.equal("1px");
  23. expect(cs.color).to.equal(Cypress.env("text"));
  24. expect(cs.display).to.equal("flex");
  25. expect(cs.justifyContent).to.equal("center");
  26. expect(cs.marginBottom).to.equal("-1px");
  27. expect(cs.padding).to.equal("8px 16px");
  28. expect(cs.verticalAlign).to.equal("top");
  29. });
  30. cy.get("#tabs li.is-active a").then(($) => {
  31. const cs = window.getComputedStyle($[0]);
  32. expect(cs.borderBottomColor).to.equal(Cypress.env("link"));
  33. expect(cs.color).to.equal(Cypress.env("link"));
  34. });
  35. cy.get("#tabs ul").then(($) => {
  36. const cs = window.getComputedStyle($[0]);
  37. expect(cs.alignItems).to.equal("center");
  38. expect(cs.borderBottomColor).to.equal(Cypress.env("border"));
  39. expect(cs.borderBottomStyle).to.equal("solid");
  40. expect(cs.borderBottomWidth).to.equal("1px");
  41. expect(cs.display).to.equal("flex");
  42. expect(cs.flexGrow).to.equal("1");
  43. expect(cs.flexShrink).to.equal("0");
  44. expect(cs.justifyContent).to.equal("flex-start");
  45. });
  46. });
  47. it("has a correct Tabs alignments", () => {
  48. cy.get("#tabs-centered ul").then(($) => {
  49. const cs = window.getComputedStyle($[0]);
  50. expect(cs.justifyContent).to.equal("center");
  51. });
  52. cy.get("#tabs-right ul").then(($) => {
  53. const cs = window.getComputedStyle($[0]);
  54. expect(cs.justifyContent).to.equal("flex-end");
  55. });
  56. });
  57. it("has a correct Tabs lists alignments", () => {
  58. cy.get("#tabs-lists ul.is-left").then(($) => {
  59. const cs = window.getComputedStyle($[0]);
  60. expect(cs.paddingRight).to.equal("12px");
  61. });
  62. cy.get("#tabs-lists ul.is-center").then(($) => {
  63. const cs = window.getComputedStyle($[0]);
  64. expect(cs.flex).to.equal("0 0 auto");
  65. expect(cs.justifyContent).to.equal("center");
  66. expect(cs.paddingLeft).to.equal("12px");
  67. expect(cs.paddingRight).to.equal("12px");
  68. });
  69. cy.get("#tabs-lists ul.is-right").then(($) => {
  70. const cs = window.getComputedStyle($[0]);
  71. expect(cs.justifyContent).to.equal("flex-end");
  72. expect(cs.paddingLeft).to.equal("12px");
  73. });
  74. });
  75. it("has a correct boxed Tabs", () => {
  76. cy.get("#tabs-boxed li:not(.is-active) a").then(($) => {
  77. const cs = window.getComputedStyle($[0]);
  78. expect(cs.borderColor).to.equal(Cypress.env("transparent"));
  79. expect(cs.borderRadius).to.equal("4px 4px 0px 0px");
  80. });
  81. cy.get("#tabs-boxed li.is-active a").then(($) => {
  82. const cs = window.getComputedStyle($[0]);
  83. expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
  84. expect(cs.borderColor).to.equal(
  85. `${Cypress.env("border")} ${Cypress.env("border")} ${Cypress.env(
  86. "transparent"
  87. )}`
  88. );
  89. });
  90. });
  91. });