@api-client/ui 0.5.38 → 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/src/md/list/internals/ListItem.d.ts +24 -15
- package/build/src/md/list/internals/ListItem.d.ts.map +1 -1
- package/build/src/md/list/internals/ListItem.js +85 -59
- package/build/src/md/list/internals/ListItem.js.map +1 -1
- package/build/src/md/list/internals/ListItem.styles.js +11 -11
- package/build/src/md/list/internals/ListItem.styles.js.map +1 -1
- package/build/src/md/select/internals/Option.d.ts +4 -14
- package/build/src/md/select/internals/Option.d.ts.map +1 -1
- package/build/src/md/select/internals/Option.js +13 -28
- package/build/src/md/select/internals/Option.js.map +1 -1
- package/build/src/md/select/internals/Select.d.ts +1 -1
- package/build/src/md/select/internals/Select.d.ts.map +1 -1
- package/build/src/md/select/internals/Select.js +15 -5
- package/build/src/md/select/internals/Select.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -0
- package/package.json +1 -1
- package/src/md/list/internals/ListItem.styles.ts +11 -11
- package/src/md/list/internals/ListItem.ts +68 -43
- package/src/md/select/internals/Option.ts +14 -26
- package/src/md/select/internals/Select.ts +15 -5
- 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 -207
- 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,348 +0,0 @@
|
|
|
1
|
-
import { fixture, assert, nextFrame, html } from '@open-wc/testing'
|
|
2
|
-
import sinon from 'sinon'
|
|
3
|
-
|
|
4
|
-
import DateTime from '../../../src/md/date/internals/DateTime.js'
|
|
5
|
-
import '../../../src/md/date/ui-date-time.js'
|
|
6
|
-
|
|
7
|
-
describe('<ui-date-time>', () => {
|
|
8
|
-
async function basicFixture(): Promise<DateTime> {
|
|
9
|
-
return fixture(html` <ui-date-time locales="en-US" time-zone="UTC" date="2010-12-10T11:05:45.000Z"></ui-date-time>`)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function longWeekdayFixture(): Promise<DateTime> {
|
|
13
|
-
return fixture(
|
|
14
|
-
html` <ui-date-time
|
|
15
|
-
locales="en-US"
|
|
16
|
-
time-zone="UTC"
|
|
17
|
-
date="2010-12-10T11:05:45.000Z"
|
|
18
|
-
weekday="long"
|
|
19
|
-
></ui-date-time>`
|
|
20
|
-
)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function longMonthFixture(): Promise<DateTime> {
|
|
24
|
-
return fixture(
|
|
25
|
-
html` <ui-date-time locales="en-US" time-zone="UTC" date="2010-12-10T11:05:45.000Z" month="long"></ui-date-time>`
|
|
26
|
-
)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
async function numericYearFixture(): Promise<DateTime> {
|
|
30
|
-
return fixture(
|
|
31
|
-
html` <ui-date-time
|
|
32
|
-
locales="en-US"
|
|
33
|
-
time-zone="UTC"
|
|
34
|
-
date="2010-12-10T11:05:45.000Z"
|
|
35
|
-
year="numeric"
|
|
36
|
-
></ui-date-time>`
|
|
37
|
-
)
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function numericDayFixture(): Promise<DateTime> {
|
|
41
|
-
return fixture(
|
|
42
|
-
html` <ui-date-time locales="en-US" time-zone="UTC" date="2010-12-10T11:05:45.000Z" day="numeric"></ui-date-time>`
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
async function numericHourFixture(): Promise<DateTime> {
|
|
47
|
-
return fixture(
|
|
48
|
-
html` <ui-date-time
|
|
49
|
-
locales="en-US"
|
|
50
|
-
time-zone="UTC"
|
|
51
|
-
date="2010-12-10T11:05:45.000Z"
|
|
52
|
-
hour="numeric"
|
|
53
|
-
></ui-date-time>`
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
async function numericMinuteFixture(): Promise<DateTime> {
|
|
58
|
-
return fixture(
|
|
59
|
-
html` <ui-date-time
|
|
60
|
-
locales="en-US"
|
|
61
|
-
time-zone="UTC"
|
|
62
|
-
date="2010-12-10T11:05:45.000Z"
|
|
63
|
-
minute="numeric"
|
|
64
|
-
></ui-date-time>`
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
async function numericSecondFixture(): Promise<DateTime> {
|
|
69
|
-
return fixture(
|
|
70
|
-
html` <ui-date-time
|
|
71
|
-
locales="en-US"
|
|
72
|
-
time-zone="UTC"
|
|
73
|
-
date="2010-12-10T11:05:45.000Z"
|
|
74
|
-
second="numeric"
|
|
75
|
-
></ui-date-time>`
|
|
76
|
-
)
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
async function emptyFixture(): Promise<DateTime> {
|
|
80
|
-
return fixture(html`<ui-date-time></ui-date-time>`)
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
async function deutscheFixture(): Promise<DateTime> {
|
|
84
|
-
return fixture(html` <ui-date-time locales="de-DE" time-zone="UTC" date="2010-12-10T11:05:45.000Z"></ui-date-time>`)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
async function itempropFixture(): Promise<DateTime> {
|
|
88
|
-
return fixture(html` <ui-date-time itemprop="title" date="2010-12-10T11:05:45.000Z"></ui-date-time>`)
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const EDGE_IS_STILL_SO_BAD = /\u200E/g
|
|
92
|
-
function normalizeString(str: string): string {
|
|
93
|
-
return str.replace(EDGE_IS_STILL_SO_BAD, '')
|
|
94
|
-
}
|
|
95
|
-
const hasSupport = typeof Intl !== 'undefined'
|
|
96
|
-
describe('Basics', () => {
|
|
97
|
-
it('Renders date string value', async () => {
|
|
98
|
-
// Can't check date format at this point since it may vary depending
|
|
99
|
-
// on the locale settings.
|
|
100
|
-
const element = await basicFixture()
|
|
101
|
-
await nextFrame()
|
|
102
|
-
const txt = element._getTimeNode().innerHTML
|
|
103
|
-
assert.typeOf(txt, 'string')
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
it('Should compute ISO time', async () => {
|
|
107
|
-
const element = await basicFixture()
|
|
108
|
-
await nextFrame()
|
|
109
|
-
assert.equal(element._getTimeNode().getAttribute('datetime'), '2010-12-10T11:05:45.000Z')
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
it('Should set weekday', async () => {
|
|
113
|
-
if (hasSupport) {
|
|
114
|
-
const element = await longWeekdayFixture()
|
|
115
|
-
await nextFrame()
|
|
116
|
-
const txt = element._getTimeNode().innerHTML
|
|
117
|
-
assert.equal(normalizeString(txt), 'Friday')
|
|
118
|
-
}
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it('Sets year', async () => {
|
|
122
|
-
if (hasSupport) {
|
|
123
|
-
const element = await numericYearFixture()
|
|
124
|
-
const txt = element._getTimeNode().innerHTML
|
|
125
|
-
assert.equal(normalizeString(txt), '2010')
|
|
126
|
-
}
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
it('Should set month', async () => {
|
|
130
|
-
if (hasSupport) {
|
|
131
|
-
const element = await longMonthFixture()
|
|
132
|
-
const txt = element._getTimeNode().innerHTML
|
|
133
|
-
assert.equal(normalizeString(txt), 'December')
|
|
134
|
-
}
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
it('Should set day', async () => {
|
|
138
|
-
if (hasSupport) {
|
|
139
|
-
const element = await numericDayFixture()
|
|
140
|
-
const txt = element._getTimeNode().innerHTML
|
|
141
|
-
assert.equal(normalizeString(txt), '10')
|
|
142
|
-
}
|
|
143
|
-
})
|
|
144
|
-
|
|
145
|
-
it('Should set hour', async () => {
|
|
146
|
-
if (hasSupport) {
|
|
147
|
-
const element = await numericHourFixture()
|
|
148
|
-
const txt = element._getTimeNode().innerHTML
|
|
149
|
-
assert.include(normalizeString(txt), '11')
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
|
|
153
|
-
it('Sets minute', async () => {
|
|
154
|
-
if (hasSupport) {
|
|
155
|
-
const element = await numericMinuteFixture()
|
|
156
|
-
const txt = element._getTimeNode().innerHTML
|
|
157
|
-
assert.equal(normalizeString(txt), '5')
|
|
158
|
-
}
|
|
159
|
-
})
|
|
160
|
-
|
|
161
|
-
it('Sets minute', async () => {
|
|
162
|
-
if (hasSupport) {
|
|
163
|
-
const element = await numericSecondFixture()
|
|
164
|
-
const txt = element._getTimeNode().innerHTML
|
|
165
|
-
assert.equal(normalizeString(txt), '45')
|
|
166
|
-
}
|
|
167
|
-
})
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
describe('Attributes settings', () => {
|
|
171
|
-
let element: DateTime
|
|
172
|
-
beforeEach(async () => {
|
|
173
|
-
element = await emptyFixture()
|
|
174
|
-
})
|
|
175
|
-
;[
|
|
176
|
-
['locales'],
|
|
177
|
-
['date'],
|
|
178
|
-
['year'],
|
|
179
|
-
['month'],
|
|
180
|
-
['day'],
|
|
181
|
-
['hour'],
|
|
182
|
-
['minute'],
|
|
183
|
-
['second'],
|
|
184
|
-
['weekday', undefined, 'short'],
|
|
185
|
-
['time-zone-name', 'timeZoneName', 'short'],
|
|
186
|
-
['era', undefined, 'narrow'],
|
|
187
|
-
['time-zone', 'timeZone', 'UTC'],
|
|
188
|
-
['hour12', undefined, true],
|
|
189
|
-
].forEach((item) => {
|
|
190
|
-
it(`Calls _updateLabel() when "${item[0]}" attribute changes`, () => {
|
|
191
|
-
const value = item[2] || 'numeric'
|
|
192
|
-
const spy = sinon.spy(element, '_updateLabel')
|
|
193
|
-
// @ts-expect-error for testing
|
|
194
|
-
element.setAttribute(item[0], value)
|
|
195
|
-
assert.isTrue(spy.called)
|
|
196
|
-
})
|
|
197
|
-
|
|
198
|
-
it(`Updates propety value when "${item[0]}" attribute changes`, () => {
|
|
199
|
-
const prop = item[1] || item[0]
|
|
200
|
-
const value = item[2] || 'numeric'
|
|
201
|
-
// @ts-expect-error for testing
|
|
202
|
-
element.setAttribute(item[0], value)
|
|
203
|
-
if (prop === 'hour12') {
|
|
204
|
-
assert.isTrue(element[prop])
|
|
205
|
-
} else {
|
|
206
|
-
// @ts-expect-error for testing
|
|
207
|
-
assert.equal(element[prop], value)
|
|
208
|
-
}
|
|
209
|
-
})
|
|
210
|
-
})
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
describe('Properties changed', () => {
|
|
214
|
-
let element: DateTime
|
|
215
|
-
beforeEach(async () => {
|
|
216
|
-
element = await emptyFixture()
|
|
217
|
-
})
|
|
218
|
-
;[
|
|
219
|
-
['locales'],
|
|
220
|
-
['date'],
|
|
221
|
-
['year'],
|
|
222
|
-
['month'],
|
|
223
|
-
['day'],
|
|
224
|
-
['hour'],
|
|
225
|
-
['minute'],
|
|
226
|
-
['second'],
|
|
227
|
-
['weekday', undefined, 'short'],
|
|
228
|
-
['time-zone-name', 'timeZoneName', 'short'],
|
|
229
|
-
['era', undefined, 'narrow'],
|
|
230
|
-
['time-zone', 'timeZone', 'UTC'],
|
|
231
|
-
['hour12', undefined, true],
|
|
232
|
-
].forEach((item) => {
|
|
233
|
-
it(`Calls _updateLabel() when "${item[0]}" property change`, () => {
|
|
234
|
-
const value = item[2] || 'numeric'
|
|
235
|
-
const prop = item[1] || item[0]
|
|
236
|
-
const spy = sinon.spy(element, '_updateLabel')
|
|
237
|
-
// @ts-expect-error for testing
|
|
238
|
-
element[prop] = value
|
|
239
|
-
assert.isTrue(spy.called)
|
|
240
|
-
})
|
|
241
|
-
|
|
242
|
-
it(`Updates attribute value when "${item[0]}" property changes`, () => {
|
|
243
|
-
const attr = item[0]
|
|
244
|
-
const prop = item[1] || attr
|
|
245
|
-
const value = item[2] || 'numeric'
|
|
246
|
-
// @ts-expect-error for testing
|
|
247
|
-
element[prop] = value
|
|
248
|
-
// @ts-expect-error for testing
|
|
249
|
-
assert.isTrue(element.hasAttribute(attr), 'Has corresponding attribute')
|
|
250
|
-
if (prop !== 'hour12') {
|
|
251
|
-
// @ts-expect-error for testing
|
|
252
|
-
assert.equal(element.getAttribute(attr), value)
|
|
253
|
-
}
|
|
254
|
-
})
|
|
255
|
-
})
|
|
256
|
-
})
|
|
257
|
-
|
|
258
|
-
describe('_getIntlOptions()', () => {
|
|
259
|
-
let element: DateTime
|
|
260
|
-
beforeEach(async () => {
|
|
261
|
-
element = await emptyFixture()
|
|
262
|
-
})
|
|
263
|
-
;[
|
|
264
|
-
['year'],
|
|
265
|
-
['month'],
|
|
266
|
-
['day'],
|
|
267
|
-
['hour'],
|
|
268
|
-
['minute'],
|
|
269
|
-
['second'],
|
|
270
|
-
['weekday', undefined, 'short'],
|
|
271
|
-
['time-zone-name', 'timeZoneName', 'short'],
|
|
272
|
-
['era', undefined, 'narrow'],
|
|
273
|
-
['time-zone', 'timeZone', 'UTC'],
|
|
274
|
-
['hour12', undefined, true],
|
|
275
|
-
].forEach((item) => {
|
|
276
|
-
it(`Adds "${item[0]}" property`, () => {
|
|
277
|
-
const attr = item[0]
|
|
278
|
-
const prop = item[1] || attr
|
|
279
|
-
const value = item[2] || 'numeric'
|
|
280
|
-
// @ts-expect-error for testing
|
|
281
|
-
element[prop] = value
|
|
282
|
-
const result = element._getIntlOptions()
|
|
283
|
-
if (prop === 'hour12') {
|
|
284
|
-
assert.isTrue(result[prop])
|
|
285
|
-
} else {
|
|
286
|
-
// @ts-expect-error for testing
|
|
287
|
-
assert.equal(result[prop], value)
|
|
288
|
-
}
|
|
289
|
-
})
|
|
290
|
-
})
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
describe('_updateLabel()', () => {
|
|
294
|
-
let element: DateTime
|
|
295
|
-
|
|
296
|
-
it('Does nothing when not in the DOM', async () => {
|
|
297
|
-
element = await basicFixture()
|
|
298
|
-
const parent = element.parentElement!
|
|
299
|
-
parent.removeChild(element)
|
|
300
|
-
const time = element._getTimeNode()
|
|
301
|
-
element.shadowRoot!.removeChild(time)
|
|
302
|
-
element.day = 'numeric'
|
|
303
|
-
const node = element.shadowRoot!.querySelector('time')
|
|
304
|
-
assert.notOk(node)
|
|
305
|
-
})
|
|
306
|
-
|
|
307
|
-
it('Sets "datetime" attribiute on <time>', async () => {
|
|
308
|
-
element = await basicFixture()
|
|
309
|
-
const time = element._getTimeNode()
|
|
310
|
-
assert.equal(time.getAttribute('datetime'), '2010-12-10T11:05:45.000Z')
|
|
311
|
-
})
|
|
312
|
-
|
|
313
|
-
it('Sets text content on <time>', async () => {
|
|
314
|
-
element = await basicFixture()
|
|
315
|
-
const time = element._getTimeNode()
|
|
316
|
-
assert.equal(time.innerText.trim().toLowerCase(), '12/10/2010')
|
|
317
|
-
})
|
|
318
|
-
|
|
319
|
-
it('Uses different locale', async () => {
|
|
320
|
-
element = await deutscheFixture()
|
|
321
|
-
const time = element._getTimeNode()
|
|
322
|
-
assert.equal(time.innerText.trim().toLowerCase(), '10.12.2010')
|
|
323
|
-
})
|
|
324
|
-
})
|
|
325
|
-
|
|
326
|
-
describe('itemprop attribute', () => {
|
|
327
|
-
let element: DateTime
|
|
328
|
-
|
|
329
|
-
it('Copies itemprop attribute to <time> element', async () => {
|
|
330
|
-
element = await itempropFixture()
|
|
331
|
-
assert.equal(element._getTimeNode().getAttribute('itemprop'), 'title')
|
|
332
|
-
})
|
|
333
|
-
|
|
334
|
-
it('Removes itemprop attribute from this element', async () => {
|
|
335
|
-
element = await itempropFixture()
|
|
336
|
-
assert.equal(element.getAttribute('itemprop'), null)
|
|
337
|
-
})
|
|
338
|
-
|
|
339
|
-
it('Ignores the change when attribute is already set', async () => {
|
|
340
|
-
element = await itempropFixture()
|
|
341
|
-
const spy = sinon.spy(element, '_getTimeNode')
|
|
342
|
-
element.itemprop = 'title'
|
|
343
|
-
// Getter uses `_getTimeNode` to read attribute.
|
|
344
|
-
// This should happen only once in this case.
|
|
345
|
-
assert.isTrue(spy.calledOnce)
|
|
346
|
-
})
|
|
347
|
-
})
|
|
348
|
-
})
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { fixture, html, assert } from '@open-wc/testing'
|
|
2
|
-
import '../../../src/md/dialog/ui-confirm-dialog.js'
|
|
3
|
-
import type UiConfirmDialog from '../../../src/md/dialog/internals/ConfirmDialog.js'
|
|
4
|
-
|
|
5
|
-
describe('UiConfirmDialog', () => {
|
|
6
|
-
async function basicFixture(): Promise<UiConfirmDialog> {
|
|
7
|
-
return fixture(html`<ui-confirm-dialog></ui-confirm-dialog>`)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
async function customLabelsFixture(): Promise<UiConfirmDialog> {
|
|
11
|
-
return fixture(html`<ui-confirm-dialog confirmLabel="Delete" dismissLabel="Keep"></ui-confirm-dialog>`)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
async function withContentFixture(): Promise<UiConfirmDialog> {
|
|
15
|
-
return fixture(html`
|
|
16
|
-
<ui-confirm-dialog>
|
|
17
|
-
<span slot="title">Confirm Action</span>
|
|
18
|
-
<p>Are you sure you want to proceed?</p>
|
|
19
|
-
</ui-confirm-dialog>
|
|
20
|
-
`)
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async function destructiveFixture(): Promise<UiConfirmDialog> {
|
|
24
|
-
return fixture(html`<ui-confirm-dialog destructive></ui-confirm-dialog>`)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
it('renders with default labels', async () => {
|
|
28
|
-
const element = await basicFixture()
|
|
29
|
-
assert.equal(element.confirmLabel, 'Confirm')
|
|
30
|
-
assert.equal(element.dismissLabel, 'Cancel')
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
it('renders with custom labels', async () => {
|
|
34
|
-
const element = await customLabelsFixture()
|
|
35
|
-
assert.equal(element.confirmLabel, 'Delete')
|
|
36
|
-
assert.equal(element.dismissLabel, 'Keep')
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
it('is modal by default', async () => {
|
|
40
|
-
const element = await basicFixture()
|
|
41
|
-
assert.isTrue(element.modal)
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
it('renders buttons with correct values', async () => {
|
|
45
|
-
const element = await basicFixture()
|
|
46
|
-
await element.updateComplete
|
|
47
|
-
|
|
48
|
-
const dismissButton = element.shadowRoot!.querySelector('ui-button[value="dismiss"]')
|
|
49
|
-
const confirmButton = element.shadowRoot!.querySelector('ui-button[value="confirm"]')
|
|
50
|
-
|
|
51
|
-
assert.ok(dismissButton, 'has dismiss button')
|
|
52
|
-
assert.ok(confirmButton, 'has confirm button')
|
|
53
|
-
assert.equal(dismissButton!.textContent!.trim(), 'Cancel')
|
|
54
|
-
assert.equal(confirmButton!.textContent!.trim(), 'Confirm')
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
it('renders title slot', async () => {
|
|
58
|
-
const element = await withContentFixture()
|
|
59
|
-
await element.updateComplete
|
|
60
|
-
|
|
61
|
-
const titleSlot = element.shadowRoot!.querySelector('slot[name="title"]')
|
|
62
|
-
assert.ok(titleSlot, 'has title slot')
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
it('renders body slot', async () => {
|
|
66
|
-
const element = await withContentFixture()
|
|
67
|
-
await element.updateComplete
|
|
68
|
-
|
|
69
|
-
const bodySlot = element.shadowRoot!.querySelector('slot:not([name])')
|
|
70
|
-
assert.ok(bodySlot, 'has body slot')
|
|
71
|
-
})
|
|
72
|
-
|
|
73
|
-
it('uses filled button for confirm action', async () => {
|
|
74
|
-
const element = await basicFixture()
|
|
75
|
-
await element.updateComplete
|
|
76
|
-
|
|
77
|
-
const confirmButton = element.shadowRoot!.querySelector('ui-button[value="confirm"]')
|
|
78
|
-
assert.equal(confirmButton!.getAttribute('color'), 'filled')
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
it('uses text button for dismiss action', async () => {
|
|
82
|
-
const element = await basicFixture()
|
|
83
|
-
await element.updateComplete
|
|
84
|
-
|
|
85
|
-
const dismissButton = element.shadowRoot!.querySelector('ui-button[value="dismiss"]')
|
|
86
|
-
assert.equal(dismissButton!.getAttribute('color'), 'text')
|
|
87
|
-
})
|
|
88
|
-
|
|
89
|
-
it('renders as destructive dialog', async () => {
|
|
90
|
-
const element = await destructiveFixture()
|
|
91
|
-
await element.updateComplete
|
|
92
|
-
|
|
93
|
-
const confirmButton = element.shadowRoot!.querySelector('ui-button[value="confirm"]')
|
|
94
|
-
assert.ok(confirmButton?.classList.contains('destructive'), 'confirm button has destructive class')
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
it('renders confirm button with destructive styling', async () => {
|
|
98
|
-
const element = await destructiveFixture()
|
|
99
|
-
await element.updateComplete
|
|
100
|
-
|
|
101
|
-
const confirmButton = element.shadowRoot!.querySelector('ui-button[value="confirm"]')
|
|
102
|
-
assert.equal(confirmButton!.getAttribute('color'), 'filled')
|
|
103
|
-
assert.ok(confirmButton!.classList.contains('destructive'), 'has destructive class for styling')
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
it('is not destructive by default', async () => {
|
|
107
|
-
const element = await basicFixture()
|
|
108
|
-
assert.isFalse(element.destructive)
|
|
109
|
-
})
|
|
110
|
-
|
|
111
|
-
it('can be set to destructive', async () => {
|
|
112
|
-
const element = await destructiveFixture()
|
|
113
|
-
assert.isTrue(element.destructive)
|
|
114
|
-
})
|
|
115
|
-
|
|
116
|
-
it('applies destructive class to confirm button when destructive is true', async () => {
|
|
117
|
-
const element = await destructiveFixture()
|
|
118
|
-
await element.updateComplete
|
|
119
|
-
|
|
120
|
-
const confirmButton = element.shadowRoot!.querySelector('ui-button[value="confirm"]')
|
|
121
|
-
assert.isTrue(confirmButton!.classList.contains('destructive'))
|
|
122
|
-
})
|
|
123
|
-
|
|
124
|
-
it('does not apply destructive class when destructive is false', async () => {
|
|
125
|
-
const element = await basicFixture()
|
|
126
|
-
await element.updateComplete
|
|
127
|
-
|
|
128
|
-
const confirmButton = element.shadowRoot!.querySelector('ui-button[value="confirm"]')
|
|
129
|
-
assert.isFalse(confirmButton!.classList.contains('destructive'))
|
|
130
|
-
})
|
|
131
|
-
})
|