Add Content, Icon, Image specs

This commit is contained in:
Jeremy Thomas 2021-10-31 19:36:31 +00:00
parent 8a27780341
commit c78977869e
9 changed files with 391 additions and 31 deletions

View File

@ -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 }}

View File

@ -0,0 +1,96 @@
---
layout: cypress
title: Elements/Content
---
<div class="content">
<h1>Hello World</h1>
<p>Lorem ipsum<sup><a>[1]</a></sup> 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. Sub<sub>script</sub> works as well!</p>
<h2>Second level</h2>
<p>Curabitur accumsan turpis pharetra <strong>augue tincidunt</strong> 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.</p>
<ul>
<li>In fermentum leo eu lectus mollis, quis dictum mi aliquet.</li>
<li>Morbi eu nulla lobortis, lobortis est in, fringilla felis.</li>
<li>Aliquam nec felis in sapien venenatis viverra fermentum nec lectus.</li>
<li>Ut non enim metus.</li>
</ul>
<h3>Third level</h3>
<p>Quisque ante lacus, malesuada ac auctor vitae, congue <a href="#">non ante</a>. Phasellus lacus ex, semper ac tortor nec, fringilla condimentum orci. Fusce eu rutrum tellus.</p>
<ol>
<li>Donec blandit a lorem id convallis.</li>
<li>Cras gravida arcu at diam gravida gravida.</li>
<li>Integer in volutpat libero.</li>
<li>Donec a diam tellus.</li>
<li>Aenean nec tortor orci.</li>
<li>Quisque aliquam cursus urna, non bibendum massa viverra eget.</li>
<li>Vivamus maximus ultricies pulvinar.</li>
</ol>
<blockquote>Ut venenatis, nisl scelerisque sollicitudin fermentum, quam libero hendrerit ipsum, ut blandit est tellus sit amet turpis.</blockquote>
<p>Quisque at semper enim, eu hendrerit odio. Etiam auctor nisl et <em>justo sodales</em> elementum. Maecenas ultrices lacus quis neque consectetur, et lobortis nisi molestie.</p>
<p>Sed sagittis enim ac tortor maximus rutrum. Nulla facilisi. Donec mattis vulputate risus in luctus. Maecenas vestibulum interdum commodo.</p>
<dl>
<dt>Web</dt>
<dd>The part of the Internet that contains websites and web pages</dd>
<dt>HTML</dt>
<dd>A markup language for creating web pages</dd>
<dt>CSS</dt>
<dd>A technology to make HTML look better</dd>
</dl>
<p>Suspendisse egestas sapien non felis placerat elementum. Morbi tortor nisl, suscipit sed mi sit amet, mollis malesuada nulla. Nulla facilisi. Nullam ac erat ante.</p>
<h4>Fourth level</h4>
<p>Nulla efficitur eleifend nisi, sit amet bibendum sapien fringilla ac. Mauris euismod metus a tellus laoreet, at elementum ex efficitur.</p>
<pre>
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Hello World&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;p&gt;Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec viverra nec nulla vitae mollis.&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>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.</p>
<table>
<thead>
<tr>
<th>One</th>
<th>Two</th>
</tr>
</thead>
<tbody>
<tr>
<td>Three</td>
<td>Four</td>
</tr>
<tr>
<td>Five</td>
<td>Six</td>
</tr>
<tr>
<td>Seven</td>
<td>Eight</td>
</tr>
<tr>
<td>Nine</td>
<td>Ten</td>
</tr>
<tr>
<td>Eleven</td>
<td>Twelve</td>
</tr>
</tbody>
</table>
<p>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.</p>
<h5>Fifth level</h5>
<p>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.</p>
<figure>
<img src="https://bulma.io/images/placeholders/256x256.png">
<img src="https://bulma.io/images/placeholders/256x256.png">
<figcaption>
Figure 1: Some beautiful placeholders
</figcaption>
</figure>
<h6>Sixth level</h6>
<p>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.</p>
</div>

View File

@ -0,0 +1,46 @@
---
layout: cypress
title: Elements/Icon
---
<div class="block">
<span id="icon" class="icon">
<i class="fas fa-home"></i>
</span>
</div>
<div class="block">
<span id="icon-small" class="icon is-small">
<i class="fas fa-home"></i>
</span>
<span id="icon-normal" class="icon">
<i class="fas fa-home"></i>
</span>
<span id="icon-medium" class="icon is-medium">
<i class="fas fa-home"></i>
</span>
<span id="icon-large" class="icon is-large">
<i class="fas fa-home"></i>
</span>
</div>
<div class="block">
<span id="icon-text" class="icon-text">
<span class="icon">
<i class="fas fa-home"></i>
</span>
<span>Home</span>
</span>
</div>
<div class="block">
<div id="icon-text-div" class="icon-text">
<span class="icon">
<i class="fas fa-home"></i>
</span>
<span>Home</span>
</div>
</div>

View File

@ -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
---
<div class="block">
<figure id="image" class="image is-128x128">
<img src="{{ site.url }}/images/placeholders/128x128.png">
</figure>
</div>
<div class="block">
<figure id="image-rounded" class="image is-128x128">
<img class="is-rounded" src="{{site.url}}/images/placeholders/128x128.png">
</figure>
</div>
{% for ratio in page.ratios %}
<div class="block" style="width: 100px;">
<figure id="image-{{ ratio }}" class="image is-{{ ratio }}">
<img src="{{ site.url }}/images/placeholders/1x1.png">
</figure>
</div>
{% endfor %}
{% for dimension in page.dimensions %}
<div class="block">
<figure id="image-{{ dimension }}" class="image is-{{ dimension }}x{{ dimension }}">
<img src="{{ site.url }}/images/placeholders/1x1.png">
</figure>
</div>
{% endfor %}

View File

@ -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(

View File

@ -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");
});
});
});

View File

@ -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");
});
});
});

View File

@ -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");
});
});
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 B