@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,182 +0,0 @@
1
- /**
2
- * Example test demonstrating proper DOM assertion usage.
3
- * This shows the correct way to compare DOM elements.
4
- */
5
-
6
- import { assert, fixture, html } from '@open-wc/testing'
7
-
8
- // Import the setup to ensure it runs
9
- import './setup.js'
10
-
11
- describe('DOM Assertion Examples', () => {
12
- describe('Basic DOM Element Comparisons', () => {
13
- it('should compare DOM elements correctly with assert.dom.equal', async () => {
14
- // Create a test element
15
- const element = await fixture(html`<div id="test">Content</div>`)
16
-
17
- // Find the same element using querySelector
18
- const foundElement = document.querySelector('#test')
19
-
20
- // ✅ CORRECT: Use assert.dom.equal for DOM element comparison
21
- assert.dom.equal(foundElement, element)
22
-
23
- // ❌ WRONG: Never use assert.equal for DOM elements
24
- // assert.equal(foundElement, element) // This won't work properly
25
- })
26
-
27
- it('should verify different elements are not equal', async () => {
28
- const element1 = await fixture(html`<div id="test1">Content 1</div>`)
29
- const element2 = await fixture(html`<div id="test2">Content 2</div>`)
30
-
31
- // ✅ CORRECT: Use assert.dom.notEqual for different DOM elements
32
- assert.dom.notEqual(element1, element2)
33
- })
34
-
35
- it('should compare element snapshots', async () => {
36
- const element = await fixture(html`<div class="test">Hello World</div>`)
37
-
38
- // ✅ CORRECT: Use assert.dom.equalSnapshot for HTML content comparison
39
- // Note: equalSnapshot typically takes just the element and compares against saved snapshots
40
- assert.dom.equalSnapshot(element)
41
- })
42
-
43
- it('should verify element does not match snapshot', async () => {
44
- // For this demo, we'll just verify the element exists and has expected content
45
- const element = await fixture(html`<div class="test">Changed Content</div>`)
46
-
47
- // Verify content directly instead of using snapshots in this example
48
- assert.equal(element.textContent, 'Changed Content')
49
- assert.equal(element.className, 'test')
50
- })
51
- })
52
-
53
- describe('Advanced DOM Assertion Scenarios', () => {
54
- it('should wait for element and compare correctly', async () => {
55
- // Add element after a delay
56
- setTimeout(() => {
57
- const element = document.createElement('div')
58
- element.id = 'delayed-element'
59
- element.textContent = 'I appeared later'
60
- document.body.appendChild(element)
61
- }, 50)
62
-
63
- // Wait for the element to appear
64
- const foundElement = await window.testUtils.waitForElement('#delayed-element')
65
-
66
- // Get the same element using querySelector
67
- const queryElement = document.querySelector('#delayed-element')
68
-
69
- // ✅ CORRECT: Compare the DOM elements
70
- assert.dom.equal(foundElement, queryElement)
71
-
72
- // Also verify the content
73
- assert.equal(foundElement.textContent, 'I appeared later')
74
- })
75
-
76
- it('should handle element creation and comparison in tests', async () => {
77
- // Create element using fixture
78
- const fixtureElement = await fixture(html`
79
- <div class="container">
80
- <span class="child">Child content</span>
81
- </div>
82
- `) // Find child element
83
- const childElement = fixtureElement.querySelector('.child')
84
- const foundChild = document.querySelector('.child')
85
-
86
- // Verify child element exists
87
- assert.exists(childElement)
88
- assert.exists(foundChild)
89
-
90
- // ✅ CORRECT: Compare the child elements
91
- assert.dom.equal(childElement, foundChild)
92
-
93
- // Verify the parent-child relationship
94
- assert.dom.equal(childElement!.parentElement, fixtureElement)
95
- })
96
-
97
- it('should demonstrate element mutation and comparison', async () => {
98
- const element = await fixture(html`<div class="original">Original</div>`)
99
-
100
- // Verify initial state
101
- assert.equal(element.textContent, 'Original')
102
- assert.equal(element.className, 'original')
103
-
104
- // Mutate the element
105
- element.textContent = 'Modified'
106
- element.className = 'modified'
107
-
108
- // Verify the changes
109
- assert.equal(element.textContent, 'Modified')
110
- assert.equal(element.className, 'modified')
111
- })
112
-
113
- it('should handle custom elements and DOM assertions', async () => {
114
- // Define a simple custom element for testing
115
- if (!customElements.get('test-element')) {
116
- customElements.define(
117
- 'test-element',
118
- class extends HTMLElement {
119
- connectedCallback() {
120
- this.innerHTML = '<span>Custom element content</span>'
121
- }
122
- }
123
- )
124
- }
125
-
126
- const customElement = await fixture(html`<test-element></test-element>`)
127
- const foundCustomElement = document.querySelector('test-element')
128
-
129
- // ✅ CORRECT: Compare custom elements
130
- assert.dom.equal(customElement, foundCustomElement)
131
-
132
- // Verify the custom element rendered correctly
133
- const span = customElement.querySelector('span')
134
- assert.exists(span)
135
- assert.equal(span.textContent, 'Custom element content')
136
- })
137
- })
138
-
139
- describe('Common DOM Assertion Patterns', () => {
140
- it('should verify element exists before comparing', async () => {
141
- const element = await fixture(html`<div id="exists">I exist</div>`)
142
-
143
- // First verify the element exists
144
- assert.exists(element)
145
-
146
- // Then find it and compare
147
- const foundElement = document.getElementById('exists')
148
- assert.exists(foundElement)
149
-
150
- // ✅ CORRECT: Now compare the elements
151
- assert.dom.equal(element, foundElement)
152
- })
153
-
154
- it('should handle null elements gracefully', () => {
155
- const nonExistentElement = document.querySelector('#does-not-exist')
156
-
157
- // Verify it's null
158
- assert.isNull(nonExistentElement)
159
-
160
- // Don't try to use assert.dom.equal with null elements
161
- // This would throw an error:
162
- // assert.dom.equal(nonExistentElement, someOtherElement)
163
- })
164
-
165
- it('should compare elements after DOM manipulation', async () => {
166
- const container = await fixture(html`<div class="container"></div>`)
167
-
168
- // Add a child element
169
- const child = document.createElement('span')
170
- child.textContent = 'Added child'
171
- container.appendChild(child)
172
-
173
- // Find the child through different methods
174
- const foundChild1 = container.querySelector('span')
175
- const foundChild2 = container.firstElementChild
176
-
177
- // ✅ CORRECT: Both should reference the same element
178
- assert.dom.equal(foundChild1, foundChild2)
179
- assert.dom.equal(foundChild1, child)
180
- })
181
- })
182
- })
@@ -1,65 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- window.MonacoEnvironment = {
3
- getWorker: (_moduleId: any, label: string): Worker => {
4
- let url: string
5
- const prefix = 'node_modules/monaco-editor/esm/vs/'
6
- const langPrefix = `${prefix}language/`
7
- switch (label) {
8
- case 'json':
9
- url = `${langPrefix}json/json.worker.js?worker`
10
- break
11
- case 'css':
12
- url = `${langPrefix}css/css.worker.js?worker`
13
- break
14
- case 'html':
15
- url = `${langPrefix}html/html.worker.js?worker`
16
- break
17
- case 'javascript':
18
- case 'typescript':
19
- url = `${langPrefix}typescript/ts.worker.js?worker`
20
- break
21
- default:
22
- url = `${prefix}editor/editor.worker.js?worker`
23
- break
24
- }
25
- return new Worker(url, {
26
- type: 'module',
27
- name: label,
28
- })
29
- },
30
- }
31
-
32
- export async function loadMonaco(): Promise<void> {
33
- let interval: any
34
- return new Promise((resolve) => {
35
- interval = setInterval(() => {
36
- // @ts-expect-error for testing
37
- if (window.monaco) {
38
- clearInterval(interval)
39
- resolve()
40
- }
41
- }, 20)
42
- })
43
- }
44
-
45
- ;((): void => {
46
- // @ts-expect-error for testing
47
- if (window.monaco) {
48
- return
49
- }
50
- // @ts-expect-error for testing
51
- window.require = { paths: { vs: 'node_modules/monaco-editor/min/vs' } }
52
-
53
- function loadScript(src: string): void {
54
- const script = document.createElement('script')
55
- script.src = src
56
- script.defer = false
57
- script.async = false
58
- script.type = 'text/javascript'
59
- document.getElementsByTagName('head')[0].appendChild(script)
60
- }
61
-
62
- loadScript('node_modules/monaco-editor/min/vs/loader.js')
63
- // loadScript('node_modules/monaco-editor/min/vs/editor/editor.main.nls.js')
64
- loadScript('node_modules/monaco-editor/min/vs/editor/editor.main.js')
65
- })()
@@ -1,177 +0,0 @@
1
- import { html, fixture, assert, oneEvent } from '@open-wc/testing'
2
- import { IBasicAuthorization, IRequestAuthorization, RequestAuthorization } from '@api-client/core/browser.js'
3
- import { Authorization } from '../../../src/elements/authorization/ui/Authorization.js'
4
- import Input from '../../../src/md/input/Input.js'
5
- import '../../../src/define/authorization/basic-authorization.js'
6
-
7
- describe('Basic method', () => {
8
- const usernameSelector = 'ui-filled-text-field[name="username"]'
9
- const passwordSelector = 'ui-filled-text-field[name="password"]'
10
-
11
- const username = 'test-username'
12
- const password = 'test-password'
13
-
14
- async function basicFixture(auth?: IRequestAuthorization): Promise<Authorization> {
15
- return fixture(html`<basic-authorization .authorization="${auth}"></basic-authorization>`)
16
- }
17
-
18
- describe('DOM rendering', () => {
19
- let element: Authorization
20
- let form: HTMLFormElement
21
-
22
- beforeEach(async () => {
23
- const auth = RequestAuthorization.fromTypedConfig('basic', {}).toJSON()
24
- element = await basicFixture(auth)
25
- form = element.shadowRoot!.querySelector('form')!
26
- })
27
-
28
- it('has the form in the DOM', async () => {
29
- assert.ok(form)
30
- })
31
-
32
- it('has form has autocomplete', async () => {
33
- assert.equal(form.getAttribute('autocomplete'), 'on')
34
- })
35
-
36
- it('form has username input', async () => {
37
- const input = form.querySelector(usernameSelector) as Input
38
- assert.ok(input)
39
- })
40
-
41
- it('username is required', async () => {
42
- const input = form.querySelector(usernameSelector) as Input
43
- assert.isTrue(input.required)
44
- })
45
-
46
- it('username has invalid label', async () => {
47
- const input = form.querySelector(usernameSelector) as Input
48
- assert.equal(input.invalidText, 'Username is required')
49
- })
50
-
51
- it('form has password input', async () => {
52
- const input = form.querySelector(passwordSelector) as Input
53
- assert.ok(input)
54
- })
55
-
56
- it('has no other inputs', () => {
57
- const controls = form.querySelectorAll('ui-filled-text-field')
58
- assert.lengthOf(controls, 2)
59
- })
60
- })
61
-
62
- describe('change notification', () => {
63
- let element: Authorization
64
- beforeEach(async () => {
65
- const auth = RequestAuthorization.fromTypedConfig('basic', {}).toJSON()
66
- element = await basicFixture(auth)
67
- })
68
-
69
- it('notifies when username changes', async () => {
70
- const input = element.shadowRoot!.querySelector(usernameSelector) as Input
71
- setTimeout(() => {
72
- input.value = 'test'
73
- input.dispatchEvent(new Event('change'))
74
- })
75
- const e = await oneEvent(element, 'change')
76
- assert.ok(e)
77
- })
78
-
79
- it('notifies when password changes', async () => {
80
- const input = element.shadowRoot!.querySelector(passwordSelector) as Input
81
- setTimeout(() => {
82
- input.value = 'test-password'
83
- input.dispatchEvent(new Event('change'))
84
- })
85
- const e = await oneEvent(element, 'change')
86
- assert.ok(e)
87
- })
88
- })
89
-
90
- describe('updating the model', () => {
91
- let element: Authorization
92
- beforeEach(async () => {
93
- const auth = RequestAuthorization.fromTypedConfig('basic', {
94
- username,
95
- password,
96
- }).toJSON()
97
- element = await basicFixture(auth)
98
- })
99
-
100
- it('updates the username from user input', () => {
101
- const input = element.shadowRoot!.querySelector(usernameSelector) as Input
102
- input.value = 'test'
103
- input.dispatchEvent(new Event('change'))
104
- const config = element.authorization!.config as IBasicAuthorization
105
- assert.equal(config.username, 'test')
106
- })
107
-
108
- it('notifies when password changes', () => {
109
- const input = element.shadowRoot!.querySelector(passwordSelector) as Input
110
- input.value = 'password'
111
- input.dispatchEvent(new Event('change'))
112
- const config = element.authorization!.config as IBasicAuthorization
113
- assert.equal(config.password, 'password')
114
- })
115
- })
116
-
117
- describe('data restoration', () => {
118
- let element: Authorization
119
- beforeEach(async () => {
120
- const auth = RequestAuthorization.fromTypedConfig('basic', {
121
- username,
122
- password,
123
- }).toJSON()
124
- element = await basicFixture(auth)
125
- })
126
-
127
- it('has the value on the username filed', () => {
128
- const input = element.shadowRoot!.querySelector(usernameSelector) as Input
129
- assert.equal(input.value, username)
130
- })
131
-
132
- it('has the value on the password filed', () => {
133
- const input = element.shadowRoot!.querySelector(passwordSelector) as Input
134
- assert.equal(input.value, password)
135
- })
136
- })
137
-
138
- describe('validation', () => {
139
- let element: Authorization
140
- beforeEach(async () => {
141
- const auth = RequestAuthorization.fromTypedConfig('basic', {}).toJSON()
142
- element = await basicFixture(auth)
143
- })
144
-
145
- it('is not valid without the username', () => {
146
- const result = element.checkValidity()
147
- assert.isFalse(result)
148
- })
149
-
150
- it('is valid with the username', async () => {
151
- ;(element.authorization!.config as IBasicAuthorization).username = 'test-username'
152
- element.requestUpdate()
153
- await element.updateComplete
154
- const result = element.checkValidity()
155
- assert.isTrue(result)
156
- })
157
- })
158
-
159
- describe('a11y', () => {
160
- it('is accessible without the model', async () => {
161
- const element = await basicFixture()
162
- await assert.isAccessible(element)
163
- })
164
-
165
- it('is accessible when empty', async () => {
166
- const auth = RequestAuthorization.fromTypedConfig('basic', {}).toJSON()
167
- const element = await basicFixture(auth)
168
- await assert.isAccessible(element)
169
- })
170
-
171
- it('is accessible with values', async () => {
172
- const auth = RequestAuthorization.fromTypedConfig('basic', { username, password }).toJSON()
173
- const element = await basicFixture(auth)
174
- await assert.isAccessible(element)
175
- })
176
- })
177
- })
@@ -1,143 +0,0 @@
1
- import { html, fixture, assert, oneEvent } from '@open-wc/testing'
2
- import { IBearerAuthorization, IRequestAuthorization, RequestAuthorization } from '@api-client/core/browser.js'
3
- import { Authorization } from '../../../src/elements/authorization/ui/Authorization.js'
4
- import Input from '../../../src/md/input/Input.js'
5
- import '../../../src/define/authorization/bearer-authorization.js'
6
-
7
- describe('Bearer method', () => {
8
- const tokenSelector = 'ui-filled-text-field[name="token"]'
9
- const token = 'test-token'
10
-
11
- async function basicFixture(auth?: IRequestAuthorization): Promise<Authorization> {
12
- return fixture(html`<bearer-authorization .authorization="${auth}"></bearer-authorization>`)
13
- }
14
-
15
- describe('DOM rendering', () => {
16
- let element: Authorization
17
- let form: HTMLFormElement
18
- beforeEach(async () => {
19
- const auth = RequestAuthorization.fromTypedConfig('bearer', {}).toJSON()
20
- element = await basicFixture(auth)
21
- form = element.shadowRoot!.querySelector('form')!
22
- })
23
-
24
- it('has form in the DOM', async () => {
25
- assert.ok(form)
26
- })
27
-
28
- it('has form has autocomplete', async () => {
29
- assert.equal(form.getAttribute('autocomplete'), 'on')
30
- })
31
-
32
- it('form has token input', async () => {
33
- const input = form.querySelector(tokenSelector)
34
- assert.ok(input)
35
- })
36
-
37
- it('token is required', async () => {
38
- const input = form.querySelector(tokenSelector) as Input
39
- assert.isTrue(input.required)
40
- })
41
-
42
- it('token has invalid label', async () => {
43
- const input = form.querySelector(tokenSelector) as Input
44
- assert.equal(input.invalidText, 'Token is required', 'Token has the invalidText')
45
- })
46
-
47
- it('has no other inputs', () => {
48
- const controls = form.querySelectorAll('ui-filled-text-field')
49
- assert.lengthOf(controls, 1)
50
- })
51
- })
52
-
53
- describe('change notification', () => {
54
- let element: Authorization
55
- beforeEach(async () => {
56
- const auth = RequestAuthorization.fromTypedConfig('bearer', {}).toJSON()
57
- element = await basicFixture(auth)
58
- })
59
-
60
- it('notifies when token changes', async () => {
61
- const input = element.shadowRoot!.querySelector(tokenSelector) as Input
62
- setTimeout(() => {
63
- input.value = 'test'
64
- input.dispatchEvent(new CustomEvent('change'))
65
- })
66
- const e = await oneEvent(element, 'change')
67
- assert.ok(e)
68
- })
69
- })
70
-
71
- describe('updating the model', () => {
72
- let element: Authorization
73
- beforeEach(async () => {
74
- const auth = RequestAuthorization.fromTypedConfig('bearer', {
75
- token,
76
- }).toJSON()
77
- element = await basicFixture(auth)
78
- })
79
-
80
- it('updates the token from user input', () => {
81
- const input = element.shadowRoot!.querySelector(tokenSelector) as Input
82
- input.value = 'test'
83
- input.dispatchEvent(new Event('change'))
84
- const config = element.authorization!.config as IBearerAuthorization
85
- assert.equal(config.token, 'test')
86
- })
87
- })
88
-
89
- describe('data restoration', () => {
90
- let element: Authorization
91
- beforeEach(async () => {
92
- const auth = RequestAuthorization.fromTypedConfig('bearer', {
93
- token,
94
- }).toJSON()
95
- element = await basicFixture(auth)
96
- })
97
-
98
- it('has the value on the token filed', () => {
99
- const input = element.shadowRoot!.querySelector(tokenSelector) as Input
100
- assert.equal(input.value, token)
101
- })
102
- })
103
-
104
- describe('validation', () => {
105
- let element: Authorization
106
- beforeEach(async () => {
107
- const auth = RequestAuthorization.fromTypedConfig('bearer', {}).toJSON()
108
- element = await basicFixture(auth)
109
- })
110
-
111
- it('is not valid without the token', () => {
112
- const result = element.checkValidity()
113
- assert.isFalse(result)
114
- })
115
-
116
- it('is valid with the token', async () => {
117
- ;(element.authorization!.config as IBearerAuthorization).token = token
118
- element.requestUpdate()
119
- await element.updateComplete
120
- const result = element.checkValidity()
121
- assert.isTrue(result)
122
- })
123
- })
124
-
125
- describe('a11y', () => {
126
- it('is accessible without the model', async () => {
127
- const element = await basicFixture()
128
- await assert.isAccessible(element)
129
- })
130
-
131
- it('is accessible when empty', async () => {
132
- const auth = RequestAuthorization.fromTypedConfig('bearer', {}).toJSON()
133
- const element = await basicFixture(auth)
134
- await assert.isAccessible(element)
135
- })
136
-
137
- it('is accessible with values', async () => {
138
- const auth = RequestAuthorization.fromTypedConfig('bearer', { token }).toJSON()
139
- const element = await basicFixture(auth)
140
- await assert.isAccessible(element)
141
- })
142
- })
143
- })