From c78977869e0ae81cb4b642e6778a952333977669 Mon Sep 17 00:00:00 2001 From: Jeremy Thomas Date: Sun, 31 Oct 2021 19:36:31 +0000 Subject: [PATCH] Add Content, Icon, Image specs --- .github/workflows/main.yml | 29 ------ docs/cyp/elements/content.html | 96 ++++++++++++++++++ docs/cyp/elements/icon.html | 46 +++++++++ docs/cyp/elements/image.html | 57 +++++++++++ docs/cypress/integration/elements/box.spec.js | 3 +- .../integration/elements/content.spec.js | 68 +++++++++++++ .../cypress/integration/elements/icon.spec.js | 60 +++++++++++ .../integration/elements/image.spec.js | 63 ++++++++++++ docs/images/placeholders/1x1.png | Bin 0 -> 95 bytes 9 files changed, 391 insertions(+), 31 deletions(-) create mode 100644 docs/cyp/elements/content.html create mode 100644 docs/cyp/elements/icon.html create mode 100644 docs/cyp/elements/image.html create mode 100644 docs/cypress/integration/elements/content.spec.js create mode 100644 docs/cypress/integration/elements/icon.spec.js create mode 100644 docs/cypress/integration/elements/image.spec.js create mode 100644 docs/images/placeholders/1x1.png diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 301a0917..ba486d8d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,27 +6,6 @@ jobs: steps: - name: Checkout uses: actions/checkout@v2 - # - uses: actions/cache@v2 - # with: - # path: vendor/bundle - # key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }} - # restore-keys: | - # ${{ runner.os }}-gems- - # - name: Build & Deploy to custom branch - # uses: DavidS/jekyll-deploy@ - # with: - # source-dir: docs - # env: - # JEKYLL_ENV: production - # GH_PAGES_TOKEN: ${{ secrets.GH_PAGES_TOKEN }} - # - name: Jekyll Build - # uses: helaili/jekyll-action@v2 - # with: - # token: ${{ secrets.GITHUB_TOKEN }} - # jekyll_src: "docs" - # jekyll_build_options: - # host: 127.0.0.1 - # port: 4000 - uses: ruby/setup-ruby@v1 with: ruby-version: 2.7 @@ -35,10 +14,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | gem install jekyll bundler - # - name: Launch Jekyll server - # run: | - # cd docs - # JEKYLL_ENV=production jekyll serve --host 127.0.0.1 --port 4000 - name: Cypress run uses: cypress-io/github-action@v2 with: @@ -47,7 +22,3 @@ jobs: build: npm run bulma-sass start: jekyll serve --host 127.0.0.1 --port 4000 wait-on: "http://127.0.0.1:4000" - record: true - env: - CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/cyp/elements/content.html b/docs/cyp/elements/content.html new file mode 100644 index 00000000..943d24fb --- /dev/null +++ b/docs/cyp/elements/content.html @@ -0,0 +1,96 @@ +--- +layout: cypress +title: Elements/Content +--- + +
+

Hello World

+

Lorem ipsum[1] dolor sit amet, consectetur adipiscing elit. Nulla accumsan, metus ultrices eleifend gravida, nulla nunc varius lectus, nec rutrum justo nibh eu lectus. Ut vulputate semper dui. Fusce erat odio, sollicitudin vel erat vel, interdum mattis neque. Subscript works as well!

+

Second level

+

Curabitur accumsan turpis pharetra augue tincidunt blandit. Quisque condimentum maximus mi, sit amet commodo arcu rutrum id. Proin pretium urna vel cursus venenatis. Suspendisse potenti. Etiam mattis sem rhoncus lacus dapibus facilisis. Donec at dignissim dui. Ut et neque nisl.

+ +

Third level

+

Quisque ante lacus, malesuada ac auctor vitae, congue non ante. Phasellus lacus ex, semper ac tortor nec, fringilla condimentum orci. Fusce eu rutrum tellus.

+
    +
  1. Donec blandit a lorem id convallis.
  2. +
  3. Cras gravida arcu at diam gravida gravida.
  4. +
  5. Integer in volutpat libero.
  6. +
  7. Donec a diam tellus.
  8. +
  9. Aenean nec tortor orci.
  10. +
  11. Quisque aliquam cursus urna, non bibendum massa viverra eget.
  12. +
  13. Vivamus maximus ultricies pulvinar.
  14. +
+
Ut venenatis, nisl scelerisque sollicitudin fermentum, quam libero hendrerit ipsum, ut blandit est tellus sit amet turpis.
+

Quisque at semper enim, eu hendrerit odio. Etiam auctor nisl et justo sodales elementum. Maecenas ultrices lacus quis neque consectetur, et lobortis nisi molestie.

+

Sed sagittis enim ac tortor maximus rutrum. Nulla facilisi. Donec mattis vulputate risus in luctus. Maecenas vestibulum interdum commodo.

+
+
Web
+
The part of the Internet that contains websites and web pages
+
HTML
+
A markup language for creating web pages
+
CSS
+
A technology to make HTML look better
+
+

Suspendisse egestas sapien non felis placerat elementum. Morbi tortor nisl, suscipit sed mi sit amet, mollis malesuada nulla. Nulla facilisi. Nullam ac erat ante.

+

Fourth level

+

Nulla efficitur eleifend nisi, sit amet bibendum sapien fringilla ac. Mauris euismod metus a tellus laoreet, at elementum ex efficitur.

+
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Hello World</title>
+  </head>
+  <body>
+    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec viverra nec nulla vitae mollis.</p>
+  </body>
+</html>
+
+

Maecenas eleifend sollicitudin dui, faucibus sollicitudin augue cursus non. Ut finibus eleifend arcu ut vehicula. Mauris eu est maximus est porta condimentum in eu justo. Nulla id iaculis sapien.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
OneTwo
ThreeFour
FiveSix
SevenEight
NineTen
ElevenTwelve
+

Phasellus porttitor enim id metus volutpat ultricies. Ut nisi nunc, blandit sed dapibus at, vestibulum in felis. Etiam iaculis lorem ac nibh bibendum rhoncus. Nam interdum efficitur ligula sit amet ullamcorper. Etiam tristique, leo vitae porta faucibus, mi lacus laoreet metus, at cursus leo est vel tellus. Sed ac posuere est. Nunc ultricies nunc neque, vitae ultricies ex sodales quis. Aliquam eu nibh in libero accumsan pulvinar. Nullam nec nisl placerat, pretium metus vel, euismod ipsum. Proin tempor cursus nisl vel condimentum. Nam pharetra varius metus non pellentesque.

+
Fifth level
+

Aliquam sagittis rhoncus vulputate. Cras non luctus sem, sed tincidunt ligula. Vestibulum at nunc elit. Praesent aliquet ligula mi, in luctus elit volutpat porta. Phasellus molestie diam vel nisi sodales, a eleifend augue laoreet. Sed nec eleifend justo. Nam et sollicitudin odio.

+
+ + +
+ Figure 1: Some beautiful placeholders +
+
+
Sixth level
+

Cras in nibh lacinia, venenatis nisi et, auctor urna. Donec pulvinar lacus sed diam dignissim, ut eleifend eros accumsan. Phasellus non tortor eros. Ut sed rutrum lacus. Etiam purus nunc, scelerisque quis enim vitae, malesuada ultrices turpis. Nunc vitae maximus purus, nec consectetur dui. Suspendisse euismod, elit vel rutrum commodo, ipsum tortor maximus dui, sed varius sapien odio vitae est. Etiam at cursus metus.

+
diff --git a/docs/cyp/elements/icon.html b/docs/cyp/elements/icon.html new file mode 100644 index 00000000..ea7b7fa9 --- /dev/null +++ b/docs/cyp/elements/icon.html @@ -0,0 +1,46 @@ +--- +layout: cypress +title: Elements/Icon +--- + +
+ + + +
+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + + + Home + +
+ +
+
+ + + + Home +
+
diff --git a/docs/cyp/elements/image.html b/docs/cyp/elements/image.html new file mode 100644 index 00000000..1c98c998 --- /dev/null +++ b/docs/cyp/elements/image.html @@ -0,0 +1,57 @@ +--- +layout: cypress +title: Elements/Image +dimensions: +- 16 +- 24 +- 32 +- 48 +- 64 +- 96 +- 128 +ratios: +- square +- 1by1 +- 5by4 +- 4by3 +- 3by2 +- 5by3 +- 16by9 +- 2by1 +- 3by1 +- 4by5 +- 3by4 +- 2by3 +- 3by5 +- 9by16 +- 1by2 +- 1by3 +--- + +
+
+ +
+
+ +
+
+ +
+
+ +{% for ratio in page.ratios %} +
+
+ +
+
+{% endfor %} + +{% for dimension in page.dimensions %} +
+
+ +
+
+{% endfor %} diff --git a/docs/cypress/integration/elements/box.spec.js b/docs/cypress/integration/elements/box.spec.js index 3d0a55d9..f47b64f3 100644 --- a/docs/cypress/integration/elements/box.spec.js +++ b/docs/cypress/integration/elements/box.spec.js @@ -9,8 +9,7 @@ describe("Elements/Box", () => { it("has a correct .box element", () => { cy.get(".box").then(($) => { - const el = $[0]; - const cs = window.getComputedStyle(el); + const cs = window.getComputedStyle($[0]); expect(cs.backgroundColor).to.equal(Cypress.env("scheme-main")); expect(cs.borderRadius).to.equal("6px"); expect(cs.boxShadow).to.equal( diff --git a/docs/cypress/integration/elements/content.spec.js b/docs/cypress/integration/elements/content.spec.js new file mode 100644 index 00000000..15644300 --- /dev/null +++ b/docs/cypress/integration/elements/content.spec.js @@ -0,0 +1,68 @@ +describe("Elements/Content", () => { + beforeEach(() => { + cy.visit("http://127.0.0.1:4000/cyp/elements/content/"); + }); + + it("has a Content element", () => { + cy.get(".content").should("exist"); + }); + + it("has correct headings", () => { + cy.get(".content h1").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.fontSize).to.equal("32px"); + }); + + cy.get(".content h2").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.fontSize).to.equal("28px"); + }); + + cy.get(".content h3").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.fontSize).to.equal("24px"); + }); + + cy.get(".content h4").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.fontSize).to.equal("20px"); + }); + + cy.get(".content h5").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.fontSize).to.equal("18px"); + }); + + cy.get(".content h6").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.fontSize).to.equal("16px"); + }); + }); + + it("has a correct blockquote", () => { + cy.get(".content blockquote").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.backgroundColor).to.equal(Cypress.env("white-ter")); + expect(cs.padding).to.equal("20px 24px"); + }); + }); + + it("has correct lists", () => { + cy.get(".content ol li").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.listStyleType).to.equal("decimal"); + }); + + cy.get(".content ul li").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.listStyleType).to.equal("disc"); + }); + }); + + it("has a correct pre", () => { + cy.get(".content pre").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.padding).to.equal("17.5px 21px"); + }); + }); +}); diff --git a/docs/cypress/integration/elements/icon.spec.js b/docs/cypress/integration/elements/icon.spec.js new file mode 100644 index 00000000..3b6923fd --- /dev/null +++ b/docs/cypress/integration/elements/icon.spec.js @@ -0,0 +1,60 @@ +describe("Elements/Icon", () => { + beforeEach(() => { + cy.visit("http://127.0.0.1:4000/cyp/elements/icon/"); + }); + + it("has a .icon element", () => { + cy.get(".icon").should("exist"); + }); + + it("has a correct Icon element", () => { + cy.get("#icon").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal("24px"); + expect(cs.width).to.equal("24px"); + }); + }); + + it("has correct Icon sizes", () => { + cy.get("#icon-small").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal("16px"); + expect(cs.width).to.equal("16px"); + }); + + cy.get("#icon-normal").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal("24px"); + expect(cs.width).to.equal("24px"); + }); + + cy.get("#icon-medium").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal("32px"); + expect(cs.width).to.equal("32px"); + }); + + cy.get("#icon-large").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal("48px"); + expect(cs.width).to.equal("48px"); + }); + }); + + it("has correct Icon Text elements", () => { + cy.get("#icon-text").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.display).to.equal("inline-flex"); + }); + + cy.get("#icon-text > .icon").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.marginRight).to.equal("4px"); + }); + + cy.get("#icon-text-div").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.display).to.equal("flex"); + }); + }); +}); diff --git a/docs/cypress/integration/elements/image.spec.js b/docs/cypress/integration/elements/image.spec.js new file mode 100644 index 00000000..d3e8be5c --- /dev/null +++ b/docs/cypress/integration/elements/image.spec.js @@ -0,0 +1,63 @@ +describe("Elements/Image", () => { + beforeEach(() => { + cy.visit("http://127.0.0.1:4000/cyp/elements/image/"); + }); + + it("has a Image", () => { + cy.get(".image").should("exist"); + }); + + it("has a correct Image", () => { + cy.get("#image").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal("128px"); + expect(cs.width).to.equal("128px"); + }); + }); + + it("has a correct rounded Image", () => { + cy.get("#image-rounded img").then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.borderRadius).to.equal("9999px"); + }); + }); + + it("has a correct Image dimensions", () => { + [16, 24, 32, 48, 64, 96, 128].forEach((dimension) => { + cy.get(`#image-${dimension}`).then(($) => { + const cs = window.getComputedStyle($[0]); + expect(cs.height).to.equal(`${dimension}px`); + expect(cs.width).to.equal(`${dimension}px`); + }); + }); + }); + + it("has correct Image ratios", () => { + [ + ["1by1", 1], + ["5by4", 0.8], + ["4by3", 0.75], + ["3by2", 0.6666], + ["5by3", 0.6], + ["16by9", 0.5625], + ["2by1", 0.5], + ["3by1", 0.3333], + ["4by5", 1.25], + ["3by4", 1.3333], + ["2by3", 1.5], + ["3by5", 1.6666], + ["9by16", 1.7777], + ["1by2", 2], + ["1by3", 3], + ].forEach((ratio) => { + cy.get(`#image-${ratio[0]} img`).then(($) => { + const cs = window.getComputedStyle($[0]); + const height = cs.height.substring(0, cs.height.length - 2); + expect(`${Math.round(height)}px`).to.equal( + `${Math.round(100 * ratio[1])}px` + ); + expect(cs.width).to.equal("100px"); + }); + }); + }); +}); diff --git a/docs/images/placeholders/1x1.png b/docs/images/placeholders/1x1.png new file mode 100644 index 0000000000000000000000000000000000000000..1914264c08781d1f30ee0b8482bccf44586f2dc1 GIT binary patch literal 95 zcmeAS@N?(olHy`uVBq!ia0vp^j3CU&3?x-=hn)ga%mF?ju0VQumF+E%TuG2$FoVOh l8)-lem#2$k2*>s01R$Gz9%CSj!PC{xWt~$(697H@6ZHT9 literal 0 HcmV?d00001