generic.spec.js 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. import { familyPrimary } from "../utils";
  2. describe("Base/Generic", () => {
  3. beforeEach(() => {
  4. cy.visit("http://127.0.0.1:4000/cyp/base/generic/");
  5. });
  6. it("has a correct html", () => {
  7. cy.get("html").then(($) => {
  8. const cs = window.getComputedStyle($[0]);
  9. expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main"));
  10. expect(cs.fontSize).to.equal("16px");
  11. expect(cs.minWidth).to.equal("300px");
  12. expect(cs.overflowX).to.equal("hidden");
  13. expect(cs.overflowY).to.equal("scroll");
  14. expect(cs.textRendering).to.equal("optimizelegibility");
  15. expect(cs.textSizeAdjust).to.equal("100%");
  16. expect(cs.webkitFontSmoothing).to.equal("antialiased");
  17. });
  18. });
  19. it("has correct HTML5 elements", () => {
  20. cy.get("article, aside, figure, footer, header, hgroup, section").then(
  21. ($) => {
  22. const cs = window.getComputedStyle($[0]);
  23. expect(cs.display).to.equal("block");
  24. }
  25. );
  26. });
  27. it("has correct form elements", () => {
  28. cy.get("body, button, input, optgroup, select, textarea").then(($) => {
  29. const cs = window.getComputedStyle($[0]);
  30. expect(cs.fontFamily).to.contains("-apple-system");
  31. expect(cs.fontFamily).to.contains("Helvetica");
  32. expect(cs.fontFamily).to.contains("Arial");
  33. expect(cs.fontFamily).to.contains("sans-serif");
  34. });
  35. });
  36. it("has correct monospace elements", () => {
  37. cy.get("pre, code").then(($) => {
  38. const cs = window.getComputedStyle($[0]);
  39. expect(cs.fontFamily).to.equal(Cypress.env("family-code"));
  40. expect(cs.webkitFontSmoothing).to.equal("auto");
  41. });
  42. });
  43. it("has a correct body", () => {
  44. cy.get("body").then(($) => {
  45. const cs = window.getComputedStyle($[0]);
  46. expect(cs.color).to.equal(Cypress.env("text"));
  47. expect(cs.fontFamily).to.contains("-apple-system");
  48. expect(cs.fontFamily).to.contains("Helvetica");
  49. expect(cs.fontFamily).to.contains("Arial");
  50. expect(cs.fontFamily).to.contains("sans-serif");
  51. expect(cs.fontSize).to.equal("16px");
  52. expect(cs.fontWeight).to.equal("400");
  53. expect(cs.lineHeight).to.equal("24px");
  54. });
  55. });
  56. it("has a correct a", () => {
  57. cy.get("a").then(($) => {
  58. const cs = window.getComputedStyle($[0]);
  59. expect(cs.color).to.equal(Cypress.env("link"));
  60. expect(cs.cursor).to.equal("pointer");
  61. expect(cs.textDecorationLine).to.equal("none");
  62. });
  63. });
  64. it("has a correct code", () => {
  65. cy.get("code").then(($) => {
  66. const cs = window.getComputedStyle($[0]);
  67. expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
  68. expect(cs.color).to.equal(Cypress.env("code"));
  69. });
  70. });
  71. it("has a correct hr", () => {
  72. cy.get("hr").then(($) => {
  73. const cs = window.getComputedStyle($[0]);
  74. expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
  75. expect(cs.borderStyle).to.equal("none");
  76. expect(cs.display).to.equal("block");
  77. expect(cs.height).to.equal("2px");
  78. expect(cs.margin).to.equal("24px 0px");
  79. });
  80. });
  81. it("has a correct img", () => {
  82. cy.get("img").then(($) => {
  83. const cs = window.getComputedStyle($[0]);
  84. expect(cs.height).to.equal("28px");
  85. expect(cs.width).to.equal("112px");
  86. });
  87. });
  88. it("has a correct checkbox", () => {
  89. cy.get("input[type='checkbox']").then(($) => {
  90. const cs = window.getComputedStyle($[0]);
  91. expect(cs.verticalAlign).to.equal("baseline");
  92. });
  93. });
  94. it("has a correct radio", () => {
  95. cy.get("input[type='radio']").then(($) => {
  96. const cs = window.getComputedStyle($[0]);
  97. expect(cs.verticalAlign).to.equal("baseline");
  98. });
  99. });
  100. it("has a correct small", () => {
  101. cy.get("small").then(($) => {
  102. const cs = window.getComputedStyle($[0]);
  103. expect(cs.fontSize).to.equal("14px");
  104. });
  105. });
  106. it("has a correct fieldset", () => {
  107. cy.get("fieldset").then(($) => {
  108. const cs = window.getComputedStyle($[0]);
  109. expect(cs.borderStyle).to.equal("none");
  110. });
  111. });
  112. it("has a correct pre", () => {
  113. cy.get("pre").then(($) => {
  114. const cs = window.getComputedStyle($[0]);
  115. expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
  116. expect(cs.color).to.equal(Cypress.env("text"));
  117. expect(cs.fontSize).to.equal("14px");
  118. expect(cs.overflowX).to.equal("auto");
  119. expect(cs.padding).to.equal("20px 24px");
  120. expect(cs.whiteSpace).to.equal("pre");
  121. expect(cs.wordWrap).to.equal("normal");
  122. });
  123. cy.get("pre code").then(($) => {
  124. const cs = window.getComputedStyle($[0]);
  125. expect(cs.backgroundColor).to.equal(Cypress.env("transparent"));
  126. expect(cs.color).to.equal(Cypress.env("text"));
  127. expect(cs.fontSize).to.equal("14px");
  128. expect(cs.padding).to.equal("0px");
  129. });
  130. });
  131. });