@api-client/ui 0.5.39 → 0.5.40
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/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/.aiexclude +0 -3
- package/.cursor/rules/html-and-css-best-practices.mdc +0 -63
- package/.cursor/rules/lit-best-practices.mdc +0 -89
- package/.editorconfig +0 -29
- package/.github/CONTRIBUTING.md +0 -24
- package/.github/instructions/html-and-css-best-practices.instructions.md +0 -70
- package/.github/instructions/lit-best-practices.instructions.md +0 -90
- package/.github/release.yml +0 -14
- package/.github/stale.yml +0 -23
- package/.github/workflows/auto-release.yml +0 -182
- package/.github/workflows/release.yml +0 -82
- package/.prettierrc.js +0 -14
- package/.vscode/settings.json +0 -18
- package/RELEASE.md +0 -163
- package/RELEASE_SETUP.md +0 -235
- package/build/src/demo/DemoPage.d.ts +0 -81
- package/build/src/demo/DemoPage.d.ts.map +0 -1
- package/build/src/demo/DemoPage.js +0 -175
- package/build/src/demo/DemoPage.js.map +0 -1
- package/build/src/demo/DemoStyles.d.ts +0 -3
- package/build/src/demo/DemoStyles.d.ts.map +0 -1
- package/build/src/demo/DemoStyles.js +0 -60
- package/build/src/demo/DemoStyles.js.map +0 -1
- package/build/test/elements/navigation/Navigation.test.d.ts +0 -3
- package/build/test/elements/navigation/Navigation.test.d.ts.map +0 -1
- package/build/test/elements/navigation/Navigation.test.js +0 -113
- package/build/test/elements/navigation/Navigation.test.js.map +0 -1
- package/commitlint.config.cjs +0 -2
- package/demo/elements/authorization/AuthPlugin.js +0 -57
- package/demo/elements/authorization/AuthProxy.js +0 -215
- package/demo/elements/authorization/api-key.html +0 -27
- package/demo/elements/authorization/api-key.ts +0 -44
- package/demo/elements/authorization/basic.html +0 -27
- package/demo/elements/authorization/basic.ts +0 -43
- package/demo/elements/authorization/bearer.html +0 -27
- package/demo/elements/authorization/bearer.ts +0 -43
- package/demo/elements/authorization/env.js +0 -8
- package/demo/elements/authorization/index.html +0 -44
- package/demo/elements/authorization/ntlm.html +0 -27
- package/demo/elements/authorization/ntlm.ts +0 -43
- package/demo/elements/authorization/oauth-authorize.html +0 -75
- package/demo/elements/authorization/oauth-authorize.ts +0 -40
- package/demo/elements/authorization/oauth-error.html +0 -18
- package/demo/elements/authorization/oauth-error.ts +0 -10
- package/demo/elements/authorization/oauth-popup.html +0 -36
- package/demo/elements/authorization/oauth2.html +0 -27
- package/demo/elements/authorization/oauth2.ts +0 -100
- package/demo/elements/authorization/oidc.html +0 -27
- package/demo/elements/authorization/oidc.ts +0 -139
- package/demo/elements/authorization/private.crt +0 -31
- package/demo/elements/authorization/private.csr +0 -28
- package/demo/elements/authorization/private.key +0 -51
- package/demo/elements/authorization/private.pem +0 -31
- package/demo/elements/authorization/redirect.html +0 -20
- package/demo/elements/authorization/ssl-commands.sh +0 -30
- package/demo/elements/authorization/ssl.conf +0 -24
- package/demo/elements/autocomplete/index.html +0 -64
- package/demo/elements/autocomplete/index.ts +0 -171
- package/demo/elements/code-editor/CodeEditorDemo.ts +0 -173
- package/demo/elements/code-editor/index.html +0 -19
- package/demo/elements/context-menu/DemoIcons.ts +0 -21
- package/demo/elements/context-menu/basic.html +0 -25
- package/demo/elements/context-menu/basic.ts +0 -119
- package/demo/elements/context-menu/custom-data.html +0 -25
- package/demo/elements/context-menu/custom-data.ts +0 -62
- package/demo/elements/context-menu/demo.css +0 -28
- package/demo/elements/context-menu/enabled-state.html +0 -25
- package/demo/elements/context-menu/enabled-state.ts +0 -73
- package/demo/elements/context-menu/icons.html +0 -25
- package/demo/elements/context-menu/icons.ts +0 -64
- package/demo/elements/context-menu/index.html +0 -43
- package/demo/elements/context-menu/nested.html +0 -25
- package/demo/elements/context-menu/nestedt.ts +0 -152
- package/demo/elements/context-menu/no-execute.html +0 -25
- package/demo/elements/context-menu/no-execute.ts +0 -134
- package/demo/elements/context-menu/radio-menu.html +0 -25
- package/demo/elements/context-menu/radio-menu.ts +0 -83
- package/demo/elements/context-menu/separators.html +0 -25
- package/demo/elements/context-menu/separators.ts +0 -172
- package/demo/elements/currency/index.html +0 -91
- package/demo/elements/currency/index.ts +0 -352
- package/demo/elements/environment/environment-editor.html +0 -20
- package/demo/elements/environment/environment-editor.ts +0 -49
- package/demo/elements/environment/index.html +0 -33
- package/demo/elements/environment/server-editor.html +0 -20
- package/demo/elements/environment/server-editor.ts +0 -67
- package/demo/elements/environment/variables-editor.html +0 -20
- package/demo/elements/environment/variables-editor.ts +0 -94
- package/demo/elements/har/har-viewer.html +0 -20
- package/demo/elements/har/har-viewer.ts +0 -76
- package/demo/elements/har/har1.har +0 -3044
- package/demo/elements/har/har2.json +0 -439
- package/demo/elements/har/index.html +0 -26
- package/demo/elements/highlight/example.md +0 -27
- package/demo/elements/highlight/index.html +0 -31
- package/demo/elements/highlight/marked-highlight.html +0 -132
- package/demo/elements/highlight/marked-highlight.ts +0 -22
- package/demo/elements/highlight/prism-highlight.html +0 -62
- package/demo/elements/highlight/prism-highlight.ts +0 -17
- package/demo/elements/http/body-editor.html +0 -17
- package/demo/elements/http/body-editor.ts +0 -115
- package/demo/elements/http/headers.html +0 -17
- package/demo/elements/http/headers.ts +0 -59
- package/demo/elements/http/http-assertions.html +0 -20
- package/demo/elements/http/http-assertions.ts +0 -89
- package/demo/elements/http/http-flows.html +0 -23
- package/demo/elements/http/http-flows.ts +0 -89
- package/demo/elements/http/index.html +0 -45
- package/demo/elements/http/request-editor.html +0 -26
- package/demo/elements/http/request-editor.ts +0 -197
- package/demo/elements/http/request-log.html +0 -16
- package/demo/elements/http/request-log.ts +0 -136
- package/demo/elements/http/url-editing.html +0 -17
- package/demo/elements/http/url-editing.ts +0 -112
- package/demo/elements/icons/index.html +0 -81
- package/demo/elements/icons/index.ts +0 -52
- package/demo/elements/index.html +0 -72
- package/demo/elements/mention-textarea/index.html +0 -19
- package/demo/elements/mention-textarea/index.ts +0 -205
- package/demo/elements/navigation/navigation-item.html +0 -49
- package/demo/elements/navigation/navigation-item.ts +0 -131
- package/demo/elements/navigation/navigation.html +0 -20
- package/demo/elements/navigation/navigation.ts +0 -45
- package/demo/elements/project/index.html +0 -29
- package/demo/elements/project/project-run-report.html +0 -20
- package/demo/elements/project/project-run-report.ts +0 -132
- package/demo/elements/project/request-editor.html +0 -23
- package/demo/elements/project/request-editor.ts +0 -232
- package/demo/elements/user/user-avatar.html +0 -17
- package/demo/elements/user/user-avatar.ts +0 -60
- package/demo/env.js +0 -4
- package/demo/index.html +0 -34
- package/demo/layout/index.html +0 -94
- package/demo/layout/index.ts +0 -190
- package/demo/md/DemoStyles.ts +0 -61
- package/demo/md/UiDemoPage.ts +0 -6
- package/demo/md/buttons/button.html +0 -121
- package/demo/md/buttons/button.ts +0 -246
- package/demo/md/buttons/group.html +0 -36
- package/demo/md/buttons/group.ts +0 -171
- package/demo/md/checkbox/index.html +0 -39
- package/demo/md/checkbox/index.ts +0 -220
- package/demo/md/chip/chip.html +0 -70
- package/demo/md/chip/chip.ts +0 -219
- package/demo/md/chip/pawel6c9a.jpg +0 -0
- package/demo/md/collapse/CustomDetail.ts +0 -89
- package/demo/md/collapse/collapse.html +0 -21
- package/demo/md/collapse/collapse.ts +0 -78
- package/demo/md/date-picker/date-picker.ts +0 -336
- package/demo/md/date-picker/index.html +0 -171
- package/demo/md/dialog/confirm-dialog.html +0 -49
- package/demo/md/dialog/confirm-dialog.ts +0 -121
- package/demo/md/dialog/dialog.html +0 -25
- package/demo/md/dialog/dialog.ts +0 -468
- package/demo/md/dropdown-list/index.html +0 -31
- package/demo/md/dropdown-list/index.ts +0 -158
- package/demo/md/icon-button/index.html +0 -122
- package/demo/md/icon-button/index.ts +0 -132
- package/demo/md/index.html +0 -73
- package/demo/md/inputs/input.html +0 -73
- package/demo/md/inputs/input.ts +0 -278
- package/demo/md/inputs/radio.html +0 -39
- package/demo/md/inputs/radio.ts +0 -156
- package/demo/md/inputs/switch.html +0 -45
- package/demo/md/inputs/switch.ts +0 -144
- package/demo/md/list/list.html +0 -65
- package/demo/md/list/list.ts +0 -204
- package/demo/md/listbox/listbox.html +0 -31
- package/demo/md/listbox/listbox.ts +0 -27
- package/demo/md/menu/index.html +0 -19
- package/demo/md/menu/index.ts +0 -514
- package/demo/md/notification/snack.html +0 -21
- package/demo/md/notification/snack.ts +0 -70
- package/demo/md/progress/progress.html +0 -46
- package/demo/md/progress/progress.ts +0 -161
- package/demo/md/segmented-button/index.html +0 -21
- package/demo/md/segmented-button/index.ts +0 -55
- package/demo/md/select/index.html +0 -16
- package/demo/md/select/index.ts +0 -217
- package/demo/md/tabs/tabs.html +0 -40
- package/demo/md/tabs/tabs.ts +0 -214
- package/demo/oauth-popup.html +0 -36
- package/demo/page.css +0 -8
- package/demo/resources/calendar-month.png +0 -0
- package/demo/resources/favorite.png +0 -0
- package/demo/resources/fingerprint.png +0 -0
- package/demo/resources/home-work.png +0 -0
- package/demo/resources/mood.png +0 -0
- package/demo/resources/print.png +0 -0
- package/demo/resources/stars.png +0 -0
- package/demo/resources/theaters.png +0 -0
- package/demo/tsconfig.json +0 -4
- package/eslint.config.js +0 -97
- package/scripts/copy-assets.js +0 -21
- package/scripts/release.js +0 -66
- package/src/demo/DemoPage.ts +0 -169
- package/src/demo/DemoStyles.ts +0 -60
- package/test/README.md +0 -375
- package/test/contextual-menu/ContextMenu.test.ts +0 -760
- package/test/contextual-menu/ContextMenuElement.test.ts +0 -569
- package/test/core/activity.spec.ts +0 -413
- package/test/core/activity_manager.spec.ts +0 -544
- package/test/core/application.spec.ts +0 -218
- package/test/core/fragment.spec.ts +0 -565
- package/test/core/fragment_manager.spec.ts +0 -404
- package/test/core/live_data.spec.ts +0 -558
- package/test/core/renderer.spec.ts +0 -113
- package/test/dom-assertions.test.ts +0 -182
- package/test/elements/MonacoSetup.ts +0 -65
- package/test/elements/authorization/basic-method.test.ts +0 -177
- package/test/elements/authorization/bearer-method.test.ts +0 -143
- package/test/elements/authorization/ntlm-method.test.ts +0 -219
- package/test/elements/authorization/oauth2-client-credentials-method.test.ts +0 -334
- package/test/elements/authorization/oauth2-code-method.test.ts +0 -320
- package/test/elements/authorization/oauth2-custom-grant-method.test.ts +0 -255
- package/test/elements/authorization/oauth2-device-code-method.test.ts +0 -371
- package/test/elements/authorization/oauth2-implicit-method.test.ts +0 -407
- package/test/elements/authorization/oauth2-jwt-method.test.ts +0 -217
- package/test/elements/authorization/oauth2-password-method.test.ts +0 -275
- package/test/elements/authorization/openid-method.test.ts +0 -591
- package/test/elements/autocomplete/autocomplete-input.spec.ts +0 -646
- package/test/elements/code-editor/code-editor.accessibility.test.ts +0 -298
- package/test/elements/code-editor/code-editor.test.ts +0 -574
- package/test/elements/currency/CurrencyPicker.accessibility.test.ts +0 -328
- package/test/elements/currency/CurrencyPicker.core.test.ts +0 -318
- package/test/elements/currency/CurrencyPicker.integration.test.ts +0 -482
- package/test/elements/currency/CurrencyPicker.test.ts +0 -486
- package/test/elements/data-table/DataTable.browser.test.ts +0 -649
- package/test/elements/har/HarUtils.test.ts +0 -45
- package/test/elements/har/HarViewerElement.test.ts +0 -687
- package/test/elements/har/test-data/har1.har +0 -3044
- package/test/elements/highlight/MarkedHighlightElement.test.ts +0 -452
- package/test/elements/highlight/PrismHighlightElement.test.ts +0 -79
- package/test/elements/highlight/PrismHighlighter.test.ts +0 -94
- package/test/elements/highlight/remoteSanitization.md +0 -1
- package/test/elements/highlight/test.md +0 -3
- package/test/elements/highlight/test1.md +0 -3
- package/test/elements/highlight/test2.md +0 -1
- package/test/elements/http/BodyFormdataEditorElement.test.ts +0 -482
- package/test/elements/http/BodyMultipartEditorElement.test.ts +0 -658
- package/test/elements/http/BodyRawEditorElement.test.ts +0 -90
- package/test/elements/http/CertificateAdd.test.ts +0 -457
- package/test/elements/http/HttpAssertions.test.ts +0 -994
- package/test/elements/http/HttpFlows.test.ts +0 -502
- package/test/elements/http/UrlEncodeUtils.test.ts +0 -202
- package/test/elements/layout/SplitItem.test.ts +0 -440
- package/test/elements/layout/SplitLayoutManager.test.ts +0 -1501
- package/test/elements/layout/SplitPanel.test.ts +0 -1109
- package/test/elements/mention-textarea/MentionTextArea.basic.test.ts +0 -114
- package/test/elements/mention-textarea/MentionTextArea.test.ts +0 -613
- package/test/elements/navigation/Navigation.test.ts +0 -120
- package/test/env.ts +0 -15
- package/test/events/EventTypes.test.ts +0 -363
- package/test/events/EventsTestHelpers.ts +0 -16
- package/test/helpers/TestUtils.ts +0 -243
- package/test/helpers/UiMock.ts +0 -185
- package/test/lib/Dom.test.ts +0 -231
- package/test/md/button/UiButton.test.ts +0 -347
- package/test/md/button/UiIconButton.test.ts +0 -155
- package/test/md/chip/UiChip.test.ts +0 -219
- package/test/md/collapse/UiCollapse.test.ts +0 -250
- package/test/md/collapse/flex-layout.test.ts +0 -105
- package/test/md/date-time/DateTime.test.ts +0 -348
- package/test/md/dialog/UiConfirmDialog.test.ts +0 -131
- package/test/md/dialog/UiDialog.test.ts +0 -759
- package/test/md/menu/Menu.test.ts +0 -855
- package/test/md/menu/MenuIntegration.test.ts +0 -426
- package/test/md/menu/MenuItem.test.ts +0 -652
- package/test/md/menu/SubMenu.test.ts +0 -410
- package/test/md/progress/UiCircularProgressElement.test.ts +0 -481
- package/test/md/progress/UiProgressElement.test.ts +0 -117
- package/test/md/progress/UiRangeElement.test.ts +0 -156
- package/test/md/select/Select.test.ts +0 -925
- package/test/plugins/takeScreenshotPlugin.js +0 -35
- package/test/setup.test.ts +0 -217
- package/test/setup.ts +0 -117
- package/test/tsconfig.json +0 -7
- package/web-dev-server.config.js +0 -21
- package/web-test-runner.config.js +0 -90
|
@@ -1,687 +0,0 @@
|
|
|
1
|
-
import { assert, fixture, nextFrame, html } from '@open-wc/testing'
|
|
2
|
-
import sinon from 'sinon'
|
|
3
|
-
import type { Har } from 'har-format'
|
|
4
|
-
import HarViewerElement from '../../../src/elements/har/HarViewer.js'
|
|
5
|
-
import * as HarUtils from '../../../src/elements/har/HarUtils.js'
|
|
6
|
-
import '../../../src/define/har/har-viewer.js'
|
|
7
|
-
|
|
8
|
-
describe('HarViewer', () => {
|
|
9
|
-
const demo1file = 'har1.har'
|
|
10
|
-
|
|
11
|
-
async function basicFixture(har?: Har): Promise<HarViewerElement> {
|
|
12
|
-
return fixture(html`<har-viewer .har="${har}"></har-viewer>`)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
async function readHarFile(name: string): Promise<Har> {
|
|
16
|
-
const url = new URL(`/test/elements/har/test-data/${name}`, window.location.href).toString()
|
|
17
|
-
const response = await fetch(url)
|
|
18
|
-
return response.json()
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
describe('No model', () => {
|
|
22
|
-
let element: HarViewerElement
|
|
23
|
-
beforeEach(async () => {
|
|
24
|
-
element = await basicFixture()
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
it('has no content', () => {
|
|
28
|
-
const nodes = element.querySelectorAll('*')
|
|
29
|
-
assert.lengthOf(nodes, 0)
|
|
30
|
-
})
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
describe('Model computations', () => {
|
|
34
|
-
let element: HarViewerElement
|
|
35
|
-
beforeEach(async () => {
|
|
36
|
-
const model = await readHarFile(demo1file)
|
|
37
|
-
element = await basicFixture(model)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
it('sets .pages', () => {
|
|
41
|
-
assert.typeOf(element.pages, 'array', 'has computed pages')
|
|
42
|
-
assert.lengthOf(element.pages!, 1, 'has single page')
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('does not set entries when pages', () => {
|
|
46
|
-
assert.isUndefined(element.entries)
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
it('ignores computations when "log" is not set', () => {
|
|
50
|
-
// @ts-expect-error for testing
|
|
51
|
-
element.har = {}
|
|
52
|
-
assert.isUndefined(element.pages, 'pages are not set')
|
|
53
|
-
assert.isUndefined(element.entries, 'entries are not set')
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
it('ignores computations when "log" has no entries', () => {
|
|
57
|
-
// @ts-expect-error for testing
|
|
58
|
-
element.har = { log: { pages: [{ title: 'test', startedDateTime: 'test', id: 'test' }] } }
|
|
59
|
-
assert.isUndefined(element.pages, 'pages are not set')
|
|
60
|
-
assert.isUndefined(element.entries, 'entries are not set')
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
describe('processHar()', () => {
|
|
65
|
-
let model: Har
|
|
66
|
-
|
|
67
|
-
before(async () => {
|
|
68
|
-
model = await readHarFile(demo1file)
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
let element: HarViewerElement
|
|
72
|
-
beforeEach(async () => {
|
|
73
|
-
element = await basicFixture()
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
it('clears entries value', () => {
|
|
77
|
-
element.entries = []
|
|
78
|
-
element.processHar()
|
|
79
|
-
assert.isUndefined(element.entries)
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('clears pages value', () => {
|
|
83
|
-
element.pages = []
|
|
84
|
-
element.processHar()
|
|
85
|
-
assert.isUndefined(element.pages)
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
it('ignores when no data set', () => {
|
|
89
|
-
element.processHar()
|
|
90
|
-
assert.isUndefined(element.entries)
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
it('ignores when no log data', () => {
|
|
94
|
-
// @ts-expect-error for testing
|
|
95
|
-
element.har = {}
|
|
96
|
-
assert.isUndefined(element.entries)
|
|
97
|
-
})
|
|
98
|
-
|
|
99
|
-
it('ignores when no entries data', () => {
|
|
100
|
-
// @ts-expect-error for testing
|
|
101
|
-
element.har = { log: {} }
|
|
102
|
-
assert.isUndefined(element.entries)
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
it('calls the computePages for data with pages', () => {
|
|
106
|
-
const spy = sinon.spy(element, 'computePages')
|
|
107
|
-
element.har = model
|
|
108
|
-
assert.isTrue(spy.calledOnce)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('calls the computeEntriesOnly for data with pages and ignorePages', () => {
|
|
112
|
-
element.ignorePages = true
|
|
113
|
-
const spy = sinon.spy(element, 'computeEntriesOnly')
|
|
114
|
-
element.har = model
|
|
115
|
-
assert.isTrue(spy.calledOnce)
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
it('calls the computeEntriesOnly when no pages', () => {
|
|
119
|
-
const spy = sinon.spy(element, 'computeEntriesOnly')
|
|
120
|
-
const cp = { ...model }
|
|
121
|
-
delete cp.log.pages
|
|
122
|
-
element.har = model
|
|
123
|
-
assert.isTrue(spy.calledOnce)
|
|
124
|
-
})
|
|
125
|
-
})
|
|
126
|
-
|
|
127
|
-
describe('computeEntriesOnly', () => {
|
|
128
|
-
let model: Har
|
|
129
|
-
|
|
130
|
-
before(async () => {
|
|
131
|
-
model = await readHarFile(demo1file)
|
|
132
|
-
delete model.log.pages
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
let element: HarViewerElement
|
|
136
|
-
beforeEach(async () => {
|
|
137
|
-
element = await basicFixture()
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
it('sets the .entries value', () => {
|
|
141
|
-
element.har = model
|
|
142
|
-
assert.typeOf(element.entries, 'array', 'sets the value')
|
|
143
|
-
assert.lengthOf(element.entries!, 18, 'has the entries')
|
|
144
|
-
})
|
|
145
|
-
|
|
146
|
-
it('sets the openedEntries value', () => {
|
|
147
|
-
element.openedEntries = ['test']
|
|
148
|
-
element.har = model
|
|
149
|
-
assert.deepEqual(element.openedEntries, [])
|
|
150
|
-
})
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
describe('[computePages]', () => {
|
|
154
|
-
let model: Har
|
|
155
|
-
|
|
156
|
-
before(async () => {
|
|
157
|
-
model = await readHarFile(demo1file)
|
|
158
|
-
})
|
|
159
|
-
|
|
160
|
-
let element: HarViewerElement
|
|
161
|
-
beforeEach(async () => {
|
|
162
|
-
element = await basicFixture()
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
it('sets the .pages value', () => {
|
|
166
|
-
element.har = model
|
|
167
|
-
assert.typeOf(element.pages, 'array', 'sets the value')
|
|
168
|
-
assert.lengthOf(element.pages!, 1, 'has the pages')
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
it('sets the openedPages value', () => {
|
|
172
|
-
element.openedPages = ['test']
|
|
173
|
-
element.har = model
|
|
174
|
-
assert.deepEqual(element.openedPages, ['page_1'])
|
|
175
|
-
})
|
|
176
|
-
|
|
177
|
-
it('sets the .openedEntries value', () => {
|
|
178
|
-
element.openedEntries = ['test']
|
|
179
|
-
element.har = model
|
|
180
|
-
assert.deepEqual(element.openedEntries, [])
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
it('sets the original page', () => {
|
|
184
|
-
element.har = model
|
|
185
|
-
const [info] = element.pages!
|
|
186
|
-
assert.deepEqual(info.page, model.log.pages![0])
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
it('sets the entries for the page', () => {
|
|
190
|
-
element.har = model
|
|
191
|
-
const [info] = element.pages!
|
|
192
|
-
assert.equal(info.entries.length, model.log.entries.length)
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
it('computes the total time', () => {
|
|
196
|
-
element.har = model
|
|
197
|
-
const [info] = element.pages!
|
|
198
|
-
assert.typeOf(info.totalTime, 'number')
|
|
199
|
-
})
|
|
200
|
-
})
|
|
201
|
-
|
|
202
|
-
describe('computeRenderedEntries()', () => {
|
|
203
|
-
let model: Har
|
|
204
|
-
let sorted: HarUtils.SortableEntry[]
|
|
205
|
-
const totalTime = 10000
|
|
206
|
-
|
|
207
|
-
before(async () => {
|
|
208
|
-
model = await readHarFile(demo1file)
|
|
209
|
-
})
|
|
210
|
-
|
|
211
|
-
let element: HarViewerElement
|
|
212
|
-
beforeEach(async () => {
|
|
213
|
-
element = await basicFixture()
|
|
214
|
-
sorted = HarUtils.sortEntires(model.log.entries)
|
|
215
|
-
})
|
|
216
|
-
|
|
217
|
-
it('returns empty array when no argument', () => {
|
|
218
|
-
// @ts-expect-error for testing
|
|
219
|
-
const result = element.computeRenderedEntries(undefined, totalTime)
|
|
220
|
-
assert.deepEqual(result, [])
|
|
221
|
-
})
|
|
222
|
-
|
|
223
|
-
it('returns transformed entries', () => {
|
|
224
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
225
|
-
assert.typeOf(result, 'array', 'sets the value')
|
|
226
|
-
assert.lengthOf(result, sorted.length, 'has the pages')
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
it('has autogenerated id', () => {
|
|
230
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
231
|
-
const [first, second] = result
|
|
232
|
-
assert.typeOf(first.id, 'string', 'has the id')
|
|
233
|
-
assert.isAbove(Number(second.id), Number(first.id), 'has different values')
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
it('has computed time labels', () => {
|
|
237
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
238
|
-
const [entry] = result
|
|
239
|
-
// webkit may differently compute the values as it ignores user's locale (apple knows better)
|
|
240
|
-
// assert.equal(entry.requestTime, '13:04:59.283', 'has the requestTime');
|
|
241
|
-
// assert.equal(entry.requestFormattedDate, '15 Mar 2021, 13:04:59', 'has the requestFormattedDate');
|
|
242
|
-
assert.typeOf(entry.requestTime, 'string', 'has the requestTime')
|
|
243
|
-
assert.typeOf(entry.requestFormattedDate, 'string', 'has the requestFormattedDate')
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
it('has computed requestSizes', () => {
|
|
247
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
248
|
-
const [entry] = result
|
|
249
|
-
assert.deepEqual(entry.requestSizes, {
|
|
250
|
-
headersComputed: false,
|
|
251
|
-
bodyComputed: false,
|
|
252
|
-
body: '0 Bytes',
|
|
253
|
-
headers: '735 Bytes',
|
|
254
|
-
sum: '735 Bytes',
|
|
255
|
-
sumComputed: false,
|
|
256
|
-
})
|
|
257
|
-
})
|
|
258
|
-
|
|
259
|
-
it('has computed responseSizes', () => {
|
|
260
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
261
|
-
const [entry] = result
|
|
262
|
-
assert.deepEqual(entry.responseSizes, {
|
|
263
|
-
headersComputed: false,
|
|
264
|
-
bodyComputed: false,
|
|
265
|
-
body: '13.7 KB',
|
|
266
|
-
headers: '567 Bytes',
|
|
267
|
-
sum: '14.25 KB',
|
|
268
|
-
sumComputed: false,
|
|
269
|
-
})
|
|
270
|
-
})
|
|
271
|
-
|
|
272
|
-
it('has computed visualTimings', () => {
|
|
273
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
274
|
-
const [entry] = result
|
|
275
|
-
assert.approximately(entry.visualTimings!.blocked!, 0.45, 0.01, 'has blocked')
|
|
276
|
-
assert.approximately(entry.visualTimings!.receive!, 17.24, 0.01, 'has receive')
|
|
277
|
-
assert.approximately(entry.visualTimings!.send!, 0.01, 0.01, 'has send')
|
|
278
|
-
assert.approximately(entry.visualTimings!.total, 10.48, 0.01, 'has total')
|
|
279
|
-
assert.approximately(entry.visualTimings!.totalValue, 1048.83, 0.01, 'has totalValue')
|
|
280
|
-
assert.approximately(entry.visualTimings!.wait!, 82.29, 0.01, 'has wait')
|
|
281
|
-
})
|
|
282
|
-
|
|
283
|
-
it('has the rest of the entry', () => {
|
|
284
|
-
const result = element.computeRenderedEntries(sorted, totalTime)
|
|
285
|
-
const [entry] = result
|
|
286
|
-
assert.equal(entry.pageref, 'page_1')
|
|
287
|
-
})
|
|
288
|
-
})
|
|
289
|
-
|
|
290
|
-
describe('computeEntrySizeInfo', () => {
|
|
291
|
-
let element: HarViewerElement
|
|
292
|
-
beforeEach(async () => {
|
|
293
|
-
element = await basicFixture()
|
|
294
|
-
})
|
|
295
|
-
|
|
296
|
-
it('returns headers size from the headersSize property', () => {
|
|
297
|
-
const info = {
|
|
298
|
-
headersSize: 101,
|
|
299
|
-
bodySize: 102,
|
|
300
|
-
}
|
|
301
|
-
// @ts-expect-error for testing
|
|
302
|
-
const result = element.computeEntrySizeInfo(info)
|
|
303
|
-
assert.equal(result.headers, '101 Bytes', 'headers size is set')
|
|
304
|
-
assert.isFalse(result.headersComputed, 'headersComputed is false')
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
it('returns body size from the bodySize property', () => {
|
|
308
|
-
const info = {
|
|
309
|
-
headersSize: 101,
|
|
310
|
-
bodySize: 102,
|
|
311
|
-
}
|
|
312
|
-
// @ts-expect-error for testing
|
|
313
|
-
const result = element.computeEntrySizeInfo(info)
|
|
314
|
-
assert.equal(result.body, '102 Bytes', 'headers size is set')
|
|
315
|
-
assert.isFalse(result.bodyComputed, 'bodyComputed is false')
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
it('returns computed headers size the headers', () => {
|
|
319
|
-
const info = {
|
|
320
|
-
headersSize: -1,
|
|
321
|
-
headers: [
|
|
322
|
-
{
|
|
323
|
-
name: 'lorem',
|
|
324
|
-
value: ' ipsum',
|
|
325
|
-
},
|
|
326
|
-
],
|
|
327
|
-
bodySize: 102,
|
|
328
|
-
}
|
|
329
|
-
// @ts-expect-error for testing
|
|
330
|
-
const result = element.computeEntrySizeInfo(info)
|
|
331
|
-
assert.equal(result.headers, '13 Bytes', 'headers size is set')
|
|
332
|
-
assert.isTrue(result.headersComputed, 'headersComputed is true')
|
|
333
|
-
})
|
|
334
|
-
|
|
335
|
-
it('returns computed body size of the request.content.size', () => {
|
|
336
|
-
const info = {
|
|
337
|
-
headersSize: 101,
|
|
338
|
-
bodySize: -1,
|
|
339
|
-
content: {
|
|
340
|
-
size: 102,
|
|
341
|
-
},
|
|
342
|
-
}
|
|
343
|
-
// @ts-expect-error for testing
|
|
344
|
-
const result = element.computeEntrySizeInfo(info)
|
|
345
|
-
assert.equal(result.body, '102 Bytes', 'body size is set')
|
|
346
|
-
assert.isFalse(result.bodyComputed, 'bodyComputed is false')
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
it('returns computed body size of the request.content.text', () => {
|
|
350
|
-
const info = {
|
|
351
|
-
headersSize: 101,
|
|
352
|
-
bodySize: -1,
|
|
353
|
-
content: {
|
|
354
|
-
text: 'lorem ipsum',
|
|
355
|
-
},
|
|
356
|
-
}
|
|
357
|
-
// @ts-expect-error for testing
|
|
358
|
-
const result = element.computeEntrySizeInfo(info)
|
|
359
|
-
assert.equal(result.body, '11 Bytes', 'body size is set')
|
|
360
|
-
assert.isTrue(result.bodyComputed, 'bodyComputed is true')
|
|
361
|
-
})
|
|
362
|
-
|
|
363
|
-
it('returns computed body size of the response.calculateBytes.text', () => {
|
|
364
|
-
const info = {
|
|
365
|
-
headersSize: 101,
|
|
366
|
-
bodySize: -1,
|
|
367
|
-
postData: {
|
|
368
|
-
text: 'lorem ipsum',
|
|
369
|
-
},
|
|
370
|
-
}
|
|
371
|
-
// @ts-expect-error for testing
|
|
372
|
-
const result = element.computeEntrySizeInfo(info)
|
|
373
|
-
assert.equal(result.body, '11 Bytes', 'body size is set')
|
|
374
|
-
assert.isTrue(result.bodyComputed, 'bodyComputed is true')
|
|
375
|
-
})
|
|
376
|
-
|
|
377
|
-
it('returns sum for both defined values', () => {
|
|
378
|
-
const info = {
|
|
379
|
-
headersSize: 101,
|
|
380
|
-
bodySize: 102,
|
|
381
|
-
}
|
|
382
|
-
// @ts-expect-error for testing
|
|
383
|
-
const result = element.computeEntrySizeInfo(info)
|
|
384
|
-
assert.equal(result.sum, '203 Bytes', 'sum size is set')
|
|
385
|
-
assert.isFalse(result.sumComputed, 'sumComputed is false')
|
|
386
|
-
})
|
|
387
|
-
|
|
388
|
-
it('returns sum for both computed values', () => {
|
|
389
|
-
const info = {
|
|
390
|
-
headersSize: -1,
|
|
391
|
-
headers: [
|
|
392
|
-
{
|
|
393
|
-
name: 'lorem',
|
|
394
|
-
value: ' ipsum',
|
|
395
|
-
},
|
|
396
|
-
],
|
|
397
|
-
bodySize: -1,
|
|
398
|
-
content: {
|
|
399
|
-
text: 'lorem ipsum',
|
|
400
|
-
},
|
|
401
|
-
}
|
|
402
|
-
// @ts-expect-error for testing
|
|
403
|
-
const result = element.computeEntrySizeInfo(info)
|
|
404
|
-
assert.equal(result.sum, '24 Bytes', 'sum size is set')
|
|
405
|
-
assert.isTrue(result.sumComputed, 'sumComputed is true')
|
|
406
|
-
})
|
|
407
|
-
|
|
408
|
-
it('returns zeros when not defined', () => {
|
|
409
|
-
const info = {
|
|
410
|
-
headersSize: -1,
|
|
411
|
-
bodySize: -1,
|
|
412
|
-
headers: [],
|
|
413
|
-
}
|
|
414
|
-
// @ts-expect-error for testing
|
|
415
|
-
const result = element.computeEntrySizeInfo(info)
|
|
416
|
-
assert.equal(result.body, '0 Bytes', 'body size is set')
|
|
417
|
-
assert.equal(result.headers, '0 Bytes', 'headers size is set')
|
|
418
|
-
assert.equal(result.sum, '0 Bytes', 'sum size is set')
|
|
419
|
-
})
|
|
420
|
-
})
|
|
421
|
-
|
|
422
|
-
describe('computeStatusClasses()', () => {
|
|
423
|
-
let element: HarViewerElement
|
|
424
|
-
beforeEach(async () => {
|
|
425
|
-
element = await basicFixture()
|
|
426
|
-
})
|
|
427
|
-
|
|
428
|
-
it('has status-code class', () => {
|
|
429
|
-
const result = element.computeStatusClasses(100)
|
|
430
|
-
assert.isTrue(result['status-code'])
|
|
431
|
-
})
|
|
432
|
-
|
|
433
|
-
it('sets error class for 5xx', () => {
|
|
434
|
-
const result = element.computeStatusClasses(500)
|
|
435
|
-
assert.isTrue(result['status-code'], 'status code is set')
|
|
436
|
-
assert.isTrue(result.error, 'error is set')
|
|
437
|
-
assert.isFalse(result.warning, 'warning is not set')
|
|
438
|
-
assert.isFalse(result.info, 'info is not set')
|
|
439
|
-
})
|
|
440
|
-
|
|
441
|
-
it('sets error class for 0', () => {
|
|
442
|
-
const result = element.computeStatusClasses(0)
|
|
443
|
-
assert.isTrue(result['status-code'], 'status code is set')
|
|
444
|
-
assert.isTrue(result.error, 'error is set')
|
|
445
|
-
assert.isFalse(result.warning, 'warning is not set')
|
|
446
|
-
assert.isFalse(result.info, 'info is not set')
|
|
447
|
-
})
|
|
448
|
-
|
|
449
|
-
it('sets warning class for 4xx', () => {
|
|
450
|
-
const result = element.computeStatusClasses(400)
|
|
451
|
-
assert.isTrue(result['status-code'], 'status code is set')
|
|
452
|
-
assert.isFalse(result.error, 'error is not set')
|
|
453
|
-
assert.isTrue(result.warning, 'warning is set')
|
|
454
|
-
assert.isFalse(result.info, 'info is not set')
|
|
455
|
-
})
|
|
456
|
-
|
|
457
|
-
it('sets info class for 4xx', () => {
|
|
458
|
-
const result = element.computeStatusClasses(300)
|
|
459
|
-
assert.isTrue(result['status-code'], 'status code is set')
|
|
460
|
-
assert.isFalse(result.error, 'error is not set')
|
|
461
|
-
assert.isFalse(result.warning, 'warning is not set')
|
|
462
|
-
assert.isTrue(result.info, 'info is set')
|
|
463
|
-
})
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
describe('computeTotalTime()', () => {
|
|
467
|
-
let model: Har
|
|
468
|
-
|
|
469
|
-
before(async () => {
|
|
470
|
-
model = await readHarFile(demo1file)
|
|
471
|
-
})
|
|
472
|
-
|
|
473
|
-
let element: HarViewerElement
|
|
474
|
-
beforeEach(async () => {
|
|
475
|
-
element = await basicFixture()
|
|
476
|
-
})
|
|
477
|
-
|
|
478
|
-
it('computes time for two entries', () => {
|
|
479
|
-
const [first, second] = model.log.entries
|
|
480
|
-
const result = element.computeTotalTime(first, second)
|
|
481
|
-
assert.approximately(result, 1115.52, 0.01)
|
|
482
|
-
})
|
|
483
|
-
|
|
484
|
-
it('computes time for a single entry', () => {
|
|
485
|
-
const [first] = model.log.entries
|
|
486
|
-
const result = element.computeTotalTime(first, first)
|
|
487
|
-
assert.approximately(result, 1048.83, 0.01)
|
|
488
|
-
})
|
|
489
|
-
})
|
|
490
|
-
|
|
491
|
-
describe('computeVisualTimes()', () => {
|
|
492
|
-
let model: Har
|
|
493
|
-
const total = 1000
|
|
494
|
-
|
|
495
|
-
before(async () => {
|
|
496
|
-
model = await readHarFile(demo1file)
|
|
497
|
-
})
|
|
498
|
-
|
|
499
|
-
let element: HarViewerElement
|
|
500
|
-
beforeEach(async () => {
|
|
501
|
-
element = await basicFixture()
|
|
502
|
-
})
|
|
503
|
-
|
|
504
|
-
it('computes the total property', () => {
|
|
505
|
-
const [entry] = model.log.entries
|
|
506
|
-
const result = element.computeVisualTimes(entry.timings, 0, total)!
|
|
507
|
-
assert.approximately(result.total, 104.88, 0.01)
|
|
508
|
-
})
|
|
509
|
-
|
|
510
|
-
it('computes the totalValue property', () => {
|
|
511
|
-
const [entry] = model.log.entries
|
|
512
|
-
const result = element.computeVisualTimes(entry.timings, 0, total)!
|
|
513
|
-
assert.approximately(result.totalValue, 1048.83, 0.01)
|
|
514
|
-
})
|
|
515
|
-
|
|
516
|
-
it('has no delay when zero', () => {
|
|
517
|
-
const [entry] = model.log.entries
|
|
518
|
-
const result = element.computeVisualTimes(entry.timings, 0, total)!
|
|
519
|
-
assert.isUndefined(result.delay)
|
|
520
|
-
})
|
|
521
|
-
|
|
522
|
-
it('computes the delay property', () => {
|
|
523
|
-
const [entry] = model.log.entries
|
|
524
|
-
const result = element.computeVisualTimes(entry.timings, 100, total)!
|
|
525
|
-
assert.equal(result.delay, 10)
|
|
526
|
-
})
|
|
527
|
-
|
|
528
|
-
it('computes the blocked property', () => {
|
|
529
|
-
const [entry] = model.log.entries
|
|
530
|
-
const result = element.computeVisualTimes(entry.timings, 100, total)!
|
|
531
|
-
assert.approximately(result.blocked!, 0.456, 0.01)
|
|
532
|
-
})
|
|
533
|
-
|
|
534
|
-
it('computes the connect property', () => {
|
|
535
|
-
const [entry] = model.log.entries
|
|
536
|
-
const t = {
|
|
537
|
-
...entry.timings,
|
|
538
|
-
connect: 123,
|
|
539
|
-
}
|
|
540
|
-
const result = element.computeVisualTimes(t, 100, total)!
|
|
541
|
-
assert.approximately(result.connect!, 10.49, 0.01)
|
|
542
|
-
})
|
|
543
|
-
|
|
544
|
-
it('computes the dns property', () => {
|
|
545
|
-
const [entry] = model.log.entries
|
|
546
|
-
const t = {
|
|
547
|
-
...entry.timings,
|
|
548
|
-
dns: 123,
|
|
549
|
-
}
|
|
550
|
-
const result = element.computeVisualTimes(t, 100, total)!
|
|
551
|
-
assert.approximately(result.dns!, 10.49, 0.01)
|
|
552
|
-
})
|
|
553
|
-
|
|
554
|
-
it('computes the receive property', () => {
|
|
555
|
-
const [entry] = model.log.entries
|
|
556
|
-
const result = element.computeVisualTimes(entry.timings, 100, total)!
|
|
557
|
-
assert.approximately(result.receive!, 17.24, 0.01)
|
|
558
|
-
})
|
|
559
|
-
|
|
560
|
-
it('computes the send property', () => {
|
|
561
|
-
const [entry] = model.log.entries
|
|
562
|
-
const result = element.computeVisualTimes(entry.timings, 100, total)!
|
|
563
|
-
assert.approximately(result.send!, 0.01, 0.01)
|
|
564
|
-
})
|
|
565
|
-
|
|
566
|
-
it('computes the ssl property', () => {
|
|
567
|
-
const [entry] = model.log.entries
|
|
568
|
-
const t = {
|
|
569
|
-
...entry.timings,
|
|
570
|
-
ssl: 123,
|
|
571
|
-
}
|
|
572
|
-
const result = element.computeVisualTimes(t, 100, total)!
|
|
573
|
-
assert.approximately(result.ssl!, 10.49, 0.01)
|
|
574
|
-
})
|
|
575
|
-
|
|
576
|
-
it('computes the wait property', () => {
|
|
577
|
-
const [entry] = model.log.entries
|
|
578
|
-
const result = element.computeVisualTimes(entry.timings, 100, total)!
|
|
579
|
-
assert.approximately(result.wait!, 82.29, 0.01)
|
|
580
|
-
})
|
|
581
|
-
})
|
|
582
|
-
|
|
583
|
-
describe('Data rendering', () => {
|
|
584
|
-
let model: Har
|
|
585
|
-
|
|
586
|
-
before(async () => {
|
|
587
|
-
model = await readHarFile(demo1file)
|
|
588
|
-
})
|
|
589
|
-
|
|
590
|
-
let element: HarViewerElement
|
|
591
|
-
beforeEach(async () => {
|
|
592
|
-
element = await basicFixture(model)
|
|
593
|
-
})
|
|
594
|
-
|
|
595
|
-
it('renders a page', () => {
|
|
596
|
-
const nodes = element.shadowRoot!.querySelectorAll('section.page')
|
|
597
|
-
assert.lengthOf(nodes, 1)
|
|
598
|
-
})
|
|
599
|
-
|
|
600
|
-
it('renders page header', () => {
|
|
601
|
-
const header = element.shadowRoot!.querySelector('.page-header') as HTMLElement
|
|
602
|
-
assert.ok(header, 'has the header')
|
|
603
|
-
assert.equal(header.dataset.page, 'page_1', 'has the data-page attribute')
|
|
604
|
-
const url = header.querySelector('.label')!.textContent!.trim()
|
|
605
|
-
assert.equal(url, 'http://www.softwareishard.com/blog/har-12-spec/')
|
|
606
|
-
const time = header.querySelector('.loading-time-label')!.textContent!.trim()
|
|
607
|
-
assert.equal(time, 'Time: 1965 ms')
|
|
608
|
-
})
|
|
609
|
-
|
|
610
|
-
it('entries are rendered by default', () => {
|
|
611
|
-
const list = element.shadowRoot!.querySelector('.page-content') as HTMLElement
|
|
612
|
-
assert.notOk(list.hasAttribute('hidden'))
|
|
613
|
-
})
|
|
614
|
-
|
|
615
|
-
it('closes the page on the label click', async () => {
|
|
616
|
-
const label = element.shadowRoot!.querySelector('.page-header .label') as HTMLElement
|
|
617
|
-
label.click()
|
|
618
|
-
await nextFrame()
|
|
619
|
-
const list = element.shadowRoot!.querySelector('.page-content') as HTMLElement
|
|
620
|
-
assert.ok(list.hasAttribute('hidden'))
|
|
621
|
-
})
|
|
622
|
-
|
|
623
|
-
it('closes the page on space key down', async () => {
|
|
624
|
-
const header = element.shadowRoot!.querySelector('.page-header') as HTMLElement
|
|
625
|
-
header.dispatchEvent(
|
|
626
|
-
new KeyboardEvent('keydown', {
|
|
627
|
-
code: 'Space',
|
|
628
|
-
})
|
|
629
|
-
)
|
|
630
|
-
await nextFrame()
|
|
631
|
-
const list = element.shadowRoot!.querySelector('.page-content') as HTMLElement
|
|
632
|
-
assert.ok(list.hasAttribute('hidden'))
|
|
633
|
-
})
|
|
634
|
-
|
|
635
|
-
it('does not close the page on other key down', async () => {
|
|
636
|
-
const header = element.shadowRoot!.querySelector('.page-header') as HTMLElement
|
|
637
|
-
header.dispatchEvent(
|
|
638
|
-
new KeyboardEvent('keydown', {
|
|
639
|
-
code: 'Enter',
|
|
640
|
-
})
|
|
641
|
-
)
|
|
642
|
-
await nextFrame()
|
|
643
|
-
const list = element.shadowRoot!.querySelector('.page-content') as HTMLElement
|
|
644
|
-
assert.notOk(list.hasAttribute('hidden'))
|
|
645
|
-
})
|
|
646
|
-
|
|
647
|
-
it('opens entry details on item click', async () => {
|
|
648
|
-
const item = element.shadowRoot!.querySelector('.entry-item') as HTMLElement
|
|
649
|
-
const id = item.dataset.entry
|
|
650
|
-
item.click()
|
|
651
|
-
await nextFrame()
|
|
652
|
-
assert.deepEqual(element.openedEntries, [id], 'entry id added to the .openedEntries')
|
|
653
|
-
const details = item.nextElementSibling!
|
|
654
|
-
assert.equal(details.localName, 'section', 'has the details element')
|
|
655
|
-
})
|
|
656
|
-
})
|
|
657
|
-
|
|
658
|
-
describe('a11y', () => {
|
|
659
|
-
let model: Har
|
|
660
|
-
|
|
661
|
-
before(async () => {
|
|
662
|
-
model = await readHarFile(demo1file)
|
|
663
|
-
})
|
|
664
|
-
|
|
665
|
-
let element: HarViewerElement
|
|
666
|
-
beforeEach(async () => {
|
|
667
|
-
element = await basicFixture(model)
|
|
668
|
-
})
|
|
669
|
-
|
|
670
|
-
it('is accessible for page results', async () => {
|
|
671
|
-
await assert.isAccessible(element)
|
|
672
|
-
})
|
|
673
|
-
|
|
674
|
-
it('is accessible for details page', async () => {
|
|
675
|
-
const item = element.shadowRoot!.querySelector('.entry-item') as HTMLElement
|
|
676
|
-
item.click()
|
|
677
|
-
await nextFrame()
|
|
678
|
-
await assert.isAccessible(element, {
|
|
679
|
-
ignoredRules: [
|
|
680
|
-
'color-contrast',
|
|
681
|
-
// TODO: To be redesigned
|
|
682
|
-
'aria-required-children',
|
|
683
|
-
],
|
|
684
|
-
})
|
|
685
|
-
})
|
|
686
|
-
})
|
|
687
|
-
})
|