-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: setting up base test files for all existing components
- Loading branch information
Showing
4 changed files
with
125 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { html } from "lit" | ||
import { fixture, expect } from "@open-wc/testing" | ||
|
||
import "../../../exports/define/input.js" | ||
|
||
async function defaultFixture() { | ||
return fixture(html` <leu-input> Name </leu-input> `) | ||
} | ||
|
||
describe("LeuInput", () => { | ||
it("is a defined element", async () => { | ||
const el = await customElements.get("leu-input") | ||
|
||
await expect(el).not.to.be.undefined | ||
}) | ||
|
||
it("passes the a11y audit", async () => { | ||
const el = await defaultFixture() | ||
|
||
await expect(el).shadowDom.to.be.accessible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { html } from "lit" | ||
import { fixture, expect } from "@open-wc/testing" | ||
|
||
import "../../../exports/define/radio.js" | ||
import "../../../exports/define/radio-group.js" | ||
|
||
async function defaultFixture() { | ||
return fixture(html` | ||
<leu-radio-group> | ||
<span slot="legend">Legende</span> | ||
<leu-radio identifier="1" value="1" name="radio-button" disabled | ||
>Kurz</leu-radio | ||
> | ||
<leu-radio identifier="2" value="2" name="radio-button" | ||
>Etwas Länger</leu-radio | ||
> | ||
<leu-radio identifier="3" value="3" name="radio-button" | ||
>Ein langes Label um sicher ein umbruch zu erzwingen</leu-radio | ||
> | ||
</leu-radio-group> | ||
`) | ||
} | ||
|
||
describe("LeuRadio", () => { | ||
it("is a defined element", async () => { | ||
const elRadio = await customElements.get("leu-radio") | ||
const elRadioGroup = await customElements.get("leu-radio-group") | ||
|
||
await expect(elRadio).not.to.be.undefined | ||
await expect(elRadioGroup).not.to.be.undefined | ||
}) | ||
|
||
it("passes the a11y audit", async () => { | ||
const el = await defaultFixture() | ||
|
||
await expect(el).shadowDom.to.be.accessible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { html } from "lit" | ||
import { fixture, expect } from "@open-wc/testing" | ||
|
||
import "../../../exports/define/select.js" | ||
|
||
async function defaultFixture() { | ||
return fixture(html` | ||
<leu-select | ||
options='[{"label":"Option 1", "value":"1"}, "Option 2", "Option 3", "Sehr lange Option um zu schauen was passiert, wenn es zu lang wird."]' | ||
label="Label" | ||
value=${null} | ||
> | ||
</leu-select> | ||
`) | ||
} | ||
|
||
describe("LeuSelect", () => { | ||
it("is a defined element", async () => { | ||
const el = await customElements.get("leu-select") | ||
|
||
await expect(el).not.to.be.undefined | ||
}) | ||
|
||
it("passes the a11y audit", async () => { | ||
const el = await defaultFixture() | ||
|
||
await expect(el).shadowDom.to.be.accessible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { html } from "lit" | ||
import { fixture, expect } from "@open-wc/testing" | ||
|
||
import "../../../exports/define/table.js" | ||
|
||
const columns = [ | ||
{ name: "Id", value: (row) => row.id }, | ||
{ name: "Name", value: (row) => row.name }, | ||
{ name: "Menge", value: (row) => row.menge }, | ||
] | ||
|
||
const data = [ | ||
{ id: 1, name: "Apfel", menge: 4 }, | ||
{ id: 2, name: "Birne", menge: 2 }, | ||
{ id: 3, name: "Banane", menge: 3 }, | ||
{ id: 4, name: "Orange", menge: 7 }, | ||
] | ||
|
||
async function defaultFixture() { | ||
return fixture(html`<leu-table .columns=${columns} .data=${data}> | ||
</leu-table>`) | ||
} | ||
|
||
describe("LeuTable", () => { | ||
it("is a defined element", async () => { | ||
const el = await customElements.get("leu-table") | ||
|
||
await expect(el).not.to.be.undefined | ||
}) | ||
|
||
it("passes the a11y audit", async () => { | ||
const el = await defaultFixture() | ||
|
||
await expect(el).shadowDom.to.be.accessible() | ||
}) | ||
}) |