@statistikzh/leu 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.json +8 -0
- package/.github/workflows/ci.yml +78 -0
- package/.github/workflows/deploy-github-pages.yaml +2 -1
- package/.github/workflows/release-please.yml +2 -1
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.storybook/main.js +19 -3
- package/CHANGELOG.md +16 -0
- package/custom-elements-manifest.config.js +2 -2
- package/dist/Accordion.d.ts +1 -1
- package/dist/Accordion.d.ts.map +1 -1
- package/dist/Accordion.js +2 -4
- package/dist/Button.d.ts +2 -2
- package/dist/Button.js +2 -2
- package/dist/ButtonGroup.d.ts +1 -1
- package/dist/ButtonGroup.js +1 -1
- package/dist/Checkbox.d.ts +1 -1
- package/dist/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox.js +2 -3
- package/dist/CheckboxGroup.d.ts +1 -1
- package/dist/CheckboxGroup.d.ts.map +1 -1
- package/dist/CheckboxGroup.js +1 -3
- package/dist/Chip.d.ts +1 -1
- package/dist/Chip.d.ts.map +1 -1
- package/dist/Chip.js +1 -3
- package/dist/ChipGroup.d.ts +1 -1
- package/dist/ChipGroup.d.ts.map +1 -1
- package/dist/ChipGroup.js +2 -2
- package/dist/ChipLink.js +1 -1
- package/dist/ChipRemovable.js +1 -1
- package/dist/ChipSelectable.js +1 -1
- package/dist/Dialog.d.ts +1 -1
- package/dist/Dialog.d.ts.map +1 -1
- package/dist/Dialog.js +3 -5
- package/dist/Dropdown.d.ts +1 -1
- package/dist/Dropdown.js +3 -3
- package/dist/Icon.d.ts +2 -98
- package/dist/Icon.d.ts.map +1 -1
- package/dist/Icon.js +1 -1
- package/dist/Input.d.ts +7 -2
- package/dist/Input.d.ts.map +1 -1
- package/dist/Input.js +15 -8
- package/dist/{LeuElement-b670d77c.d.ts → LeuElement-BjGpKQpe.d.ts} +1 -1
- package/dist/LeuElement-BjGpKQpe.d.ts.map +1 -0
- package/dist/{LeuElement-b670d77c.js → LeuElement-BjGpKQpe.js} +2 -2
- package/dist/Menu.d.ts +2 -2
- package/dist/Menu.js +1 -1
- package/dist/MenuItem.d.ts +3 -3
- package/dist/MenuItem.js +1 -1
- package/dist/Pagination.d.ts +1 -1
- package/dist/Pagination.js +3 -3
- package/dist/Popup.d.ts +2 -2
- package/dist/Popup.d.ts.map +1 -1
- package/dist/Popup.js +1 -3
- package/dist/Radio.d.ts +1 -1
- package/dist/Radio.d.ts.map +1 -1
- package/dist/Radio.js +1 -3
- package/dist/RadioGroup.d.ts +1 -1
- package/dist/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup.js +1 -3
- package/dist/Range.d.ts +1 -1
- package/dist/Range.d.ts.map +1 -1
- package/dist/Range.js +17 -19
- package/dist/ScrollTop.d.ts +1 -1
- package/dist/ScrollTop.d.ts.map +1 -1
- package/dist/ScrollTop.js +27 -3
- package/dist/Select.d.ts +3 -3
- package/dist/Select.d.ts.map +1 -1
- package/dist/Select.js +6 -4
- package/dist/Spinner.d.ts +1 -1
- package/dist/Spinner.js +1 -1
- package/dist/Table.d.ts +1 -1
- package/dist/Table.d.ts.map +1 -1
- package/dist/Table.js +3 -4
- package/dist/VisuallyHidden.d.ts +1 -1
- package/dist/VisuallyHidden.d.ts.map +1 -1
- package/dist/VisuallyHidden.js +3 -5
- package/dist/{hasSlotController-c09741c5.d.ts → hasSlotController-DvFw2NdC.d.ts} +1 -1
- package/dist/hasSlotController-DvFw2NdC.d.ts.map +1 -0
- package/dist/{hasSlotController-c09741c5.js → hasSlotController-DvFw2NdC.js} +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +5 -7
- package/dist/leu-accordion.js +1 -1
- package/dist/leu-button-group.js +1 -1
- package/dist/leu-button.js +2 -2
- package/dist/leu-checkbox-group.js +1 -1
- package/dist/leu-checkbox.js +1 -1
- package/dist/leu-chip-group.js +1 -1
- package/dist/leu-chip-link.js +1 -1
- package/dist/leu-chip-removable.js +1 -1
- package/dist/leu-chip-selectable.js +1 -1
- package/dist/leu-dialog.js +2 -2
- package/dist/leu-dropdown.js +2 -2
- package/dist/leu-icon.js +1 -1
- package/dist/leu-input.js +1 -1
- package/dist/leu-menu-item.js +1 -1
- package/dist/leu-menu.js +1 -1
- package/dist/leu-pagination.js +2 -2
- package/dist/leu-popup.js +1 -1
- package/dist/leu-radio-group.js +1 -1
- package/dist/leu-radio.js +1 -1
- package/dist/leu-range.js +1 -1
- package/dist/leu-scroll-top.js +2 -3
- package/dist/leu-select.js +2 -2
- package/dist/leu-spinner.js +1 -1
- package/dist/leu-table.js +2 -2
- package/dist/leu-visually-hidden.js +1 -1
- package/dist/theme.css +143 -107
- package/dist/vscode.html-custom-data.json +3 -32
- package/dist/vue/index.d.ts +11 -77
- package/dist/web-types.json +246 -242
- package/index.js +0 -1
- package/package.json +55 -51
- package/rollup.config.js +3 -3
- package/scripts/generate-component/generate.js +5 -5
- package/src/components/accordion/test/accordion.test.js +24 -20
- package/src/components/button/Button.js +1 -1
- package/src/components/button/stories/button.stories.js +43 -45
- package/src/components/button/test/button.test.js +10 -10
- package/src/components/button-group/ButtonGroup.js +1 -1
- package/src/components/button-group/stories/button-group.stories.js +2 -2
- package/src/components/checkbox/checkbox.css +1 -0
- package/src/components/chip/ChipSelectable.js +1 -1
- package/src/components/chip/stories/chip-group.stories.js +4 -4
- package/src/components/chip/test/chip-group.test.js +25 -33
- package/src/components/chip/test/chip-link.test.js +5 -5
- package/src/components/chip/test/chip-removable.test.js +6 -8
- package/src/components/chip/test/chip-selectable.test.js +9 -11
- package/src/components/dialog/test/dialog.test.js +1 -1
- package/src/components/dropdown/test/dropdown.test.js +12 -13
- package/src/components/input/Input.js +25 -17
- package/src/components/input/stories/input.stories.js +0 -2
- package/src/components/input/test/input.test.js +26 -0
- package/src/components/menu/stories/menu-item.stories.js +2 -0
- package/src/components/menu/test/menu-item.test.js +3 -2
- package/src/components/menu/test/menu.test.js +24 -22
- package/src/components/pagination/Pagination.js +1 -1
- package/src/components/pagination/pagination.css +1 -1
- package/src/components/pagination/stories/pagination.stories.js +2 -1
- package/src/components/pagination/test/pagination.test.js +8 -6
- package/src/components/popup/Popup.js +4 -4
- package/src/components/popup/test/popup.test.js +6 -8
- package/src/components/radio/RadioGroup.js +2 -2
- package/src/components/range/Range.js +20 -21
- package/src/components/select/Select.js +6 -1
- package/src/components/select/stories/select.stories.js +1 -1
- package/src/components/select/test/select.test.js +18 -16
- package/src/components/table/Table.js +4 -4
- package/src/components/table/test/table.test.js +3 -2
- package/src/components/visually-hidden/test/visually-hidden.test.js +6 -8
- package/src/lib/LeuElement.js +2 -2
- package/src/lib/hasSlotController.js +1 -1
- package/src/styles/style.stories.js +3 -1
- package/tsconfig.build.json +4 -3
- package/web-dev-server.config.mjs +1 -0
- package/web-test-runner.config.mjs +1 -1
- package/.github/workflows/test.yml +0 -38
- package/.storybook/preview-head.html +0 -2
- package/dist/Breadcrumb.d.ts +0 -69
- package/dist/Breadcrumb.d.ts.map +0 -1
- package/dist/Breadcrumb.js +0 -391
- package/dist/LeuElement-b670d77c.d.ts.map +0 -1
- package/dist/hasSlotController-c09741c5.d.ts.map +0 -1
- package/dist/leu-breadcrumb.d.ts +0 -3
- package/dist/leu-breadcrumb.d.ts.map +0 -1
- package/dist/leu-breadcrumb.js +0 -17
- package/dist/utils-65469421.d.ts +0 -16
- package/dist/utils-65469421.d.ts.map +0 -1
- package/dist/utils-65469421.js +0 -35
- package/src/components/breadcrumb/Breadcrumb.js +0 -324
- package/src/components/breadcrumb/breadcrumb.css +0 -98
- package/src/components/breadcrumb/leu-breadcrumb.js +0 -5
- package/src/components/breadcrumb/stories/breadcrumb.stories.js +0 -73
- package/src/components/breadcrumb/test/breadcrumb.test.js +0 -141
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import { html } from "lit"
|
|
2
|
-
import { fixture, expect, aTimeout } from "@open-wc/testing"
|
|
3
|
-
import { setViewport } from "@web/test-runner-commands"
|
|
4
|
-
|
|
5
|
-
import "../leu-breadcrumb.js"
|
|
6
|
-
|
|
7
|
-
const items = [
|
|
8
|
-
{ label: "Kanton Zürich", href: "https://zh.ch" },
|
|
9
|
-
{ label: "Gesundheit", href: "https://zh.ch/de/gesundheit.html" },
|
|
10
|
-
{
|
|
11
|
-
label: "Lebensmittel & Gebrauchsgegenstände",
|
|
12
|
-
href: "https://zh.ch/de/gesundheit/lebensmittel-gebrauchsgegenstaende.html",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
label: "Lebensmittel",
|
|
16
|
-
href: "https://zh.ch/de/gesundheit/lebensmittel-gebrauchsgegenstaende/lebensmittel.html",
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
label: "Trinkwasser",
|
|
20
|
-
href: "https://zh.ch/de/gesundheit/lebensmittel-gebrauchsgegenstaende/lebensmittel.html",
|
|
21
|
-
},
|
|
22
|
-
]
|
|
23
|
-
|
|
24
|
-
async function defaultFixture(args = {}) {
|
|
25
|
-
return fixture(
|
|
26
|
-
html` <leu-breadcrumb .items="${args.items ?? items}"></leu-breadcrumb> `
|
|
27
|
-
)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
describe("LeuBreadcrumb", () => {
|
|
31
|
-
it("is a defined element", async () => {
|
|
32
|
-
const el = customElements.get("leu-breadcrumb")
|
|
33
|
-
|
|
34
|
-
expect(el).not.to.be.undefined
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it("passes the a11y audit", async () => {
|
|
38
|
-
const el = await defaultFixture()
|
|
39
|
-
await expect(el).to.be.accessible()
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
it("renders a list of items", async () => {
|
|
43
|
-
await setViewport({ width: 1024, height: 1024 })
|
|
44
|
-
const el = await defaultFixture()
|
|
45
|
-
|
|
46
|
-
const itemEls = el.shadowRoot.querySelectorAll("li")
|
|
47
|
-
|
|
48
|
-
expect(itemEls[0]).to.have.trimmed.text(items[0].label)
|
|
49
|
-
expect(itemEls[0].querySelector("a")).to.have.attribute(
|
|
50
|
-
"href",
|
|
51
|
-
items[0].href
|
|
52
|
-
)
|
|
53
|
-
expect(itemEls[1]).to.have.trimmed.text(items[1].label)
|
|
54
|
-
expect(itemEls[1].querySelector("a")).to.have.attribute(
|
|
55
|
-
"href",
|
|
56
|
-
items[1].href
|
|
57
|
-
)
|
|
58
|
-
expect(itemEls[2]).to.have.trimmed.text(items[2].label)
|
|
59
|
-
expect(itemEls[2].querySelector("a")).to.have.attribute(
|
|
60
|
-
"href",
|
|
61
|
-
items[2].href
|
|
62
|
-
)
|
|
63
|
-
expect(itemEls[3]).to.have.trimmed.text(items[3].label)
|
|
64
|
-
expect(itemEls[3].querySelector("a")).to.have.attribute(
|
|
65
|
-
"href",
|
|
66
|
-
items[3].href
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
expect(itemEls[4]).to.have.trimmed.text(items[4].label)
|
|
70
|
-
expect(itemEls[4].querySelector("a")).to.not.exist
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it("hides the overflowing items when shrinking the viewport", async () => {
|
|
74
|
-
await setViewport({ width: 1024, height: 1024 })
|
|
75
|
-
const el = await defaultFixture()
|
|
76
|
-
|
|
77
|
-
let itemEls = el.shadowRoot.querySelectorAll("li")
|
|
78
|
-
expect(itemEls.length).to.equal(5)
|
|
79
|
-
|
|
80
|
-
await setViewport({ width: 768, height: 1024 })
|
|
81
|
-
await aTimeout(600)
|
|
82
|
-
await el.updateComplete
|
|
83
|
-
itemEls = el.shadowRoot.querySelectorAll("li")
|
|
84
|
-
|
|
85
|
-
expect(itemEls.length).to.equal(4)
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
it("shows all the items when viewport is enlarged", async () => {
|
|
89
|
-
await setViewport({ width: 768, height: 1024 })
|
|
90
|
-
const el = await defaultFixture()
|
|
91
|
-
|
|
92
|
-
let itemEls = el.shadowRoot.querySelectorAll("li")
|
|
93
|
-
expect(itemEls.length).to.equal(4)
|
|
94
|
-
|
|
95
|
-
await setViewport({ width: 1024, height: 1024 })
|
|
96
|
-
await aTimeout(600)
|
|
97
|
-
await el.updateComplete
|
|
98
|
-
itemEls = el.shadowRoot.querySelectorAll("li")
|
|
99
|
-
|
|
100
|
-
expect(itemEls.length).to.equal(5)
|
|
101
|
-
})
|
|
102
|
-
|
|
103
|
-
it("only shows the first item when the viewport is too small", async () => {
|
|
104
|
-
await setViewport({ width: 240, height: 1024 })
|
|
105
|
-
const el = await defaultFixture()
|
|
106
|
-
|
|
107
|
-
const itemEls = el.shadowRoot.querySelectorAll("li")
|
|
108
|
-
expect(itemEls.length).to.equal(1)
|
|
109
|
-
|
|
110
|
-
expect(itemEls[0]).to.have.trimmed.text(items[3].label)
|
|
111
|
-
expect(itemEls[0].querySelector("a")).to.have.attribute(
|
|
112
|
-
"href",
|
|
113
|
-
items[3].href
|
|
114
|
-
)
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
it("shows a dropdown toggle when items are hidden", async () => {
|
|
118
|
-
await setViewport({ width: 768, height: 1024 })
|
|
119
|
-
const el = await defaultFixture()
|
|
120
|
-
|
|
121
|
-
const dropdownToggle = el.shadowRoot.querySelector("li:nth-child(2) button")
|
|
122
|
-
expect(dropdownToggle).to.exist
|
|
123
|
-
expect(dropdownToggle).to.have.trimmed.text("…")
|
|
124
|
-
})
|
|
125
|
-
|
|
126
|
-
it("shows a dropdown when the toggle is clicked", async () => {
|
|
127
|
-
await setViewport({ width: 768, height: 1024 })
|
|
128
|
-
const el = await defaultFixture()
|
|
129
|
-
|
|
130
|
-
const dropdownToggle = el.shadowRoot.querySelector("li:nth-child(2) button")
|
|
131
|
-
dropdownToggle.click()
|
|
132
|
-
|
|
133
|
-
await el.updateComplete
|
|
134
|
-
|
|
135
|
-
const dropdown = el.shadowRoot.querySelectorAll("leu-menu")
|
|
136
|
-
expect(dropdown).to.exist
|
|
137
|
-
|
|
138
|
-
const dropdownItems = el.shadowRoot.querySelectorAll("leu-menu-item")
|
|
139
|
-
expect(dropdownItems.length).to.equal(2)
|
|
140
|
-
})
|
|
141
|
-
})
|