mirror of
https://github.com/jgthms/bulma.git
synced 2025-01-09 15:44:25 +00:00
Add Tags specs
This commit is contained in:
parent
7e989d5121
commit
1829e07f72
74
docs/cyp/elements/tag.html
Normal file
74
docs/cyp/elements/tag.html
Normal file
@ -0,0 +1,74 @@
|
||||
---
|
||||
layout: cypress
|
||||
title: Elements/Tag
|
||||
---
|
||||
|
||||
<div id="tags" class="tags">
|
||||
<span id="tag" class="tag">
|
||||
Tag
|
||||
</span>
|
||||
|
||||
<span id="tag-rounded" class="tag is-rounded">
|
||||
Rounded
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
<span id="tag-normal" class="tag is-normal">
|
||||
Normal
|
||||
</span>
|
||||
|
||||
<span id="tag-medium" class="tag is-medium">
|
||||
Medium
|
||||
</span>
|
||||
|
||||
<span id="tag-large" class="tag is-large">
|
||||
Large
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="tags-medium" class="tags are-medium">
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
</div>
|
||||
|
||||
<div id="tags-large" class="tags are-large">
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
</div>
|
||||
|
||||
<div id="tags-centered" class="tags is-centered">
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
</div>
|
||||
|
||||
<div id="tags-right" class="tags is-right">
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
</div>
|
||||
|
||||
<div id="tags-addons" class="tags has-addons">
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
<span class="tag">Tag</span>
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
{% for color in site.data.colors.justColors %}
|
||||
<span id="tag-{{ color }}" class="tag is-{{ color }}">
|
||||
{{ color | capitalize }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
<div class="block">
|
||||
{% for color in site.data.colors.justColors %}
|
||||
<span id="tag-{{ color }}-light" class="tag is-{{ color }} is-light">
|
||||
{{ color | capitalize }}
|
||||
</span>
|
||||
{% endfor %}
|
||||
</div>
|
@ -11,6 +11,43 @@ describe("Elements/Table", () => {
|
||||
cy.get("#table").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("white"));
|
||||
expect(cs.color).to.equal(Cypress.env("text-strong"));
|
||||
});
|
||||
|
||||
cy.get("#table tr.is-selected").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("primary"));
|
||||
expect(cs.color).to.equal(Cypress.env("primary-invert"));
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct bordered Table", () => {
|
||||
cy.get("#table-bordered th, #table-bordered td").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderWidth).to.equal("1px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct striped Table", () => {
|
||||
cy.get("#table-striped tbody tr:not(.is-selected):nth-child(even)").then(
|
||||
($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("white-bis"));
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it("has a correct narrow Table", () => {
|
||||
cy.get("#table-narrow th, #table-narrow td").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.padding).to.equal("4px 8px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct fullwidth Table", () => {
|
||||
cy.get("#table-fullwidth").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.width).to.equal("800px");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
107
docs/cypress/integration/elements/tag.spec.js
Normal file
107
docs/cypress/integration/elements/tag.spec.js
Normal file
@ -0,0 +1,107 @@
|
||||
describe("Elements/Tag", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://127.0.0.1:4000/cyp/elements/tag/");
|
||||
});
|
||||
|
||||
it("has a Tag", () => {
|
||||
cy.get(".tag").should("exist");
|
||||
});
|
||||
|
||||
it("has a correct Tag", () => {
|
||||
cy.get("#tag").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(Cypress.env("white-ter"));
|
||||
expect(cs.borderRadius).to.equal("4px");
|
||||
expect(cs.color).to.equal(Cypress.env("grey-dark"));
|
||||
expect(cs.fontSize).to.equal("12px");
|
||||
expect(cs.height).to.equal("24px");
|
||||
expect(cs.padding).to.equal("0px 9px");
|
||||
});
|
||||
|
||||
cy.get("#tag-rounded").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderRadius).to.equal("9999px");
|
||||
});
|
||||
});
|
||||
|
||||
it("has a correct Tag sizes", () => {
|
||||
cy.get("#tag-normal").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal("12px");
|
||||
expect(cs.height).to.equal("24px");
|
||||
});
|
||||
|
||||
cy.get("#tag-medium").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal("16px");
|
||||
expect(cs.height).to.equal("32px");
|
||||
});
|
||||
|
||||
cy.get("#tag-large").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal("20px");
|
||||
expect(cs.height).to.equal("40px");
|
||||
});
|
||||
});
|
||||
|
||||
// Colors
|
||||
it(`has correct color Tags`, () => {
|
||||
for (let i = 0; i < Cypress.env("color-names").length; i++) {
|
||||
const name = Cypress.env("color-names")[i];
|
||||
const baseColor = Cypress.env(name);
|
||||
const invertColor = Cypress.env(`${name}-invert`);
|
||||
const lightColor = Cypress.env(`${name}-light`);
|
||||
const darkColor = Cypress.env(`${name}-dark`);
|
||||
|
||||
cy.get(`#tag-${name}`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(baseColor);
|
||||
expect(cs.color).to.equal(invertColor);
|
||||
});
|
||||
|
||||
cy.get(`#tag-${name}-light`).then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.backgroundColor).to.equal(lightColor);
|
||||
expect(cs.color).to.equal(darkColor);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("has correct Tags containers", () => {
|
||||
cy.get("#tags").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.display).to.equal("flex");
|
||||
});
|
||||
|
||||
cy.get("#tags .tag").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.marginBottom).to.equal("8px");
|
||||
});
|
||||
|
||||
cy.get("#tags-medium .tag").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal("16px");
|
||||
});
|
||||
|
||||
cy.get("#tags-large .tag").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.fontSize).to.equal("20px");
|
||||
});
|
||||
|
||||
cy.get("#tags-centered").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("center");
|
||||
});
|
||||
|
||||
cy.get("#tags-right").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.justifyContent).to.equal("flex-end");
|
||||
});
|
||||
|
||||
cy.get("#tags-addons .tag:nth-child(2)").then(($) => {
|
||||
const cs = window.getComputedStyle($[0]);
|
||||
expect(cs.borderRadius).to.equal("0px");
|
||||
expect(cs.marginRight).to.equal("0px");
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue
Block a user