@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,502 +0,0 @@
1
- import {
2
- DataSteps,
3
- FlowResponseDataEnum,
4
- FlowSourceEnum,
5
- HttpAssertions as CoreAssertions,
6
- IHttpFlow,
7
- } from '@api-client/core/browser.js'
8
- import { assert, fixture, html } from '@open-wc/testing'
9
- import { resetMouse, setViewport } from '@web/test-runner-commands'
10
- import sinon from 'sinon'
11
- import type HttpFlows from '../../../src/elements/http/HttpFlows.element.js'
12
- import type UiButton from '../../../src/md/button/internals/button.js'
13
- import type UiChip from '../../../src/md/chip/internals/Chip.js'
14
- import type Input from '../../../src/md/input/Input.js'
15
- import type UiListItem from '../../../src/md/list/internals/ListItem.js'
16
- import { UiMock } from '../../helpers/UiMock.js'
17
- import { SnackNotifications } from '../../../src/md/notification/SnackNotifications.js'
18
- import '../../../src/define/http/http-flows.js'
19
-
20
- describe('element', () => {
21
- describe('http', () => {
22
- before(async () => {
23
- await setViewport({ width: 1920, height: 1080 })
24
- })
25
-
26
- describe('HttpFlows', () => {
27
- async function basicFixture(): Promise<HttpFlows> {
28
- return fixture(html`<http-flows></http-flows>`)
29
- }
30
-
31
- async function emptyResponseFlowFixture(): Promise<HttpFlows> {
32
- const flows: IHttpFlow[] = [
33
- {
34
- actions: [],
35
- trigger: 'response',
36
- description: 'initial',
37
- },
38
- ]
39
- return fixture(html`<http-flows .model="${flows}"></http-flows>`)
40
- }
41
-
42
- describe('initialization', () => {
43
- it('has no flows UI', async () => {
44
- const editor = await basicFixture()
45
- const nodes = editor.shadowRoot!.querySelectorAll('.param-row')
46
- assert.lengthOf(nodes, 0, 'has no param-row nodes')
47
- })
48
-
49
- it('has the flow building blocks panel', async () => {
50
- const editor = await basicFixture()
51
- const node = editor.shadowRoot!.querySelector('.options')
52
- assert.ok(node)
53
- })
54
-
55
- it('has the empty message rendered', async () => {
56
- const editor = await basicFixture()
57
- const node = editor.shadowRoot!.querySelector('.empty-message')!
58
- assert.ok(node, 'has the node')
59
- assert.equal(node.textContent?.trim(), 'Create a flow to get started.')
60
- })
61
-
62
- it('has the add flow button', async () => {
63
- const editor = await basicFixture()
64
- const node = editor.shadowRoot!.querySelector('.empty-message .empty-button')!
65
- assert.ok(node, 'has the button')
66
- })
67
- })
68
-
69
- describe('adding flows', () => {
70
- let element: HttpFlows
71
-
72
- beforeEach(async () => {
73
- element = await basicFixture()
74
- })
75
-
76
- it('empty message button triggers the add flow dialog', async () => {
77
- const button = element.shadowRoot!.querySelector('.empty-message .empty-button') as UiButton
78
- button.click()
79
- assert.isTrue(element.flowAddDialog?.open, 'the dialog is opened')
80
- })
81
-
82
- it('creates a flow from the dialog', async () => {
83
- const button = element.shadowRoot!.querySelector('.empty-message .empty-button') as UiButton
84
- button.click()
85
- const dialog = element.flowAddDialog!
86
- await dialog.updateComplete
87
- const input = dialog.querySelector('ui-filled-text-field')!
88
- input.value = 'My Flow 1'
89
- input.notifyChange()
90
- const dialogButton = dialog.shadowRoot!.querySelector('.internal-button[value="confirm"]') as UiButton
91
- dialogButton.click()
92
- assert.lengthOf(element.model, 1, 'has the created flow')
93
- const [flow] = element.model
94
- assert.equal(flow.description, 'My Flow 1', 'the flow has the entered name')
95
- })
96
-
97
- it('adds the description when provided', () => {
98
- element.addFlow('test')
99
- assert.lengthOf(element.model, 1, 'has the created flow')
100
- const [flow] = element.model
101
- assert.equal(flow.description, 'test', 'the flow has the passed description')
102
- })
103
-
104
- it('adds the current trigger', () => {
105
- element.addFlow('test')
106
- const [flow] = element.model
107
- assert.equal(flow.trigger, 'response', 'has the current trigger')
108
- })
109
-
110
- it('adds empty actions', () => {
111
- element.addFlow()
112
- const [flow] = element.model
113
- assert.deepEqual(flow.actions, [])
114
- })
115
-
116
- it('sets the selectedFlow', () => {
117
- element.addFlow()
118
- assert.equal(element.selectedFlow, 0, 'selects the first flow')
119
- element.addFlow()
120
- assert.equal(element.selectedFlow, 1, 'selects another')
121
- })
122
-
123
- it('notifies change', () => {
124
- const spy = sinon.spy()
125
- element.addEventListener('change', spy)
126
- element.addFlow()
127
- assert.isTrue(spy.calledOnce)
128
- })
129
-
130
- it('changes the empty message after adding a flow', async () => {
131
- element.addFlow()
132
- await element.updateComplete
133
- const node = element.shadowRoot!.querySelector('.empty-message')!
134
- assert.ok(node, 'has the node')
135
- assert.equal(node.textContent?.trim(), 'Drop a condition or an action here')
136
- })
137
-
138
- it('adds a flow after changing the trigger', async () => {
139
- element.addFlow()
140
- await element.updateComplete
141
- element.trigger = 'request'
142
- element.addFlow()
143
- await element.updateComplete
144
- assert.lengthOf(element.model, 2, 'has 2 flows')
145
- const [f1, f2] = element.model
146
- assert.equal(f1.trigger, 'response', 'flows 1 has the response trigger')
147
- assert.equal(f2.trigger, 'request', 'flows 2 has the request trigger')
148
- })
149
- })
150
-
151
- describe('working with a condition', () => {
152
- let element: HttpFlows
153
-
154
- beforeEach(async () => {
155
- element = await emptyResponseFlowFixture()
156
- })
157
-
158
- afterEach(async () => {
159
- await resetMouse()
160
- })
161
-
162
- it('drops the condition onto the editor', async () => {
163
- const chip = element.shadowRoot!.querySelector(`ui-chip[data-kind="Core#Condition"]`) as UiChip
164
-
165
- const target = element.shadowRoot!.querySelector(`.editor`) as HTMLElement
166
- await UiMock.dragAndDrop(chip, target)
167
- await element.updateComplete
168
-
169
- const condition = element.model[0].condition!
170
- assert.typeOf(condition, 'object', 'has added condition')
171
- assert.deepEqual(condition.steps, [], 'the condition has empty steps')
172
- })
173
-
174
- it('renders the condition UI', async () => {
175
- element.setCondition()
176
- await element.updateComplete
177
-
178
- const block = element.shadowRoot!.querySelector('.step-row.condition')!
179
- assert.ok(block, 'has the condition block')
180
-
181
- const label = block.querySelector('.action-tab > span')!
182
- assert.ok(label, 'has the label')
183
- assert.equal(label.textContent!.trim(), 'Condition', 'the label has the text value')
184
- })
185
-
186
- it('renders the condition dropdown menu', async () => {
187
- element.setCondition()
188
- await element.updateComplete
189
-
190
- const block = element.shadowRoot!.querySelector('.step-row.condition')!
191
- assert.ok(block, 'has the condition block')
192
-
193
- const list = block.querySelector('.action-tab > ui-dropdown-list')!
194
- assert.ok(list, 'has the dropdown')
195
-
196
- const trigger = list.querySelector('.condition-options-trigger')!
197
- assert.ok(trigger, 'has the dropdown trigger')
198
- assert.equal(trigger.localName, 'ui-icon-button', 'the dropdown trigger is the icon button')
199
-
200
- const listItems = Array.from(list.querySelectorAll('ui-list-item'))
201
- assert.lengthOf(listItems, 1, 'has all dropdown options')
202
-
203
- const [o1] = listItems
204
- assert.equal(o1.dataset.option, 'delete', 'has the remove item')
205
- assert.equal(o1.textContent!.trim(), 'Remove', 'the remove item has the text value')
206
- })
207
-
208
- it('disables the "condition" suggestion after adding one', async () => {
209
- element.setCondition()
210
- await element.updateComplete
211
- const chip = element.shadowRoot!.querySelector(`ui-chip[data-kind="Core#Condition"]`) as UiChip
212
- assert.isTrue(chip.disabled, 'the chip is disabled')
213
- })
214
-
215
- it('prohibits overriding the condition', async () => {
216
- element.setCondition()
217
- element.model[0].condition!.description = 'test'
218
- element.setCondition()
219
- assert.equal(element.model[0].condition!.description, 'test', 'the condition is unchanged')
220
- })
221
-
222
- it('notifies the user when overriding the condition', async () => {
223
- const spy = sinon.spy(SnackNotifications, 'notify')
224
- try {
225
- element.setCondition()
226
- await element.updateComplete
227
- element.setCondition()
228
- } finally {
229
- spy.restore()
230
- }
231
- assert.isTrue(spy.calledOnce, 'notifies the user')
232
- const message = spy.args[0][0] as string
233
- assert.equal(message, 'This flow already have a condition.')
234
- })
235
-
236
- it('drops data-source group onto the condition', async () => {
237
- element.setCondition()
238
- await element.updateComplete
239
-
240
- const chip = element.shadowRoot!.querySelector(
241
- `ui-chip[data-kind="${DataSteps.ReadDataSourceStepKind}"][data-data="${FlowResponseDataEnum.status}"]`
242
- ) as UiChip
243
- const target = element.shadowRoot!.querySelector(`.condition-row .steps`) as HTMLElement
244
-
245
- await UiMock.dragAndDrop(chip, target)
246
- await element.updateComplete
247
- const condition = element.model[0].condition!
248
- assert.lengthOf(condition.steps, 1, 'the condition has the step')
249
-
250
- const step = condition.steps[0] as DataSteps.IReadDataSourceStep
251
-
252
- assert.equal(step.kind, DataSteps.ReadDataSourceStepKind, 'has the kind')
253
- assert.equal(step.source, FlowSourceEnum.response, 'has the source')
254
- assert.equal(step.data, FlowResponseDataEnum.status, 'has the data')
255
-
256
- const unit = target.querySelector('.step-unit')!
257
- assert.ok(unit, 'renders the step container')
258
- const spacer = unit.querySelector('.drop-target.spacer')!
259
- assert.ok(spacer, 'renders the drop target')
260
- const pill = unit.querySelector('.step-pill')!
261
- assert.ok(pill, 'renders the data pill')
262
- assert.equal(pill.textContent?.trim(), 'Status code', 'renders the data pill value')
263
- assert.isTrue(spacer.nextElementSibling === pill, 'render the drop target before the pill')
264
- })
265
-
266
- it('drops transformation group onto the condition', async () => {
267
- element.setCondition()
268
- await element.updateComplete
269
-
270
- const chip = element.shadowRoot!.querySelector(
271
- `ui-chip[data-kind="${DataSteps.ReadValueStepKind}"]`
272
- ) as UiChip
273
- const target = element.shadowRoot!.querySelector(`.condition-row .steps`) as HTMLElement
274
-
275
- await UiMock.dragAndDrop(chip, target)
276
- await element.updateComplete
277
- const condition = element.model[0].condition!
278
- assert.lengthOf(condition.steps, 1, 'the condition has the step')
279
-
280
- const step = condition.steps[0] as DataSteps.IReadValueStep
281
- assert.equal(step.kind, DataSteps.ReadValueStepKind, 'has the kind')
282
-
283
- const unit = target.querySelector('.step-unit')!
284
- assert.ok(unit, 'renders the step container')
285
- const spacer = unit.querySelector('.drop-target.spacer')!
286
- assert.ok(spacer, 'renders the drop target')
287
- const pill = unit.querySelector('.step-pill')!
288
- assert.ok(pill, 'renders the data pill')
289
- assert.equal(pill.textContent?.trim(), 'Read value', 'renders the data pill value')
290
- assert.isTrue(spacer.nextElementSibling === pill, 'render the drop target before the pill')
291
- const input = unit.querySelector('ui-filled-text-field') as Input
292
- assert.ok(input, 'renders the path input')
293
- })
294
-
295
- it('drops assertion group onto the condition', async () => {
296
- element.setCondition()
297
- await element.updateComplete
298
-
299
- const chip = element.shadowRoot!.querySelector(
300
- `ui-chip[data-kind="${CoreAssertions.EqualAssertionKind}"]`
301
- ) as UiChip
302
- const target = element.shadowRoot!.querySelector(`.condition-row .steps`) as HTMLElement
303
-
304
- await UiMock.dragAndDrop(chip, target)
305
- await element.updateComplete
306
- const condition = element.model[0].condition!
307
- assert.lengthOf(condition.steps, 1, 'the condition has the step')
308
-
309
- const step = condition.steps[0] as CoreAssertions.IEqualAssertion
310
- assert.equal(step.kind, CoreAssertions.EqualAssertionKind, 'has the kind')
311
-
312
- const unit = target.querySelector('.step-unit')!
313
- assert.ok(unit, 'renders the step container')
314
- const spacer = unit.querySelector('.drop-target.spacer')!
315
- assert.ok(spacer, 'renders the drop target')
316
- const input = unit.querySelector('ui-filled-text-field')!
317
- assert.ok(input, 'renders the value input')
318
- })
319
-
320
- it('does not allow action group onto the condition', async () => {
321
- element.setCondition()
322
- await element.updateComplete
323
-
324
- const chip = element.shadowRoot!.querySelector(
325
- `ui-chip[data-kind="${DataSteps.SetCookieStepKind}"]`
326
- ) as UiChip
327
- const target = element.shadowRoot!.querySelector(`.condition-row .steps`) as HTMLElement
328
-
329
- await UiMock.dragAndDrop(chip, target)
330
- await element.updateComplete
331
- const condition = element.model[0].condition!
332
- assert.lengthOf(condition.steps, 0, 'has no steps')
333
- })
334
-
335
- it('removes the condition from the dropdown option', async () => {
336
- element.setCondition()
337
- await element.updateComplete
338
-
339
- const list = element.shadowRoot!.querySelector('.step-row.condition .action-tab > ui-dropdown-list')!
340
- assert.ok(list, 'has the dropdown')
341
-
342
- const option = list.querySelector('ui-list-item[data-option="delete"]') as UiListItem
343
- option.click()
344
-
345
- await element.updateComplete
346
-
347
- assert.isUndefined(element.model[0].condition)
348
- })
349
- })
350
-
351
- describe('Working with actions', () => {
352
- let element: HttpFlows
353
-
354
- beforeEach(async () => {
355
- element = await emptyResponseFlowFixture()
356
- })
357
-
358
- afterEach(async () => {
359
- await resetMouse()
360
- })
361
-
362
- it('drops the action onto the editor', async () => {
363
- const chip = element.shadowRoot!.querySelector(`ui-chip[data-kind="Core#Action"]`) as UiChip
364
-
365
- const target = element.shadowRoot!.querySelector(`.editor`) as HTMLElement
366
- await UiMock.dragAndDrop(chip, target)
367
- await element.updateComplete
368
-
369
- const { actions } = element.model[0]
370
- assert.lengthOf(actions, 1, 'has the action')
371
- const [a1] = actions
372
- assert.deepEqual(a1.steps, [], 'actions steps are empty')
373
- })
374
-
375
- it('renders the action UI', async () => {
376
- element.addAction()
377
- await element.updateComplete
378
-
379
- const block = element.shadowRoot!.querySelector('.step-row')!
380
- assert.ok(block, 'has the action block')
381
-
382
- const label = block.querySelector('.action-tab > span')!
383
- assert.ok(label, 'has the label')
384
- assert.equal(label.textContent!.trim(), 'Action 1', 'the label has the text value')
385
- })
386
-
387
- it('renders the action dropdown menu', async () => {
388
- element.addAction()
389
- await element.updateComplete
390
-
391
- const block = element.shadowRoot!.querySelector('.step-row')!
392
- assert.ok(block, 'has the action block')
393
-
394
- const list = block.querySelector('.action-tab > ui-dropdown-list')!
395
- assert.ok(list, 'has the dropdown')
396
-
397
- const trigger = list.querySelector('.action-options-trigger')!
398
- assert.ok(trigger, 'has the dropdown trigger')
399
- assert.equal(trigger.localName, 'ui-icon-button', 'the dropdown trigger is the icon button')
400
-
401
- const listItems = Array.from(list.querySelectorAll('ui-list-item'))
402
- assert.lengthOf(listItems, 2, 'has all dropdown options')
403
-
404
- const [o1, o2] = listItems
405
- assert.equal(o1.dataset.option, 'rename', 'has the remove item')
406
- assert.equal(o1.textContent!.trim(), 'Rename', 'the remove item has the text value')
407
- assert.equal(o2.dataset.option, 'delete', 'has the remove item')
408
- assert.equal(o2.textContent!.trim(), 'Remove', 'the remove item has the text value')
409
- })
410
-
411
- it('removes the action from the dropdown option', async () => {
412
- element.addAction()
413
- await element.updateComplete
414
-
415
- const list = element.shadowRoot!.querySelector('.step-row .action-tab > ui-dropdown-list')!
416
- assert.ok(list, 'has the dropdown')
417
-
418
- const option = list.querySelector('ui-list-item[data-option="delete"]') as UiListItem
419
- option.click()
420
-
421
- await element.updateComplete
422
-
423
- assert.deepEqual(element.model[0].actions, [])
424
- })
425
-
426
- it('drops data-source group onto the action', async () => {
427
- element.addAction()
428
- await element.updateComplete
429
-
430
- const chip = element.shadowRoot!.querySelector(
431
- `ui-chip[data-kind="${DataSteps.ReadDataSourceStepKind}"][data-data="${FlowResponseDataEnum.status}"]`
432
- ) as UiChip
433
- const target = element.shadowRoot!.querySelector(`.action-row .steps`) as HTMLElement
434
-
435
- await UiMock.dragAndDrop(chip, target)
436
- await element.updateComplete
437
- const action = element.model[0].actions[0]
438
- assert.lengthOf(action.steps, 1, 'the action has the step')
439
-
440
- const step = action.steps[0] as DataSteps.IReadDataSourceStep
441
-
442
- assert.equal(step.kind, DataSteps.ReadDataSourceStepKind, 'has the kind')
443
- assert.equal(step.source, FlowSourceEnum.response, 'has the source')
444
- assert.equal(step.data, FlowResponseDataEnum.status, 'has the data')
445
-
446
- const unit = target.querySelector('.step-unit')!
447
- assert.ok(unit, 'renders the step container')
448
- const spacer = unit.querySelector('.drop-target.spacer')!
449
- assert.ok(spacer, 'renders the drop target')
450
- const pill = unit.querySelector('.step-pill')!
451
- assert.ok(pill, 'renders the data pill')
452
- assert.equal(pill.textContent?.trim(), 'Status code', 'renders the data pill value')
453
- assert.isTrue(spacer.nextElementSibling === pill, 'render the drop target before the pill')
454
- })
455
-
456
- it('drops transformation group onto the action', async () => {
457
- element.addAction()
458
- await element.updateComplete
459
-
460
- const chip = element.shadowRoot!.querySelector(
461
- `ui-chip[data-kind="${DataSteps.ReadValueStepKind}"]`
462
- ) as UiChip
463
- const target = element.shadowRoot!.querySelector(`.action-row .steps`) as HTMLElement
464
-
465
- await UiMock.dragAndDrop(chip, target)
466
- await element.updateComplete
467
- const action = element.model[0].actions[0]
468
- assert.lengthOf(action.steps, 1, 'the action has the step')
469
-
470
- const step = action.steps[0] as DataSteps.IReadValueStep
471
- assert.equal(step.kind, DataSteps.ReadValueStepKind, 'has the kind')
472
-
473
- const unit = target.querySelector('.step-unit')!
474
- assert.ok(unit, 'renders the step container')
475
- const spacer = unit.querySelector('.drop-target.spacer')!
476
- assert.ok(spacer, 'renders the drop target')
477
- const pill = unit.querySelector('.step-pill')!
478
- assert.ok(pill, 'renders the data pill')
479
- assert.equal(pill.textContent?.trim(), 'Read value', 'renders the data pill value')
480
- assert.isTrue(spacer.nextElementSibling === pill, 'render the drop target before the pill')
481
- const input = unit.querySelector('ui-filled-text-field') as Input
482
- assert.ok(input, 'renders the path input')
483
- })
484
-
485
- it('does not allow assertion group onto the action', async () => {
486
- element.addAction()
487
- await element.updateComplete
488
-
489
- const chip = element.shadowRoot!.querySelector(
490
- `ui-chip[data-kind="${CoreAssertions.EqualAssertionKind}"]`
491
- ) as UiChip
492
- const target = element.shadowRoot!.querySelector(`.action-row .steps`) as HTMLElement
493
-
494
- await UiMock.dragAndDrop(chip, target)
495
- await element.updateComplete
496
- const action = element.model[0].actions[0]
497
- assert.lengthOf(action.steps, 0, 'has no steps')
498
- })
499
- })
500
- })
501
- })
502
- })