mirror of
https://github.com/jgthms/bulma
synced 2026-03-23 05:19:35 -07:00
Add tiles specs
This commit is contained in:
73
docs/cyp/grid/tiles.html
Normal file
73
docs/cyp/grid/tiles.html
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
---
|
||||||
|
layout: cypress
|
||||||
|
title: Grid/Tiles
|
||||||
|
---
|
||||||
|
|
||||||
|
{% capture content %}
|
||||||
|
<div id="tile-vertical" class="tile is-vertical is-8">
|
||||||
|
<div id="tile" class="tile">
|
||||||
|
<div id="tile-parent" class="tile is-parent is-vertical">
|
||||||
|
<article id="tile-vertical-child" class="tile is-child notification is-warning">
|
||||||
|
<p class="title">Vertical...</p>
|
||||||
|
<p class="subtitle">Top tile</p>
|
||||||
|
</article>
|
||||||
|
|
||||||
|
<article class="tile is-child notification is-warning">
|
||||||
|
<p class="title">...tiles</p>
|
||||||
|
<p class="subtitle">Bottom tile</p>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tile is-parent">
|
||||||
|
<article id="tile-child" class="tile is-child notification is-info">
|
||||||
|
<p class="title">Middle tile</p>
|
||||||
|
|
||||||
|
<p class="subtitle">With an image</p>
|
||||||
|
|
||||||
|
<figure class="image is-4by3">
|
||||||
|
<img src="{{site.url}}/images/placeholders/640x480.png">
|
||||||
|
</figure>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="tile is-parent">
|
||||||
|
<article class="tile is-child notification is-danger">
|
||||||
|
<p class="title">Wide tile</p>
|
||||||
|
<p class="subtitle">Aligned with the right tile</p>
|
||||||
|
<div class="content">
|
||||||
|
<!-- Content -->
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tile is-parent">
|
||||||
|
<article class="tile is-child notification is-success">
|
||||||
|
<div class="content">
|
||||||
|
<p class="title">Tall tile</p>
|
||||||
|
<p class="subtitle">With even more content</p>
|
||||||
|
<div class="content">
|
||||||
|
<!-- Content -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</div>
|
||||||
|
{% endcapture %}
|
||||||
|
|
||||||
|
<div id="tile-ancestor" class="tile is-ancestor">
|
||||||
|
{{ content }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div id="tile-ancestor-last" class="tile is-ancestor">
|
||||||
|
{{ content }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="tile is-ancestor" style="width: 1000px;">
|
||||||
|
{% for i in (1..12) %}
|
||||||
|
<div id="tile-{{ i }}" class="tile is-{{ i }}">
|
||||||
|
Tile {{ i }}
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
96
docs/cypress/integration/grid/tiles.spec.js
Normal file
96
docs/cypress/integration/grid/tiles.spec.js
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
import {
|
||||||
|
setMobile,
|
||||||
|
setTablet,
|
||||||
|
setDesktop,
|
||||||
|
setWidescreen,
|
||||||
|
setFullHD,
|
||||||
|
} from "../utils";
|
||||||
|
|
||||||
|
describe("Grid/Tiles", () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit("http://127.0.0.1:4000/cyp/grid/tiles/");
|
||||||
|
setDesktop();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a Tile", () => {
|
||||||
|
cy.get(".tile").should("exist");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct Tile", () => {
|
||||||
|
cy.get("#tile").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.alignItems).to.equal("stretch");
|
||||||
|
expect(cs.display).to.equal("flex");
|
||||||
|
expect(cs.flexBasis).to.equal("0px");
|
||||||
|
expect(cs.flexGrow).to.equal("1");
|
||||||
|
expect(cs.flexShrink).to.equal("1");
|
||||||
|
expect(cs.minHeight).to.equal("min-content");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct ancestor Tile", () => {
|
||||||
|
cy.get("#tile-ancestor").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.marginBottom).to.equal("12px");
|
||||||
|
expect(cs.marginLeft).to.equal("-12px");
|
||||||
|
expect(cs.marginRight).to.equal("-12px");
|
||||||
|
expect(cs.marginTop).to.equal("-12px");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct last ancestor Tile", () => {
|
||||||
|
cy.get("#tile-ancestor-last").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.marginBottom).to.equal("-12px");
|
||||||
|
expect(cs.marginLeft).to.equal("-12px");
|
||||||
|
expect(cs.marginRight).to.equal("-12px");
|
||||||
|
expect(cs.marginTop).to.equal("-12px");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct parent Tile", () => {
|
||||||
|
cy.get("#tile-parent").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.padding).to.equal("12px");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct vertical Tile", () => {
|
||||||
|
cy.get("#tile-vertical").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.flexDirection).to.equal("column");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct child Tile", () => {
|
||||||
|
cy.get("#tile-child").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.marginBottom).to.equal("0px");
|
||||||
|
expect(cs.marginLeft).to.equal("0px");
|
||||||
|
expect(cs.marginRight).to.equal("0px");
|
||||||
|
expect(cs.marginTop).to.equal("0px");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct vertical child Tile", () => {
|
||||||
|
cy.get("#tile-vertical-child").then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
expect(cs.marginBottom).to.equal("24px");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("has a correct Tile sizes", () => {
|
||||||
|
for (let i = 1; i <= 12; i++) {
|
||||||
|
cy.get(`#tile-${i}`).then(($) => {
|
||||||
|
const cs = window.getComputedStyle($[0]);
|
||||||
|
const actualWidth = cs.width.substring(0, cs.width.length - 2);
|
||||||
|
expect(cs.flexBasis).to.equal("auto");
|
||||||
|
expect(cs.flexGrow).to.equal("0");
|
||||||
|
expect(cs.flexShrink).to.equal("0");
|
||||||
|
expect(`${Math.round(actualWidth)}px`).to.equal(
|
||||||
|
`${Math.round((i / 12) * 1000)}px`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user