mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-28 12:24:23 +00:00
0ce084170a
* Setup Cypress tests for box and button * Add container tests * Add Cypress workflow * Use npm install * Update Cypress workflow * Add Jekyll build * Test other action * Test custom setup * Use other ruby action * Test without flag * Move cypress to docs folder * Record runs * Add Content, Icon, Image specs * Add Notification specs * Add Progress and Table specs * Add Tags specs * Add Title specs * Add breadcrumb specs * Add more specs * Add media specs * Add menu specs * Add modal specs * Add navbar specs * Add pagination specs * Add panel specs * Add tabs specs, Add form checkbox radio specs * Add utils * Add file specs * Add input textarea specs * Add select specs * Add form tools specs * Add other elements specs * Add footer and hero specs * Add Hero specs * Add section specs * Add grid specs * Add column sizes specs * Add tiles specs * Add generic specs * Fix generic tests * Make font family test looser * Remove system-ui test * Remove important flag * Fix disabled select color
64 lines
1.7 KiB
JavaScript
64 lines
1.7 KiB
JavaScript
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");
|
|
});
|
|
});
|
|
});
|
|
});
|