@api-client/ui 0.5.39 → 0.5.41

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.
Files changed (292) hide show
  1. package/build/src/elements/contextual-menu/{internals/ContextualMenu.d.ts → ContextualMenu.d.ts} +11 -6
  2. package/build/src/elements/contextual-menu/ContextualMenu.d.ts.map +1 -0
  3. package/build/src/elements/contextual-menu/{internals/ContextualMenu.js → ContextualMenu.js} +25 -3
  4. package/build/src/elements/contextual-menu/ContextualMenu.js.map +1 -0
  5. package/build/src/elements/contextual-menu/internals/types.d.ts +16 -7
  6. package/build/src/elements/contextual-menu/internals/types.d.ts.map +1 -1
  7. package/build/src/elements/contextual-menu/internals/types.js.map +1 -1
  8. package/build/tsconfig.tsbuildinfo +1 -0
  9. package/package.json +1 -1
  10. package/src/elements/contextual-menu/{internals/ContextualMenu.ts → ContextualMenu.ts} +31 -7
  11. package/src/elements/contextual-menu/internals/types.ts +17 -7
  12. package/.aiexclude +0 -3
  13. package/.cursor/rules/html-and-css-best-practices.mdc +0 -63
  14. package/.cursor/rules/lit-best-practices.mdc +0 -89
  15. package/.editorconfig +0 -29
  16. package/.github/CONTRIBUTING.md +0 -24
  17. package/.github/instructions/html-and-css-best-practices.instructions.md +0 -70
  18. package/.github/instructions/lit-best-practices.instructions.md +0 -90
  19. package/.github/release.yml +0 -14
  20. package/.github/stale.yml +0 -23
  21. package/.github/workflows/auto-release.yml +0 -182
  22. package/.github/workflows/release.yml +0 -82
  23. package/.prettierrc.js +0 -14
  24. package/.vscode/settings.json +0 -18
  25. package/RELEASE.md +0 -163
  26. package/RELEASE_SETUP.md +0 -235
  27. package/build/src/demo/DemoPage.d.ts +0 -81
  28. package/build/src/demo/DemoPage.d.ts.map +0 -1
  29. package/build/src/demo/DemoPage.js +0 -175
  30. package/build/src/demo/DemoPage.js.map +0 -1
  31. package/build/src/demo/DemoStyles.d.ts +0 -3
  32. package/build/src/demo/DemoStyles.d.ts.map +0 -1
  33. package/build/src/demo/DemoStyles.js +0 -60
  34. package/build/src/demo/DemoStyles.js.map +0 -1
  35. package/build/src/elements/contextual-menu/internals/ContextualMenu.d.ts.map +0 -1
  36. package/build/src/elements/contextual-menu/internals/ContextualMenu.js.map +0 -1
  37. package/build/test/elements/navigation/Navigation.test.d.ts +0 -3
  38. package/build/test/elements/navigation/Navigation.test.d.ts.map +0 -1
  39. package/build/test/elements/navigation/Navigation.test.js +0 -113
  40. package/build/test/elements/navigation/Navigation.test.js.map +0 -1
  41. package/commitlint.config.cjs +0 -2
  42. package/demo/elements/authorization/AuthPlugin.js +0 -57
  43. package/demo/elements/authorization/AuthProxy.js +0 -215
  44. package/demo/elements/authorization/api-key.html +0 -27
  45. package/demo/elements/authorization/api-key.ts +0 -44
  46. package/demo/elements/authorization/basic.html +0 -27
  47. package/demo/elements/authorization/basic.ts +0 -43
  48. package/demo/elements/authorization/bearer.html +0 -27
  49. package/demo/elements/authorization/bearer.ts +0 -43
  50. package/demo/elements/authorization/env.js +0 -8
  51. package/demo/elements/authorization/index.html +0 -44
  52. package/demo/elements/authorization/ntlm.html +0 -27
  53. package/demo/elements/authorization/ntlm.ts +0 -43
  54. package/demo/elements/authorization/oauth-authorize.html +0 -75
  55. package/demo/elements/authorization/oauth-authorize.ts +0 -40
  56. package/demo/elements/authorization/oauth-error.html +0 -18
  57. package/demo/elements/authorization/oauth-error.ts +0 -10
  58. package/demo/elements/authorization/oauth-popup.html +0 -36
  59. package/demo/elements/authorization/oauth2.html +0 -27
  60. package/demo/elements/authorization/oauth2.ts +0 -100
  61. package/demo/elements/authorization/oidc.html +0 -27
  62. package/demo/elements/authorization/oidc.ts +0 -139
  63. package/demo/elements/authorization/private.crt +0 -31
  64. package/demo/elements/authorization/private.csr +0 -28
  65. package/demo/elements/authorization/private.key +0 -51
  66. package/demo/elements/authorization/private.pem +0 -31
  67. package/demo/elements/authorization/redirect.html +0 -20
  68. package/demo/elements/authorization/ssl-commands.sh +0 -30
  69. package/demo/elements/authorization/ssl.conf +0 -24
  70. package/demo/elements/autocomplete/index.html +0 -64
  71. package/demo/elements/autocomplete/index.ts +0 -171
  72. package/demo/elements/code-editor/CodeEditorDemo.ts +0 -173
  73. package/demo/elements/code-editor/index.html +0 -19
  74. package/demo/elements/context-menu/DemoIcons.ts +0 -21
  75. package/demo/elements/context-menu/basic.html +0 -25
  76. package/demo/elements/context-menu/basic.ts +0 -119
  77. package/demo/elements/context-menu/custom-data.html +0 -25
  78. package/demo/elements/context-menu/custom-data.ts +0 -62
  79. package/demo/elements/context-menu/demo.css +0 -28
  80. package/demo/elements/context-menu/enabled-state.html +0 -25
  81. package/demo/elements/context-menu/enabled-state.ts +0 -73
  82. package/demo/elements/context-menu/icons.html +0 -25
  83. package/demo/elements/context-menu/icons.ts +0 -64
  84. package/demo/elements/context-menu/index.html +0 -43
  85. package/demo/elements/context-menu/nested.html +0 -25
  86. package/demo/elements/context-menu/nestedt.ts +0 -152
  87. package/demo/elements/context-menu/no-execute.html +0 -25
  88. package/demo/elements/context-menu/no-execute.ts +0 -134
  89. package/demo/elements/context-menu/radio-menu.html +0 -25
  90. package/demo/elements/context-menu/radio-menu.ts +0 -83
  91. package/demo/elements/context-menu/separators.html +0 -25
  92. package/demo/elements/context-menu/separators.ts +0 -172
  93. package/demo/elements/currency/index.html +0 -91
  94. package/demo/elements/currency/index.ts +0 -352
  95. package/demo/elements/environment/environment-editor.html +0 -20
  96. package/demo/elements/environment/environment-editor.ts +0 -49
  97. package/demo/elements/environment/index.html +0 -33
  98. package/demo/elements/environment/server-editor.html +0 -20
  99. package/demo/elements/environment/server-editor.ts +0 -67
  100. package/demo/elements/environment/variables-editor.html +0 -20
  101. package/demo/elements/environment/variables-editor.ts +0 -94
  102. package/demo/elements/har/har-viewer.html +0 -20
  103. package/demo/elements/har/har-viewer.ts +0 -76
  104. package/demo/elements/har/har1.har +0 -3044
  105. package/demo/elements/har/har2.json +0 -439
  106. package/demo/elements/har/index.html +0 -26
  107. package/demo/elements/highlight/example.md +0 -27
  108. package/demo/elements/highlight/index.html +0 -31
  109. package/demo/elements/highlight/marked-highlight.html +0 -132
  110. package/demo/elements/highlight/marked-highlight.ts +0 -22
  111. package/demo/elements/highlight/prism-highlight.html +0 -62
  112. package/demo/elements/highlight/prism-highlight.ts +0 -17
  113. package/demo/elements/http/body-editor.html +0 -17
  114. package/demo/elements/http/body-editor.ts +0 -115
  115. package/demo/elements/http/headers.html +0 -17
  116. package/demo/elements/http/headers.ts +0 -59
  117. package/demo/elements/http/http-assertions.html +0 -20
  118. package/demo/elements/http/http-assertions.ts +0 -89
  119. package/demo/elements/http/http-flows.html +0 -23
  120. package/demo/elements/http/http-flows.ts +0 -89
  121. package/demo/elements/http/index.html +0 -45
  122. package/demo/elements/http/request-editor.html +0 -26
  123. package/demo/elements/http/request-editor.ts +0 -197
  124. package/demo/elements/http/request-log.html +0 -16
  125. package/demo/elements/http/request-log.ts +0 -136
  126. package/demo/elements/http/url-editing.html +0 -17
  127. package/demo/elements/http/url-editing.ts +0 -112
  128. package/demo/elements/icons/index.html +0 -81
  129. package/demo/elements/icons/index.ts +0 -52
  130. package/demo/elements/index.html +0 -72
  131. package/demo/elements/mention-textarea/index.html +0 -19
  132. package/demo/elements/mention-textarea/index.ts +0 -205
  133. package/demo/elements/navigation/navigation-item.html +0 -49
  134. package/demo/elements/navigation/navigation-item.ts +0 -131
  135. package/demo/elements/navigation/navigation.html +0 -20
  136. package/demo/elements/navigation/navigation.ts +0 -45
  137. package/demo/elements/project/index.html +0 -29
  138. package/demo/elements/project/project-run-report.html +0 -20
  139. package/demo/elements/project/project-run-report.ts +0 -132
  140. package/demo/elements/project/request-editor.html +0 -23
  141. package/demo/elements/project/request-editor.ts +0 -232
  142. package/demo/elements/user/user-avatar.html +0 -17
  143. package/demo/elements/user/user-avatar.ts +0 -60
  144. package/demo/env.js +0 -4
  145. package/demo/index.html +0 -34
  146. package/demo/layout/index.html +0 -94
  147. package/demo/layout/index.ts +0 -190
  148. package/demo/md/DemoStyles.ts +0 -61
  149. package/demo/md/UiDemoPage.ts +0 -6
  150. package/demo/md/buttons/button.html +0 -121
  151. package/demo/md/buttons/button.ts +0 -246
  152. package/demo/md/buttons/group.html +0 -36
  153. package/demo/md/buttons/group.ts +0 -171
  154. package/demo/md/checkbox/index.html +0 -39
  155. package/demo/md/checkbox/index.ts +0 -220
  156. package/demo/md/chip/chip.html +0 -70
  157. package/demo/md/chip/chip.ts +0 -219
  158. package/demo/md/chip/pawel6c9a.jpg +0 -0
  159. package/demo/md/collapse/CustomDetail.ts +0 -89
  160. package/demo/md/collapse/collapse.html +0 -21
  161. package/demo/md/collapse/collapse.ts +0 -78
  162. package/demo/md/date-picker/date-picker.ts +0 -336
  163. package/demo/md/date-picker/index.html +0 -171
  164. package/demo/md/dialog/confirm-dialog.html +0 -49
  165. package/demo/md/dialog/confirm-dialog.ts +0 -121
  166. package/demo/md/dialog/dialog.html +0 -25
  167. package/demo/md/dialog/dialog.ts +0 -468
  168. package/demo/md/dropdown-list/index.html +0 -31
  169. package/demo/md/dropdown-list/index.ts +0 -158
  170. package/demo/md/icon-button/index.html +0 -122
  171. package/demo/md/icon-button/index.ts +0 -132
  172. package/demo/md/index.html +0 -73
  173. package/demo/md/inputs/input.html +0 -73
  174. package/demo/md/inputs/input.ts +0 -278
  175. package/demo/md/inputs/radio.html +0 -39
  176. package/demo/md/inputs/radio.ts +0 -156
  177. package/demo/md/inputs/switch.html +0 -45
  178. package/demo/md/inputs/switch.ts +0 -144
  179. package/demo/md/list/list.html +0 -65
  180. package/demo/md/list/list.ts +0 -204
  181. package/demo/md/listbox/listbox.html +0 -31
  182. package/demo/md/listbox/listbox.ts +0 -27
  183. package/demo/md/menu/index.html +0 -19
  184. package/demo/md/menu/index.ts +0 -514
  185. package/demo/md/notification/snack.html +0 -21
  186. package/demo/md/notification/snack.ts +0 -70
  187. package/demo/md/progress/progress.html +0 -46
  188. package/demo/md/progress/progress.ts +0 -161
  189. package/demo/md/segmented-button/index.html +0 -21
  190. package/demo/md/segmented-button/index.ts +0 -55
  191. package/demo/md/select/index.html +0 -16
  192. package/demo/md/select/index.ts +0 -217
  193. package/demo/md/tabs/tabs.html +0 -40
  194. package/demo/md/tabs/tabs.ts +0 -214
  195. package/demo/oauth-popup.html +0 -36
  196. package/demo/page.css +0 -8
  197. package/demo/resources/calendar-month.png +0 -0
  198. package/demo/resources/favorite.png +0 -0
  199. package/demo/resources/fingerprint.png +0 -0
  200. package/demo/resources/home-work.png +0 -0
  201. package/demo/resources/mood.png +0 -0
  202. package/demo/resources/print.png +0 -0
  203. package/demo/resources/stars.png +0 -0
  204. package/demo/resources/theaters.png +0 -0
  205. package/demo/tsconfig.json +0 -4
  206. package/eslint.config.js +0 -97
  207. package/scripts/copy-assets.js +0 -21
  208. package/scripts/release.js +0 -66
  209. package/src/demo/DemoPage.ts +0 -169
  210. package/src/demo/DemoStyles.ts +0 -60
  211. package/test/README.md +0 -375
  212. package/test/contextual-menu/ContextMenu.test.ts +0 -760
  213. package/test/contextual-menu/ContextMenuElement.test.ts +0 -569
  214. package/test/core/activity.spec.ts +0 -413
  215. package/test/core/activity_manager.spec.ts +0 -544
  216. package/test/core/application.spec.ts +0 -218
  217. package/test/core/fragment.spec.ts +0 -565
  218. package/test/core/fragment_manager.spec.ts +0 -404
  219. package/test/core/live_data.spec.ts +0 -558
  220. package/test/core/renderer.spec.ts +0 -113
  221. package/test/dom-assertions.test.ts +0 -182
  222. package/test/elements/MonacoSetup.ts +0 -65
  223. package/test/elements/authorization/basic-method.test.ts +0 -177
  224. package/test/elements/authorization/bearer-method.test.ts +0 -143
  225. package/test/elements/authorization/ntlm-method.test.ts +0 -219
  226. package/test/elements/authorization/oauth2-client-credentials-method.test.ts +0 -334
  227. package/test/elements/authorization/oauth2-code-method.test.ts +0 -320
  228. package/test/elements/authorization/oauth2-custom-grant-method.test.ts +0 -255
  229. package/test/elements/authorization/oauth2-device-code-method.test.ts +0 -371
  230. package/test/elements/authorization/oauth2-implicit-method.test.ts +0 -407
  231. package/test/elements/authorization/oauth2-jwt-method.test.ts +0 -217
  232. package/test/elements/authorization/oauth2-password-method.test.ts +0 -275
  233. package/test/elements/authorization/openid-method.test.ts +0 -591
  234. package/test/elements/autocomplete/autocomplete-input.spec.ts +0 -646
  235. package/test/elements/code-editor/code-editor.accessibility.test.ts +0 -298
  236. package/test/elements/code-editor/code-editor.test.ts +0 -574
  237. package/test/elements/currency/CurrencyPicker.accessibility.test.ts +0 -328
  238. package/test/elements/currency/CurrencyPicker.core.test.ts +0 -318
  239. package/test/elements/currency/CurrencyPicker.integration.test.ts +0 -482
  240. package/test/elements/currency/CurrencyPicker.test.ts +0 -486
  241. package/test/elements/data-table/DataTable.browser.test.ts +0 -649
  242. package/test/elements/har/HarUtils.test.ts +0 -45
  243. package/test/elements/har/HarViewerElement.test.ts +0 -687
  244. package/test/elements/har/test-data/har1.har +0 -3044
  245. package/test/elements/highlight/MarkedHighlightElement.test.ts +0 -452
  246. package/test/elements/highlight/PrismHighlightElement.test.ts +0 -79
  247. package/test/elements/highlight/PrismHighlighter.test.ts +0 -94
  248. package/test/elements/highlight/remoteSanitization.md +0 -1
  249. package/test/elements/highlight/test.md +0 -3
  250. package/test/elements/highlight/test1.md +0 -3
  251. package/test/elements/highlight/test2.md +0 -1
  252. package/test/elements/http/BodyFormdataEditorElement.test.ts +0 -482
  253. package/test/elements/http/BodyMultipartEditorElement.test.ts +0 -658
  254. package/test/elements/http/BodyRawEditorElement.test.ts +0 -90
  255. package/test/elements/http/CertificateAdd.test.ts +0 -457
  256. package/test/elements/http/HttpAssertions.test.ts +0 -994
  257. package/test/elements/http/HttpFlows.test.ts +0 -502
  258. package/test/elements/http/UrlEncodeUtils.test.ts +0 -202
  259. package/test/elements/layout/SplitItem.test.ts +0 -440
  260. package/test/elements/layout/SplitLayoutManager.test.ts +0 -1501
  261. package/test/elements/layout/SplitPanel.test.ts +0 -1109
  262. package/test/elements/mention-textarea/MentionTextArea.basic.test.ts +0 -114
  263. package/test/elements/mention-textarea/MentionTextArea.test.ts +0 -613
  264. package/test/elements/navigation/Navigation.test.ts +0 -120
  265. package/test/env.ts +0 -15
  266. package/test/events/EventTypes.test.ts +0 -363
  267. package/test/events/EventsTestHelpers.ts +0 -16
  268. package/test/helpers/TestUtils.ts +0 -243
  269. package/test/helpers/UiMock.ts +0 -185
  270. package/test/lib/Dom.test.ts +0 -231
  271. package/test/md/button/UiButton.test.ts +0 -347
  272. package/test/md/button/UiIconButton.test.ts +0 -155
  273. package/test/md/chip/UiChip.test.ts +0 -219
  274. package/test/md/collapse/UiCollapse.test.ts +0 -250
  275. package/test/md/collapse/flex-layout.test.ts +0 -105
  276. package/test/md/date-time/DateTime.test.ts +0 -348
  277. package/test/md/dialog/UiConfirmDialog.test.ts +0 -131
  278. package/test/md/dialog/UiDialog.test.ts +0 -759
  279. package/test/md/menu/Menu.test.ts +0 -855
  280. package/test/md/menu/MenuIntegration.test.ts +0 -426
  281. package/test/md/menu/MenuItem.test.ts +0 -652
  282. package/test/md/menu/SubMenu.test.ts +0 -410
  283. package/test/md/progress/UiCircularProgressElement.test.ts +0 -481
  284. package/test/md/progress/UiProgressElement.test.ts +0 -117
  285. package/test/md/progress/UiRangeElement.test.ts +0 -156
  286. package/test/md/select/Select.test.ts +0 -925
  287. package/test/plugins/takeScreenshotPlugin.js +0 -35
  288. package/test/setup.test.ts +0 -217
  289. package/test/setup.ts +0 -117
  290. package/test/tsconfig.json +0 -7
  291. package/web-dev-server.config.js +0 -21
  292. package/web-test-runner.config.js +0 -90
@@ -1,481 +0,0 @@
1
- import { fixture, assert, html } from '@open-wc/testing'
2
- import CircularProgress from '../../../src/md/progress/internals/CircularProgress.js'
3
- import '../../../src/md/progress/ui-circular-progress.js'
4
-
5
- describe('UiCircularProgress', () => {
6
- async function basicFixture(): Promise<CircularProgress> {
7
- return fixture(html`<ui-circular-progress></ui-circular-progress>`)
8
- }
9
-
10
- async function determinateFixture(): Promise<CircularProgress> {
11
- return fixture(html`<ui-circular-progress value="50" max="100"></ui-circular-progress>`)
12
- }
13
-
14
- async function indeterminateFixture(): Promise<CircularProgress> {
15
- return fixture(html`<ui-circular-progress indeterminate></ui-circular-progress>`)
16
- }
17
-
18
- async function fourColorFixture(): Promise<CircularProgress> {
19
- return fixture(html`<ui-circular-progress indeterminate fourcolor></ui-circular-progress>`)
20
- }
21
-
22
- async function disabledFixture(): Promise<CircularProgress> {
23
- return fixture(html`<ui-circular-progress disabled value="30"></ui-circular-progress>`)
24
- }
25
-
26
- async function customRangeFixture(): Promise<CircularProgress> {
27
- return fixture(html`<ui-circular-progress min="10" max="200" value="100"></ui-circular-progress>`)
28
- }
29
-
30
- // Accessibility-compliant fixtures for accessibility testing
31
- async function accessibleBasicFixture(): Promise<CircularProgress> {
32
- return fixture(html`<ui-circular-progress aria-label="Loading progress"></ui-circular-progress>`)
33
- }
34
-
35
- async function accessibleDeterminateFixture(): Promise<CircularProgress> {
36
- return fixture(
37
- html`<ui-circular-progress value="50" max="100" aria-label="Upload progress"></ui-circular-progress>`
38
- )
39
- }
40
-
41
- async function accessibleIndeterminateFixture(): Promise<CircularProgress> {
42
- return fixture(html`<ui-circular-progress indeterminate aria-label="Processing"></ui-circular-progress>`)
43
- }
44
-
45
- async function accessibleFourColorFixture(): Promise<CircularProgress> {
46
- return fixture(
47
- html`<ui-circular-progress indeterminate fourcolor aria-label="Loading with colors"></ui-circular-progress>`
48
- )
49
- }
50
-
51
- async function accessibleDisabledFixture(): Promise<CircularProgress> {
52
- return fixture(html`<ui-circular-progress disabled value="30" aria-label="Completed task"></ui-circular-progress>`)
53
- }
54
-
55
- describe('Basic Properties', () => {
56
- let progress: CircularProgress
57
-
58
- beforeEach(async () => {
59
- progress = await basicFixture()
60
- })
61
-
62
- it('sets default values', () => {
63
- assert.equal(progress.min, 0, 'default min should be 0')
64
- assert.equal(progress.max, 100, 'default max should be 100')
65
- assert.equal(progress.value, 0, 'default value should be 0')
66
- assert.equal(progress.fourColor, false, 'default fourColor should be false')
67
- assert.equal(progress.disabled, false, 'default disabled should be false')
68
- assert.isUndefined(progress.indeterminate, 'default indeterminate should be undefined')
69
- })
70
-
71
- it('sets and gets value property', async () => {
72
- progress.value = 50
73
- await progress.updateComplete
74
- assert.equal(progress.value, 50, 'value should be set to 50')
75
- })
76
-
77
- it('sets and gets max property', async () => {
78
- progress.max = 200
79
- await progress.updateComplete
80
- assert.equal(progress.max, 200, 'max should be set to 200')
81
- })
82
-
83
- it('sets and gets min property', async () => {
84
- progress.min = 10
85
- await progress.updateComplete
86
- assert.equal(progress.min, 10, 'min should be set to 10')
87
- })
88
-
89
- it('sets and gets fourColor property', async () => {
90
- progress.fourColor = true
91
- await progress.updateComplete
92
- assert.equal(progress.fourColor, true, 'fourColor should be set to true')
93
- })
94
-
95
- it('sets and gets disabled property', async () => {
96
- progress.disabled = true
97
- await progress.updateComplete
98
- assert.equal(progress.disabled, true, 'disabled should be set to true')
99
- })
100
-
101
- it('sets and gets indeterminate property', async () => {
102
- progress.indeterminate = true
103
- await progress.updateComplete
104
- assert.equal(progress.indeterminate, true, 'indeterminate should be set to true')
105
- })
106
- })
107
-
108
- describe('Value Validation and Clamping', () => {
109
- let progress: CircularProgress
110
-
111
- beforeEach(async () => {
112
- progress = await customRangeFixture()
113
- })
114
-
115
- it('clamps value to max', async () => {
116
- progress.value = 250
117
- await progress.updateComplete
118
- assert.equal(progress.value, progress.max, 'value should be clamped to max')
119
- })
120
-
121
- it('clamps value to min', async () => {
122
- progress.value = 5
123
- await progress.updateComplete
124
- assert.equal(progress.value, progress.min, 'value should be clamped to min')
125
- })
126
-
127
- it('handles step values correctly', async () => {
128
- progress.step = 10
129
- progress.value = 25
130
- await progress.updateComplete
131
- assert.equal(progress.value, 30, 'value should be stepped to nearest step value')
132
- })
133
-
134
- it('calculates ratio correctly', async () => {
135
- progress.min = 0
136
- progress.max = 100
137
- progress.value = 25
138
- await progress.updateComplete
139
- assert.equal(progress.ratio, 25, 'ratio should be 25% for value 25/100')
140
- })
141
-
142
- it('handles zero denominator in ratio calculation', async () => {
143
- progress.min = 50
144
- progress.max = 50
145
- progress.value = 50
146
- await progress.updateComplete
147
- assert.equal(progress.ratio, 0, 'ratio should be 0 when min equals max')
148
- })
149
- })
150
-
151
- describe('Rendering States', () => {
152
- describe('Determinate State', () => {
153
- let progress: CircularProgress
154
-
155
- beforeEach(async () => {
156
- progress = await determinateFixture()
157
- })
158
-
159
- it('renders SVG container for determinate progress', async () => {
160
- const svg = progress.shadowRoot?.querySelector('svg')
161
- assert.exists(svg, 'should render SVG element')
162
- assert.equal(svg?.getAttribute('viewBox'), '0 0 4800 4800', 'should have correct viewBox')
163
- })
164
-
165
- it('renders track and active track circles', async () => {
166
- const track = progress.shadowRoot?.querySelector('.track')
167
- const activeTrack = progress.shadowRoot?.querySelector('.active-track')
168
-
169
- assert.exists(track, 'should render track circle')
170
- assert.exists(activeTrack, 'should render active track circle')
171
- assert.equal(track?.getAttribute('pathLength'), '100', 'track should have pathLength 100')
172
- assert.equal(activeTrack?.getAttribute('pathLength'), '100', 'active track should have pathLength 100')
173
- })
174
-
175
- it('calculates correct stroke-dashoffset for progress value', async () => {
176
- const activeTrack = progress.shadowRoot?.querySelector('.active-track')
177
- const expectedOffset = (1 - progress.value / progress.max) * 100
178
- assert.equal(
179
- activeTrack?.getAttribute('stroke-dashoffset'),
180
- String(expectedOffset),
181
- 'should calculate correct dashoffset'
182
- )
183
- })
184
-
185
- it('updates stroke-dashoffset when value changes', async () => {
186
- progress.value = 75
187
- await progress.updateComplete
188
-
189
- const activeTrack = progress.shadowRoot?.querySelector('.active-track')
190
- const expectedOffset = (1 - 75 / 100) * 100
191
- assert.equal(
192
- activeTrack?.getAttribute('stroke-dashoffset'),
193
- String(expectedOffset),
194
- 'should update dashoffset when value changes'
195
- )
196
- })
197
- })
198
-
199
- describe('Indeterminate State', () => {
200
- let progress: CircularProgress
201
-
202
- beforeEach(async () => {
203
- progress = await indeterminateFixture()
204
- })
205
-
206
- it('renders spinner container for indeterminate progress', async () => {
207
- const spinner = progress.shadowRoot?.querySelector('.spinner')
208
- assert.exists(spinner, 'should render spinner element')
209
- })
210
-
211
- it('renders left and right containers', async () => {
212
- const left = progress.shadowRoot?.querySelector('.left')
213
- const right = progress.shadowRoot?.querySelector('.right')
214
-
215
- assert.exists(left, 'should render left container')
216
- assert.exists(right, 'should render right container')
217
- })
218
-
219
- it('renders circle elements for animation', async () => {
220
- const circles = progress.shadowRoot?.querySelectorAll('.circle')
221
- assert.equal(circles?.length, 2, 'should render 2 circle elements')
222
- })
223
-
224
- it('does not render SVG elements in indeterminate mode', async () => {
225
- const svg = progress.shadowRoot?.querySelector('svg')
226
- assert.isNull(svg, 'should not render SVG in indeterminate mode')
227
- })
228
- })
229
-
230
- describe('Four Color Animation', () => {
231
- let progress: CircularProgress
232
-
233
- beforeEach(async () => {
234
- progress = await fourColorFixture()
235
- })
236
-
237
- it('applies fourcolor attribute when fourColor is true', async () => {
238
- assert.isTrue(progress.hasAttribute('fourcolor'), 'should have fourcolor attribute')
239
- })
240
-
241
- it('removes fourcolor attribute when fourColor is false', async () => {
242
- progress.fourColor = false
243
- await progress.updateComplete
244
- assert.isFalse(progress.hasAttribute('fourcolor'), 'should not have fourcolor attribute')
245
- })
246
- })
247
- })
248
-
249
- describe('Accessibility', () => {
250
- describe('ARIA Attributes', () => {
251
- let progress: CircularProgress
252
-
253
- beforeEach(async () => {
254
- progress = await basicFixture()
255
- })
256
-
257
- it('has correct role attribute', () => {
258
- assert.equal(progress.getAttribute('role'), 'progressbar', 'should have progressbar role')
259
- })
260
-
261
- it('sets aria-valuemin attribute', async () => {
262
- progress.min = 10
263
- await progress.updateComplete
264
- assert.equal(progress.getAttribute('aria-valuemin'), '10', 'should set aria-valuemin')
265
- })
266
-
267
- it('sets aria-valuemax attribute', async () => {
268
- progress.max = 200
269
- await progress.updateComplete
270
- assert.equal(progress.getAttribute('aria-valuemax'), '200', 'should set aria-valuemax')
271
- })
272
-
273
- it('sets aria-valuenow for determinate progress', async () => {
274
- progress.value = 50
275
- await progress.updateComplete
276
- assert.equal(progress.getAttribute('aria-valuenow'), '50', 'should set aria-valuenow for determinate')
277
- })
278
-
279
- it('removes aria-valuenow for indeterminate progress', async () => {
280
- progress.indeterminate = true
281
- await progress.updateComplete
282
- assert.isNull(progress.getAttribute('aria-valuenow'), 'should remove aria-valuenow for indeterminate')
283
- })
284
-
285
- it('updates aria attributes when switching between states', async () => {
286
- // Start determinate
287
- progress.value = 30
288
- await progress.updateComplete
289
- assert.equal(progress.getAttribute('aria-valuenow'), '30', 'should have aria-valuenow initially')
290
-
291
- // Switch to indeterminate
292
- progress.indeterminate = true
293
- await progress.updateComplete
294
- assert.isNull(progress.getAttribute('aria-valuenow'), 'should remove aria-valuenow when indeterminate')
295
-
296
- // Switch back to determinate
297
- progress.indeterminate = false
298
- await progress.updateComplete
299
- assert.equal(progress.getAttribute('aria-valuenow'), '30', 'should restore aria-valuenow when determinate')
300
- })
301
- })
302
-
303
- describe('Accessibility Testing', () => {
304
- it('should be accessible in basic state', async () => {
305
- const progress = await accessibleBasicFixture()
306
- await assert.isAccessible(progress)
307
- })
308
-
309
- it('should be accessible in determinate state', async () => {
310
- const progress = await accessibleDeterminateFixture()
311
- await assert.isAccessible(progress)
312
- })
313
-
314
- it('should be accessible in indeterminate state', async () => {
315
- const progress = await accessibleIndeterminateFixture()
316
- await assert.isAccessible(progress)
317
- })
318
-
319
- it('should be accessible with four colors', async () => {
320
- const progress = await accessibleFourColorFixture()
321
- await assert.isAccessible(progress)
322
- })
323
-
324
- it('should be accessible when disabled', async () => {
325
- const progress = await accessibleDisabledFixture()
326
- await assert.isAccessible(progress)
327
- })
328
- })
329
- })
330
-
331
- describe('Events', () => {
332
- let progress: CircularProgress
333
-
334
- beforeEach(async () => {
335
- progress = await basicFixture()
336
- })
337
-
338
- it('dispatches ratiochange event when value changes', async () => {
339
- let eventFired = false
340
- progress.addEventListener('ratiochange', () => {
341
- eventFired = true
342
- })
343
-
344
- progress.value = 50
345
- await progress.updateComplete
346
-
347
- assert.isTrue(eventFired, 'should dispatch ratiochange event')
348
- })
349
-
350
- it('dispatches ratiochange event when max changes', async () => {
351
- let eventFired = false
352
- progress.value = 50 // Set initial value
353
- await progress.updateComplete
354
-
355
- progress.addEventListener('ratiochange', () => {
356
- eventFired = true
357
- })
358
-
359
- progress.max = 200
360
- await progress.updateComplete
361
-
362
- assert.isTrue(eventFired, 'should dispatch ratiochange event when max changes')
363
- })
364
-
365
- it('dispatches ratiochange event when min changes', async () => {
366
- let eventFired = false
367
- progress.value = 50 // Set initial value
368
- await progress.updateComplete
369
-
370
- progress.addEventListener('ratiochange', () => {
371
- eventFired = true
372
- })
373
-
374
- progress.min = 10
375
- await progress.updateComplete
376
-
377
- assert.isTrue(eventFired, 'should dispatch ratiochange event when min changes')
378
- })
379
- })
380
-
381
- describe('CSS Custom Properties Support', () => {
382
- let progress: CircularProgress
383
-
384
- beforeEach(async () => {
385
- progress = await basicFixture()
386
- })
387
-
388
- it('allows size customization via CSS custom property', async () => {
389
- progress.style.setProperty('--ui-circular-progress-size', '64px')
390
- await progress.updateComplete
391
-
392
- const computedStyle = getComputedStyle(progress)
393
- assert.include(computedStyle.getPropertyValue('--_size'), '64px', 'should use custom size')
394
- })
395
-
396
- it('supports color customization', async () => {
397
- progress.style.setProperty('--ui-circular-progress-active-indicator-color', 'red')
398
- await progress.updateComplete
399
-
400
- const computedStyle = getComputedStyle(progress)
401
- assert.include(computedStyle.getPropertyValue('--_active-indicator-color'), 'red', 'should use custom color')
402
- })
403
- })
404
-
405
- describe('Edge Cases', () => {
406
- let progress: CircularProgress
407
-
408
- beforeEach(async () => {
409
- progress = await basicFixture()
410
- })
411
-
412
- it('handles NaN values gracefully', async () => {
413
- progress.value = NaN
414
- await progress.updateComplete
415
- assert.equal(progress.value, 0, 'should handle NaN value gracefully')
416
- })
417
-
418
- it('handles negative step values', async () => {
419
- progress.step = -5
420
- progress.value = 10
421
- await progress.updateComplete
422
- assert.equal(progress.value, 10, 'should handle negative step values')
423
- })
424
-
425
- it('handles very small step values', async () => {
426
- progress.step = 0.1
427
- progress.value = 0.15
428
- await progress.updateComplete
429
- assert.equal(progress.value, 0.1, 'should handle small step values correctly')
430
- })
431
-
432
- it('maintains correct ratio when min is not zero', async () => {
433
- progress.min = 20
434
- progress.max = 80
435
- progress.value = 50
436
- await progress.updateComplete
437
-
438
- const expectedRatio = ((50 - 20) / (80 - 20)) * 100
439
- assert.equal(progress.ratio, expectedRatio, 'should calculate ratio correctly with non-zero min')
440
- })
441
- })
442
-
443
- describe('Disabled State', () => {
444
- let progress: CircularProgress
445
-
446
- beforeEach(async () => {
447
- progress = await disabledFixture()
448
- })
449
-
450
- it('reflects disabled attribute', () => {
451
- assert.isTrue(progress.hasAttribute('disabled'), 'should have disabled attribute')
452
- assert.isTrue(progress.disabled, 'disabled property should be true')
453
- })
454
-
455
- it('can be enabled programmatically', async () => {
456
- progress.disabled = false
457
- await progress.updateComplete
458
-
459
- assert.isFalse(progress.hasAttribute('disabled'), 'should not have disabled attribute')
460
- assert.isFalse(progress.disabled, 'disabled property should be false')
461
- })
462
- })
463
-
464
- describe('Performance Considerations', () => {
465
- let progress: CircularProgress
466
-
467
- beforeEach(async () => {
468
- progress = await basicFixture()
469
- })
470
-
471
- it('uses contain: strict for performance', () => {
472
- const computedStyle = getComputedStyle(progress)
473
- assert.equal(computedStyle.contain, 'strict', 'should use contain: strict')
474
- })
475
-
476
- it('uses content-visibility: auto', () => {
477
- const computedStyle = getComputedStyle(progress)
478
- assert.equal(computedStyle.contentVisibility, 'auto', 'should use content-visibility: auto')
479
- })
480
- })
481
- })
@@ -1,117 +0,0 @@
1
- import { fixture, assert, html, nextFrame } from '@open-wc/testing'
2
- import UiProgress from '../../../src/md/progress/internals/UiProgress.js'
3
- import '../../../src/md/progress/ui-progress.js'
4
-
5
- describe('UiProgress', () => {
6
- async function basicFixture(): Promise<UiProgress> {
7
- return fixture(html`<ui-progress></ui-progress>`)
8
- }
9
-
10
- async function transitingFixture(): Promise<UiProgress> {
11
- return fixture(html`<ui-progress class="transiting"></ui-progress>`)
12
- }
13
-
14
- describe('basic', () => {
15
- let progress: UiProgress
16
- beforeEach(async () => {
17
- progress = await basicFixture()
18
- })
19
-
20
- it('sets the default values', () => {
21
- assert.equal(progress.min, 0)
22
- assert.equal(progress.max, 100)
23
- assert.equal(progress.value, 0)
24
- })
25
-
26
- it('set the value', async () => {
27
- progress.value = 50
28
- await nextFrame()
29
- assert.equal(progress.value, 50)
30
- // test clamp value
31
- progress.value = 60.1
32
- await nextFrame()
33
- assert.equal(progress.value, 60)
34
- })
35
-
36
- it('set the max', async () => {
37
- progress.max = 10
38
- progress.value = 11
39
- await nextFrame()
40
- assert.equal(progress.value, progress.max)
41
- })
42
-
43
- it('sets the ratio', async () => {
44
- progress.max = 10
45
- progress.value = 5
46
- await nextFrame()
47
- assert.equal(progress.ratio, 50)
48
- })
49
-
50
- it('sets the secondary ratio', async () => {
51
- progress.max = 10
52
- progress.secondaryProgress = 5
53
- await nextFrame()
54
- assert.equal(progress.secondaryRatio, 50)
55
- })
56
-
57
- it('set the min', async () => {
58
- progress.min = 10
59
- progress.max = 50
60
- progress.value = 30
61
- await nextFrame()
62
- assert.equal(progress.ratio, 50)
63
- progress.value = 0
64
- await nextFrame()
65
- assert.equal(progress.value, progress.min)
66
- })
67
-
68
- it('set the step', async () => {
69
- progress.min = 0
70
- progress.max = 10
71
- progress.value = 5.1
72
- await nextFrame()
73
- assert.equal(progress.value, 5)
74
- progress.step = 0.1
75
- progress.value = 5.1
76
- await nextFrame()
77
- assert.equal(progress.value, 5.1)
78
- })
79
-
80
- it('has a "aria-valuenow" attribute when `indeterminate` is true.', async () => {
81
- progress.min = 0
82
- progress.max = 10
83
- progress.value = 5.1
84
- await nextFrame()
85
- assert(progress.hasAttribute('aria-valuenow'))
86
-
87
- progress.indeterminate = true
88
- await nextFrame()
89
- assert(!progress.hasAttribute('aria-valuenow'))
90
-
91
- progress.indeterminate = false
92
- await nextFrame()
93
- assert(progress.hasAttribute('aria-valuenow'))
94
- })
95
- })
96
-
97
- describe('transiting class', () => {
98
- let progress: UiProgress
99
- beforeEach(async () => {
100
- progress = await transitingFixture()
101
- })
102
-
103
- it('progress bars', () => {
104
- const primary = progress.shadowRoot!.querySelector('.primary') as HTMLElement
105
- const secondary = progress.shadowRoot!.querySelector('.secondary') as HTMLElement
106
- const stylesForPrimaryProgress = window.getComputedStyle(primary)
107
- const stylesForSecondaryProgress = window.getComputedStyle(secondary)
108
- let transitionProp = stylesForPrimaryProgress['transitionProperty'] as string
109
-
110
- assert.equal(transitionProp, 'transform')
111
- assert.equal(stylesForPrimaryProgress['transitionDuration'], '0.23s')
112
- transitionProp = stylesForSecondaryProgress['transitionProperty']
113
- assert.equal(transitionProp, 'transform')
114
- assert.equal(stylesForSecondaryProgress['transitionDuration'], '0.23s')
115
- })
116
- })
117
- })