@api-client/ui 0.3.2 → 0.3.4
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/build/src/elements/environment/EnvironmentEditor.d.ts.map +1 -1
- package/build/src/elements/environment/EnvironmentEditor.js +8 -6
- package/build/src/elements/environment/EnvironmentEditor.js.map +1 -1
- package/build/src/elements/har/HarViewer.d.ts.map +1 -1
- package/build/src/elements/har/HarViewer.js +13 -15
- package/build/src/elements/har/HarViewer.js.map +1 -1
- package/build/src/elements/http/RequestEditor.d.ts +2 -1
- package/build/src/elements/http/RequestEditor.d.ts.map +1 -1
- package/build/src/elements/http/RequestEditor.js +17 -12
- package/build/src/elements/http/RequestEditor.js.map +1 -1
- package/build/src/elements/http/RequestLog.d.ts.map +1 -1
- package/build/src/elements/http/RequestLog.js +34 -8
- package/build/src/elements/http/RequestLog.js.map +1 -1
- package/build/src/md/button/internals/base.d.ts.map +1 -1
- package/build/src/md/button/internals/base.js +2 -6
- package/build/src/md/button/internals/base.js.map +1 -1
- package/build/src/md/button/internals/button.styles.js +4 -4
- package/build/src/md/button/internals/button.styles.js.map +1 -1
- package/build/src/md/chip/internals/Chip.d.ts +11 -15
- package/build/src/md/chip/internals/Chip.d.ts.map +1 -1
- package/build/src/md/chip/internals/Chip.js +66 -104
- package/build/src/md/chip/internals/Chip.js.map +1 -1
- package/build/src/md/chip/internals/Chip.styles.d.ts.map +1 -1
- package/build/src/md/chip/internals/Chip.styles.js +114 -101
- package/build/src/md/chip/internals/Chip.styles.js.map +1 -1
- package/build/src/md/chip/internals/ChipSet.d.ts +16 -0
- package/build/src/md/chip/internals/ChipSet.d.ts.map +1 -0
- package/build/src/md/chip/internals/ChipSet.js +138 -0
- package/build/src/md/chip/internals/ChipSet.js.map +1 -0
- package/build/src/md/chip/internals/ChipSet.styles.d.ts +3 -0
- package/build/src/md/chip/internals/ChipSet.styles.d.ts.map +1 -0
- package/build/src/md/chip/internals/ChipSet.styles.js +9 -0
- package/build/src/md/chip/internals/ChipSet.styles.js.map +1 -0
- package/build/src/md/chip/ui-chip-set.d.ts +11 -0
- package/build/src/md/chip/ui-chip-set.d.ts.map +1 -0
- package/build/src/md/chip/ui-chip-set.js +27 -0
- package/build/src/md/chip/ui-chip-set.js.map +1 -0
- package/build/src/md/motion/animation.d.ts +5 -3
- package/build/src/md/motion/animation.d.ts.map +1 -1
- package/build/src/md/motion/animation.js +4 -2
- package/build/src/md/motion/animation.js.map +1 -1
- package/build/src/md/ripple/internals/ripple.styles.d.ts.map +1 -1
- package/build/src/md/ripple/internals/ripple.styles.js +20 -8
- package/build/src/md/ripple/internals/ripple.styles.js.map +1 -1
- package/build/src/md/switch/internals/Switch.styles.js +1 -1
- package/build/src/md/switch/internals/Switch.styles.js.map +1 -1
- package/build/src/md/tabs/internals/Tab.d.ts +25 -9
- package/build/src/md/tabs/internals/Tab.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tab.js +122 -53
- package/build/src/md/tabs/internals/Tab.js.map +1 -1
- package/build/src/md/tabs/internals/Tab.styles.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tab.styles.js +69 -64
- package/build/src/md/tabs/internals/Tab.styles.js.map +1 -1
- package/build/src/md/tabs/internals/Tabs.d.ts +52 -54
- package/build/src/md/tabs/internals/Tabs.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tabs.js +270 -330
- package/build/src/md/tabs/internals/Tabs.js.map +1 -1
- package/build/src/md/tabs/internals/Tabs.styles.d.ts.map +1 -1
- package/build/src/md/tabs/internals/Tabs.styles.js +13 -17
- package/build/src/md/tabs/internals/Tabs.styles.js.map +1 -1
- package/demo/md/chip/chip.html +33 -6
- package/demo/md/chip/chip.ts +111 -56
- package/demo/md/tabs/tabs.html +19 -0
- package/demo/md/tabs/tabs.ts +133 -83
- package/package.json +1 -1
- package/src/elements/environment/EnvironmentEditor.ts +8 -6
- package/src/elements/har/HarViewer.ts +13 -15
- package/src/elements/http/RequestEditor.ts +18 -13
- package/src/elements/http/RequestLog.ts +34 -8
- package/src/md/button/internals/base.ts +2 -6
- package/src/md/button/internals/button.styles.ts +4 -4
- package/src/md/chip/internals/Chip.styles.ts +114 -101
- package/src/md/chip/internals/Chip.ts +58 -88
- package/src/md/chip/internals/ChipSet.styles.ts +9 -0
- package/src/md/chip/internals/ChipSet.ts +142 -0
- package/src/md/chip/ui-chip-set.ts +15 -0
- package/src/md/motion/animation.ts +4 -2
- package/src/md/ripple/internals/ripple.styles.ts +20 -8
- package/src/md/switch/internals/Switch.styles.ts +1 -1
- package/src/md/tabs/internals/Tab.styles.ts +69 -64
- package/src/md/tabs/internals/Tab.ts +126 -43
- package/src/md/tabs/internals/Tabs.styles.ts +13 -17
- package/src/md/tabs/internals/Tabs.ts +259 -305
- package/test/elements/har/HarViewerElement.test.ts +1 -55
- package/test/ui/chip/UiChip.test.ts +18 -67
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { assert, fixture, nextFrame, html } from '@open-wc/testing'
|
|
2
2
|
import sinon from 'sinon'
|
|
3
3
|
import type { Har } from 'har-format'
|
|
4
|
-
import HarViewerElement
|
|
4
|
+
import HarViewerElement from '../../../src/elements/har/HarViewer.js'
|
|
5
5
|
import * as HarUtils from '../../../src/elements/har/HarUtils.js'
|
|
6
6
|
import '../../../src/define/har/har-viewer.js'
|
|
7
7
|
|
|
@@ -655,60 +655,6 @@ describe('HarViewer', () => {
|
|
|
655
655
|
})
|
|
656
656
|
})
|
|
657
657
|
|
|
658
|
-
describe('Entry details rendering', () => {
|
|
659
|
-
let model: Har
|
|
660
|
-
let details: HTMLElement
|
|
661
|
-
|
|
662
|
-
before(async () => {
|
|
663
|
-
model = await readHarFile(demo1file)
|
|
664
|
-
})
|
|
665
|
-
|
|
666
|
-
let element: HarViewerElement
|
|
667
|
-
beforeEach(async () => {
|
|
668
|
-
element = await basicFixture(model)
|
|
669
|
-
const item = element.shadowRoot!.querySelector('.entry-item') as HTMLElement
|
|
670
|
-
item.click()
|
|
671
|
-
await nextFrame()
|
|
672
|
-
details = element.shadowRoot!.querySelector('.entry-details')!
|
|
673
|
-
})
|
|
674
|
-
|
|
675
|
-
it('renders the request info tab by default', () => {
|
|
676
|
-
const tabs = details.querySelector('ui-tabs')!
|
|
677
|
-
assert.equal(tabs.selected, HarTab.request, 'has the selected tab')
|
|
678
|
-
const title = details.querySelector('.entry-details-title')!.textContent!.trim()
|
|
679
|
-
// assert.equal(title, 'Request on 15 Mar 2021, 13:04:59');
|
|
680
|
-
assert.isNotEmpty(title)
|
|
681
|
-
})
|
|
682
|
-
|
|
683
|
-
it('renders the response info tab', async () => {
|
|
684
|
-
const tab = details.querySelectorAll('ui-tabs ui-tab')[1] as HTMLElement
|
|
685
|
-
tab.click()
|
|
686
|
-
await nextFrame()
|
|
687
|
-
const tabs = details.querySelector('ui-tabs')!
|
|
688
|
-
assert.equal(tabs.selected, HarTab.response, 'has the selected tab')
|
|
689
|
-
})
|
|
690
|
-
|
|
691
|
-
it('renders the response content tab', async () => {
|
|
692
|
-
const tab = details.querySelectorAll('ui-tabs ui-tab')[3] as HTMLElement
|
|
693
|
-
tab.click()
|
|
694
|
-
await nextFrame()
|
|
695
|
-
const tabs = details.querySelector('ui-tabs')!
|
|
696
|
-
assert.equal(tabs.selected, HarTab.responseContent, 'has the selected tab')!
|
|
697
|
-
const content = details.querySelector('.details-content pre') as HTMLElement
|
|
698
|
-
assert.ok(content, 'has the content element')
|
|
699
|
-
})
|
|
700
|
-
|
|
701
|
-
it('renders the cookies tab', async () => {
|
|
702
|
-
const tab = details.querySelectorAll('ui-tabs ui-tab')[4] as HTMLElement
|
|
703
|
-
tab.click()
|
|
704
|
-
await nextFrame()
|
|
705
|
-
const tabs = details.querySelector('ui-tabs')!
|
|
706
|
-
assert.equal(tabs.selected, HarTab.cookies, 'has the selected tab')!
|
|
707
|
-
const content = details.querySelector('.details-content .details-list') as HTMLElement
|
|
708
|
-
assert.ok(content, 'has the content element')
|
|
709
|
-
})
|
|
710
|
-
})
|
|
711
|
-
|
|
712
658
|
describe('a11y', () => {
|
|
713
659
|
let model: Har
|
|
714
660
|
|
|
@@ -26,15 +26,6 @@ describe('md', () => {
|
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
async function disableIconFixture(): Promise<UiChip> {
|
|
30
|
-
return fixture(
|
|
31
|
-
html`<ui-chip type="assist" disabled>
|
|
32
|
-
<ui-icon slot="icon" icon="add"></ui-icon>
|
|
33
|
-
Disabled with icon
|
|
34
|
-
</ui-chip>`
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
29
|
async function elevatedFixture(): Promise<UiChip> {
|
|
39
30
|
return fixture(html`<ui-chip type="assist" elevated>Elevated</ui-chip>`)
|
|
40
31
|
}
|
|
@@ -45,9 +36,8 @@ describe('md', () => {
|
|
|
45
36
|
|
|
46
37
|
it('renders border around a regular assist chip', async () => {
|
|
47
38
|
const element = await basicFixture()
|
|
48
|
-
const
|
|
49
|
-
const
|
|
50
|
-
const m3Color = styles.getPropertyValue('--md-sys-color-outline')
|
|
39
|
+
const styles = getComputedStyle(element)
|
|
40
|
+
const m3Color = styles.getPropertyValue('--md-sys-color-outline-variant')
|
|
51
41
|
const borderColor = ColorConverter.normalizeColor(styles.borderColor)
|
|
52
42
|
const compareColor = ColorConverter.normalizeColor(m3Color)
|
|
53
43
|
assert.equal(borderColor, compareColor, 'has the m3 color')
|
|
@@ -89,43 +79,28 @@ describe('md', () => {
|
|
|
89
79
|
|
|
90
80
|
it('renders suffix icon', async () => {
|
|
91
81
|
const element = await iconFixture()
|
|
92
|
-
const surface = element.shadowRoot!.querySelector('.surface')
|
|
93
|
-
assert.isTrue(surface.classList.contains('
|
|
94
|
-
const
|
|
95
|
-
const contentStyles = getComputedStyle(content)
|
|
82
|
+
const surface = element.shadowRoot!.querySelector<HTMLDivElement>('.surface')!
|
|
83
|
+
assert.isTrue(surface.classList.contains('has-icon'), 'the surface has the has-icon class')
|
|
84
|
+
const contentStyles = getComputedStyle(surface)
|
|
96
85
|
assert.equal(contentStyles.paddingLeft.trim(), '8px', 'the container has the padding')
|
|
97
86
|
const icon = element.querySelector('ui-icon')!
|
|
98
87
|
const iconStyles = getComputedStyle(icon)
|
|
99
88
|
assert.equal(iconStyles.marginRight.trim(), '8px', 'the icon has the margin')
|
|
100
89
|
})
|
|
101
90
|
|
|
102
|
-
it('has disabled styles when disabled', async () => {
|
|
103
|
-
const element = await disableIconFixture()
|
|
104
|
-
const container = element.shadowRoot!.querySelector('.container') as HTMLDivElement
|
|
105
|
-
const containerStyles = getComputedStyle(container)
|
|
106
|
-
assert.equal(containerStyles.opacity, '0.12', 'container has the opacity')
|
|
107
|
-
const content = element.shadowRoot!.querySelector('.content') as HTMLDivElement
|
|
108
|
-
const contentStyles = getComputedStyle(content)
|
|
109
|
-
assert.equal(contentStyles.opacity, '0.68', 'content has the opacity')
|
|
110
|
-
})
|
|
111
|
-
|
|
112
91
|
it('has elevated styles', async () => {
|
|
113
92
|
const element = await elevatedFixture()
|
|
114
|
-
const
|
|
115
|
-
const containerStyles = getComputedStyle(
|
|
93
|
+
const surface = element.shadowRoot!.querySelector<HTMLDivElement>('.surface')!
|
|
94
|
+
const containerStyles = getComputedStyle(surface)
|
|
116
95
|
assert.equal(containerStyles.borderWidth, '0px', 'has no border')
|
|
117
96
|
assert.isNotEmpty(containerStyles.boxShadow, 'has a box shadow')
|
|
118
97
|
})
|
|
119
98
|
|
|
120
99
|
it('has no elevated styles when disabled', async () => {
|
|
121
100
|
const element = await disabledElevatedFixture()
|
|
122
|
-
const
|
|
123
|
-
const containerStyles = getComputedStyle(
|
|
101
|
+
const surface = element.shadowRoot!.querySelector<HTMLDivElement>('.surface')!
|
|
102
|
+
const containerStyles = getComputedStyle(surface)
|
|
124
103
|
assert.equal(containerStyles.boxShadow, 'none', 'has no box shadow')
|
|
125
|
-
assert.equal(containerStyles.opacity, '0.12', 'container has the opacity')
|
|
126
|
-
const content = element.shadowRoot!.querySelector('.content') as HTMLDivElement
|
|
127
|
-
const contentStyles = getComputedStyle(content)
|
|
128
|
-
assert.equal(contentStyles.opacity, '0.68', 'content has the opacity')
|
|
129
104
|
})
|
|
130
105
|
})
|
|
131
106
|
|
|
@@ -138,19 +113,18 @@ describe('md', () => {
|
|
|
138
113
|
return fixture(html`<ui-chip type="filter" disabled>Disabled</ui-chip>`)
|
|
139
114
|
}
|
|
140
115
|
|
|
141
|
-
async function
|
|
142
|
-
return fixture(html`<ui-chip type="filter"
|
|
116
|
+
async function removableFixture(): Promise<UiChip> {
|
|
117
|
+
return fixture(html`<ui-chip type="filter" removable>removable</ui-chip>`)
|
|
143
118
|
}
|
|
144
119
|
|
|
145
120
|
async function listFixture(): Promise<UiChip> {
|
|
146
|
-
return fixture(html`<ui-chip type="filter" list
|
|
121
|
+
return fixture(html`<ui-chip type="filter" list>List</ui-chip>`)
|
|
147
122
|
}
|
|
148
123
|
|
|
149
|
-
it('renders
|
|
124
|
+
it('renders border around the chip', async () => {
|
|
150
125
|
const element = await basicFixture()
|
|
151
|
-
const
|
|
152
|
-
const
|
|
153
|
-
const m3Color = styles.getPropertyValue('--md-sys-color-outline')
|
|
126
|
+
const styles = getComputedStyle(element)
|
|
127
|
+
const m3Color = styles.getPropertyValue('--md-sys-color-outline-variant')
|
|
154
128
|
const borderColor = ColorConverter.normalizeColor(styles.borderColor)
|
|
155
129
|
const compareColor = ColorConverter.normalizeColor(m3Color)
|
|
156
130
|
assert.equal(borderColor, compareColor, 'has the m3 color')
|
|
@@ -208,7 +182,7 @@ describe('md', () => {
|
|
|
208
182
|
})
|
|
209
183
|
|
|
210
184
|
it('does not render the close icon', async () => {
|
|
211
|
-
const element = await
|
|
185
|
+
const element = await removableFixture()
|
|
212
186
|
const node = element.shadowRoot!.querySelector('.trailing-icon')
|
|
213
187
|
assert.notOk(node)
|
|
214
188
|
})
|
|
@@ -219,36 +193,13 @@ describe('md', () => {
|
|
|
219
193
|
assert.ok(node, 'has the icon')
|
|
220
194
|
})
|
|
221
195
|
|
|
222
|
-
it('dispatches the list event', async () => {
|
|
223
|
-
const element = await listFixture()
|
|
224
|
-
const spy = sinon.spy()
|
|
225
|
-
element.addEventListener('list', spy)
|
|
226
|
-
const node = element.shadowRoot!.querySelector('.trailing-icon') as HTMLElement
|
|
227
|
-
node.click()
|
|
228
|
-
assert.isTrue(spy.calledOnce)
|
|
229
|
-
})
|
|
230
|
-
|
|
231
|
-
it('prevents the "click" event when dispatching the "list" event', async () => {
|
|
232
|
-
const element = await listFixture()
|
|
233
|
-
const spy = sinon.spy()
|
|
234
|
-
element.addEventListener('click', spy)
|
|
235
|
-
const node = element.shadowRoot!.querySelector('.trailing-icon') as HTMLElement
|
|
236
|
-
node.click()
|
|
237
|
-
assert.isFalse(spy.called)
|
|
238
|
-
})
|
|
239
|
-
|
|
240
196
|
it('is accessible in a regular state', async () => {
|
|
241
197
|
const element = await basicFixture()
|
|
242
198
|
await assert.isAccessible(element)
|
|
243
199
|
})
|
|
244
200
|
|
|
245
|
-
it('is accessible
|
|
246
|
-
const element = await
|
|
247
|
-
await assert.isAccessible(element)
|
|
248
|
-
})
|
|
249
|
-
|
|
250
|
-
it('is accessible when closable', async () => {
|
|
251
|
-
const element = await closableFixture()
|
|
201
|
+
it('is accessible when removable', async () => {
|
|
202
|
+
const element = await removableFixture()
|
|
252
203
|
await assert.isAccessible(element)
|
|
253
204
|
})
|
|
254
205
|
|