From: Jeremy Thomas Date: Sat, 7 May 2022 21:38:56 +0000 (+0100) Subject: Add tiles specs X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54c9c81e883c6dc0a9e989fcaa0838a6af7550d1;p=thirdparty%2Fbulma.git Add tiles specs --- diff --git a/docs/cyp/grid/tiles.html b/docs/cyp/grid/tiles.html new file mode 100644 index 000000000..ae9209dd8 --- /dev/null +++ b/docs/cyp/grid/tiles.html @@ -0,0 +1,73 @@ +--- +layout: cypress +title: Grid/Tiles +--- + +{% capture content %} +
+
+
+
+

Vertical...

+

Top tile

+
+ +
+

...tiles

+

Bottom tile

+
+
+ +
+
+

Middle tile

+ +

With an image

+ +
+ +
+
+
+
+
+
+

Wide tile

+

Aligned with the right tile

+
+ +
+
+
+
+ +
+
+
+

Tall tile

+

With even more content

+
+ +
+
+
+
+{% endcapture %} + +
+ {{ content }} +
+ +
+
+ {{ content }} +
+
+ +
+ {% for i in (1..12) %} +
+ Tile {{ i }} +
+ {% endfor %} +
diff --git a/docs/cypress/integration/layout/level.spec.js b/docs/cypress/integration/components/level.spec.js similarity index 100% rename from docs/cypress/integration/layout/level.spec.js rename to docs/cypress/integration/components/level.spec.js diff --git a/docs/cypress/integration/layout/media.spec.js b/docs/cypress/integration/components/media.spec.js similarity index 100% rename from docs/cypress/integration/layout/media.spec.js rename to docs/cypress/integration/components/media.spec.js diff --git a/docs/cypress/integration/grid/tiles.spec.js b/docs/cypress/integration/grid/tiles.spec.js new file mode 100644 index 000000000..72b48c14c --- /dev/null +++ b/docs/cypress/integration/grid/tiles.spec.js @@ -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` + ); + }); + } + }); +});