jsf.js_next_gen 4.1.0-beta.2 → 4.1.0-beta.21

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 (413) hide show
  1. package/AI_CONTRIBUTIONS.md +71 -0
  2. package/README.md +254 -78
  3. package/api-extractor.faces.json +38 -0
  4. package/dist/docs/assets/hierarchy.js +1 -1
  5. package/dist/docs/assets/navigation.js +1 -1
  6. package/dist/docs/assets/search.js +1 -1
  7. package/dist/docs/functions/faces.ajax.addOnError.html +2 -2
  8. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -2
  9. package/dist/docs/functions/faces.ajax.request.html +2 -2
  10. package/dist/docs/functions/faces.ajax.response.html +2 -2
  11. package/dist/docs/functions/faces.getClientWindow.html +2 -2
  12. package/dist/docs/functions/faces.getProjectStage.html +2 -2
  13. package/dist/docs/functions/faces.getViewState.html +1 -1
  14. package/dist/docs/functions/faces.push.close.html +1 -1
  15. package/dist/docs/functions/faces.push.init.html +6 -6
  16. package/dist/docs/functions/faces.push.open.html +1 -1
  17. package/dist/docs/functions/faces.util.chain.html +2 -2
  18. package/dist/docs/functions/myfaces.ab.html +3 -3
  19. package/dist/docs/functions/myfaces.onDomReady.html +1 -1
  20. package/dist/docs/functions/myfaces.reserveNamespace.html +1 -1
  21. package/dist/docs/hierarchy.html +1 -1
  22. package/dist/docs/index.html +292 -71
  23. package/dist/docs/interfaces/faces.AjaxData.html +6 -0
  24. package/dist/docs/interfaces/faces.AjaxError.html +18 -0
  25. package/dist/docs/interfaces/faces.AjaxEvent.html +8 -0
  26. package/dist/docs/interfaces/faces.ajax.RequestContext.html +6 -0
  27. package/dist/docs/interfaces/faces.ajax.RequestOptions.html +10 -0
  28. package/dist/docs/modules/faces.ajax.html +1 -1
  29. package/dist/docs/modules/faces.html +1 -1
  30. package/dist/docs/modules/faces.push.html +1 -1
  31. package/dist/docs/modules/faces.util.html +1 -1
  32. package/dist/docs/modules/myfaces.html +1 -1
  33. package/dist/docs/modules.html +1 -1
  34. package/dist/docs/types/faces.AjaxErrorStatus.html +2 -0
  35. package/dist/docs/types/faces.AjaxEventStatus.html +2 -0
  36. package/dist/docs/types/faces.ProjectStage.html +2 -0
  37. package/dist/docs/types/faces.ajax.OnErrorCallback.html +2 -0
  38. package/dist/docs/types/faces.ajax.OnEventCallback.html +2 -0
  39. package/dist/docs/types/faces.push.OnCloseHandler.html +2 -0
  40. package/dist/docs/types/faces.push.OnErrorHandler.html +2 -0
  41. package/dist/docs/types/faces.push.OnMessageHandler.html +2 -0
  42. package/dist/docs/types/faces.push.OnOpenHandler.html +2 -0
  43. package/dist/docs/variables/faces.contextpath.html +1 -1
  44. package/dist/docs/variables/faces.implversion.html +1 -1
  45. package/dist/docs/variables/faces.separatorchar.html +1 -1
  46. package/dist/docs/variables/faces.specversion.html +1 -1
  47. package/dist/docs/variables/myfaces.oam.html +1 -1
  48. package/dist/window/faces-development.js +1801 -499
  49. package/dist/window/faces-development.js.map +1 -1
  50. package/{target/api/_api.js → dist/window/faces.d.ts} +124 -151
  51. package/dist/window/faces.js +1 -1
  52. package/dist/window/faces.js.LICENSE.txt +0 -17
  53. package/dist/window/faces.js.map +1 -1
  54. package/dist/window/jsf-development.js +1806 -513
  55. package/dist/window/jsf-development.js.map +1 -1
  56. package/{target/src/main/typescript/api/_api.js → dist/window/jsf.d.ts} +125 -153
  57. package/dist/window/jsf.js +1 -1
  58. package/dist/window/jsf.js.LICENSE.txt +0 -17
  59. package/dist/window/jsf.js.map +1 -1
  60. package/package.json +22 -18
  61. package/scripts/build-dts.mjs +239 -0
  62. package/src/main/typescript/@types/definitions/index.d.ts +22 -122
  63. package/{target/test/frameworkBase/_ext/monadish/fixtures/test2.js → src/main/typescript/@types/definitions/modules.d.ts} +18 -2
  64. package/src/main/typescript/api/_api.ts +132 -29
  65. package/{target/test/frameworkBase/_ext/monadish/fixtures/test.js → src/main/typescript/api/_api_ae_stub.d.ts} +6 -2
  66. package/src/main/typescript/api/faces.ts +2 -2
  67. package/src/main/typescript/api/jsf.ts +15 -23
  68. package/src/main/typescript/impl/AjaxImpl.ts +15 -15
  69. package/src/main/typescript/impl/PushImpl.ts +139 -69
  70. package/src/main/typescript/impl/core/Const.ts +2 -2
  71. package/src/main/typescript/impl/i18n/Messages.ts +1 -1
  72. package/src/main/typescript/impl/util/Assertions.ts +1 -2
  73. package/src/main/typescript/impl/util/AsyncRunnable.ts +3 -4
  74. package/src/main/typescript/impl/util/ExtDomQuery.ts +19 -19
  75. package/src/main/typescript/impl/util/FileUtils.ts +30 -14
  76. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +34 -34
  77. package/src/main/typescript/impl/util/Lang.ts +19 -22
  78. package/src/main/typescript/impl/util/XhrQueueController.ts +25 -3
  79. package/src/main/typescript/impl/xhrCore/ErrorData.ts +17 -12
  80. package/src/main/typescript/impl/xhrCore/EventData.ts +8 -7
  81. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +3 -3
  82. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +7 -6
  83. package/src/main/typescript/impl/xhrCore/Response.ts +3 -3
  84. package/src/main/typescript/impl/xhrCore/ResponseDataResolver.ts +0 -38
  85. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +17 -15
  86. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +72 -63
  87. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -134
  88. package/src/main/typescript/mona_dish_shim.ts +6 -2
  89. package/src/main/typescript/myfaces/OamSubmit.ts +10 -6
  90. package/src/main/typescript/test/api/JsfPushShimTest.spec.ts +126 -0
  91. package/src/main/typescript/test/api/MyFacesABTest.spec.ts +16 -0
  92. package/src/main/typescript/test/api/PushTypeCompatibility.ts +65 -0
  93. package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +16 -0
  94. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -0
  95. package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +16 -0
  96. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +16 -0
  97. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +16 -0
  98. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +55 -9
  99. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +16 -0
  100. package/src/main/typescript/test/impl/AssertionsTest.spec.ts +168 -0
  101. package/src/main/typescript/test/impl/FileUtilsTest.spec.ts +126 -0
  102. package/src/main/typescript/test/impl/ImplTest.spec.ts +75 -1
  103. package/src/main/typescript/test/impl/ResponseDataResolverTest.spec.ts +62 -0
  104. package/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.ts +91 -1
  105. package/src/main/typescript/test/impl/util/ExtLangTest.spec.ts +110 -0
  106. package/src/main/typescript/test/impl/util/HiddenInputBuilderTest.spec.ts +74 -0
  107. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +61 -1
  108. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +191 -2
  109. package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +16 -0
  110. package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +14 -0
  111. package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +21 -5
  112. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +363 -4
  113. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +218 -4
  114. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +1 -1
  115. package/src/main/typescript/test/xhrCore/WebsocketTest.spec.ts +764 -0
  116. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +265 -62
  117. package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +16 -0
  118. package/{target/src/main/typescript/test/xhrCore/FakeWebsocket.js → src/main/typescript/tsconfig.ae.json} +16 -23
  119. package/src/main/typescript/{tsconfig.json → tsconfig.dts.json} +11 -27
  120. package/src/main/typescript/tsconfig.test.json +17 -0
  121. package/tsconfig.api-extractor.json +17 -0
  122. package/.claude/settings.local.json +0 -16
  123. package/.github/workflows/codeql-analysis.yml +0 -83
  124. package/.github/workflows/nodejs.yml +0 -26
  125. package/.mocharc.json +0 -10
  126. package/.nyc_output/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
  127. package/.nyc_output/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
  128. package/.nyc_output/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
  129. package/.nyc_output/processinfo/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
  130. package/.nyc_output/processinfo/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
  131. package/.nyc_output/processinfo/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
  132. package/.nyc_output/processinfo/index.json +0 -1
  133. package/.nycrc +0 -6
  134. package/build.cmd +0 -1
  135. package/build.sh +0 -3
  136. package/mvnw +0 -286
  137. package/mvnw.cmd +0 -161
  138. package/plans for 4.0.1.txt +0 -8
  139. package/remap.ts +0 -51
  140. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +0 -221
  141. package/target/api/_api.js.map +0 -1
  142. package/target/api/faces.js +0 -45
  143. package/target/api/faces.js.map +0 -1
  144. package/target/api/jsf.js +0 -56
  145. package/target/api/jsf.js.map +0 -1
  146. package/target/impl/AjaxImpl.js +0 -748
  147. package/target/impl/AjaxImpl.js.map +0 -1
  148. package/target/impl/PushImpl.js +0 -265
  149. package/target/impl/PushImpl.js.map +0 -1
  150. package/target/impl/core/Const.js +0 -177
  151. package/target/impl/core/Const.js.map +0 -1
  152. package/target/impl/core/ImplTypes.js +0 -38
  153. package/target/impl/core/ImplTypes.js.map +0 -1
  154. package/target/impl/i18n/Messages.js +0 -113
  155. package/target/impl/i18n/Messages.js.map +0 -1
  156. package/target/impl/util/Assertions.js +0 -101
  157. package/target/impl/util/Assertions.js.map +0 -1
  158. package/target/impl/util/AsyncRunnable.js +0 -78
  159. package/target/impl/util/AsyncRunnable.js.map +0 -1
  160. package/target/impl/util/ExtDomQuery.js +0 -306
  161. package/target/impl/util/ExtDomQuery.js.map +0 -1
  162. package/target/impl/util/FileUtils.js +0 -98
  163. package/target/impl/util/FileUtils.js.map +0 -1
  164. package/target/impl/util/HiddenInputBuilder.js +0 -83
  165. package/target/impl/util/HiddenInputBuilder.js.map +0 -1
  166. package/target/impl/util/IListener.js +0 -3
  167. package/target/impl/util/IListener.js.map +0 -1
  168. package/target/impl/util/Lang.js +0 -263
  169. package/target/impl/util/Lang.js.map +0 -1
  170. package/target/impl/util/XhrQueueController.js +0 -92
  171. package/target/impl/util/XhrQueueController.js.map +0 -1
  172. package/target/impl/xhrCore/ErrorData.js +0 -87
  173. package/target/impl/xhrCore/ErrorData.js.map +0 -1
  174. package/target/impl/xhrCore/EventData.js +0 -52
  175. package/target/impl/xhrCore/EventData.js.map +0 -1
  176. package/target/impl/xhrCore/IResponseProcessor.js +0 -3
  177. package/target/impl/xhrCore/IResponseProcessor.js.map +0 -1
  178. package/target/impl/xhrCore/RequestDataResolver.js +0 -186
  179. package/target/impl/xhrCore/RequestDataResolver.js.map +0 -1
  180. package/target/impl/xhrCore/ResonseDataResolver.js +0 -104
  181. package/target/impl/xhrCore/ResonseDataResolver.js.map +0 -1
  182. package/target/impl/xhrCore/Response.js +0 -186
  183. package/target/impl/xhrCore/Response.js.map +0 -1
  184. package/target/impl/xhrCore/ResponseDataResolver.js +0 -104
  185. package/target/impl/xhrCore/ResponseDataResolver.js.map +0 -1
  186. package/target/impl/xhrCore/ResponseProcessor.js +0 -468
  187. package/target/impl/xhrCore/ResponseProcessor.js.map +0 -1
  188. package/target/impl/xhrCore/XhrFormData.js +0 -163
  189. package/target/impl/xhrCore/XhrFormData.js.map +0 -1
  190. package/target/impl/xhrCore/XhrRequest.js +0 -433
  191. package/target/impl/xhrCore/XhrRequest.js.map +0 -1
  192. package/target/mona_dish_shim.js +0 -70
  193. package/target/mona_dish_shim.js.map +0 -1
  194. package/target/myfaces/OamSubmit.js +0 -128
  195. package/target/myfaces/OamSubmit.js.map +0 -1
  196. package/target/src/main/typescript/api/_api.js.map +0 -1
  197. package/target/src/main/typescript/api/faces.js +0 -45
  198. package/target/src/main/typescript/api/faces.js.map +0 -1
  199. package/target/src/main/typescript/api/jsf.js +0 -56
  200. package/target/src/main/typescript/api/jsf.js.map +0 -1
  201. package/target/src/main/typescript/impl/AjaxImpl.js +0 -748
  202. package/target/src/main/typescript/impl/AjaxImpl.js.map +0 -1
  203. package/target/src/main/typescript/impl/PushImpl.js +0 -265
  204. package/target/src/main/typescript/impl/PushImpl.js.map +0 -1
  205. package/target/src/main/typescript/impl/core/Const.js +0 -177
  206. package/target/src/main/typescript/impl/core/Const.js.map +0 -1
  207. package/target/src/main/typescript/impl/core/ImplTypes.js +0 -38
  208. package/target/src/main/typescript/impl/core/ImplTypes.js.map +0 -1
  209. package/target/src/main/typescript/impl/i18n/Messages.js +0 -113
  210. package/target/src/main/typescript/impl/i18n/Messages.js.map +0 -1
  211. package/target/src/main/typescript/impl/util/Assertions.js +0 -101
  212. package/target/src/main/typescript/impl/util/Assertions.js.map +0 -1
  213. package/target/src/main/typescript/impl/util/AsyncRunnable.js +0 -78
  214. package/target/src/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
  215. package/target/src/main/typescript/impl/util/ExtDomQuery.js +0 -306
  216. package/target/src/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
  217. package/target/src/main/typescript/impl/util/FileUtils.js +0 -98
  218. package/target/src/main/typescript/impl/util/FileUtils.js.map +0 -1
  219. package/target/src/main/typescript/impl/util/HiddenInputBuilder.js +0 -83
  220. package/target/src/main/typescript/impl/util/HiddenInputBuilder.js.map +0 -1
  221. package/target/src/main/typescript/impl/util/IListener.js +0 -3
  222. package/target/src/main/typescript/impl/util/IListener.js.map +0 -1
  223. package/target/src/main/typescript/impl/util/Lang.js +0 -263
  224. package/target/src/main/typescript/impl/util/Lang.js.map +0 -1
  225. package/target/src/main/typescript/impl/util/XhrQueueController.js +0 -92
  226. package/target/src/main/typescript/impl/util/XhrQueueController.js.map +0 -1
  227. package/target/src/main/typescript/impl/xhrCore/ErrorData.js +0 -87
  228. package/target/src/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
  229. package/target/src/main/typescript/impl/xhrCore/EventData.js +0 -52
  230. package/target/src/main/typescript/impl/xhrCore/EventData.js.map +0 -1
  231. package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
  232. package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
  233. package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -186
  234. package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
  235. package/target/src/main/typescript/impl/xhrCore/Response.js +0 -186
  236. package/target/src/main/typescript/impl/xhrCore/Response.js.map +0 -1
  237. package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js +0 -104
  238. package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js.map +0 -1
  239. package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -468
  240. package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
  241. package/target/src/main/typescript/impl/xhrCore/XhrFormData.js +0 -163
  242. package/target/src/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
  243. package/target/src/main/typescript/impl/xhrCore/XhrRequest.js +0 -433
  244. package/target/src/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
  245. package/target/src/main/typescript/mona_dish_shim.js +0 -70
  246. package/target/src/main/typescript/mona_dish_shim.js.map +0 -1
  247. package/target/src/main/typescript/myfaces/OamSubmit.js +0 -128
  248. package/target/src/main/typescript/myfaces/OamSubmit.js.map +0 -1
  249. package/target/src/main/typescript/test/api/MyFacesABTest.spec.js +0 -117
  250. package/target/src/main/typescript/test/api/MyFacesABTest.spec.js.map +0 -1
  251. package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js +0 -123
  252. package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js.map +0 -1
  253. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
  254. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
  255. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
  256. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
  257. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
  258. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  259. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
  260. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
  261. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
  262. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
  263. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -2
  264. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
  265. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
  266. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
  267. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
  268. package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
  269. package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
  270. package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  271. package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
  272. package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  273. package/target/src/main/typescript/test/impl/ImplTest.spec.js +0 -225
  274. package/target/src/main/typescript/test/impl/ImplTest.spec.js.map +0 -1
  275. package/target/src/main/typescript/test/impl/ImplTest_23.spec.js +0 -143
  276. package/target/src/main/typescript/test/impl/ImplTest_23.spec.js.map +0 -1
  277. package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js +0 -106
  278. package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js.map +0 -1
  279. package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js +0 -77
  280. package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
  281. package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js +0 -118
  282. package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js.map +0 -1
  283. package/target/src/main/typescript/test/myfaces/OnLoad.spec.js +0 -57
  284. package/target/src/main/typescript/test/myfaces/OnLoad.spec.js.map +0 -1
  285. package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js +0 -60
  286. package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js.map +0 -1
  287. package/target/src/main/typescript/test/queue/AsynchronousProbe.js +0 -93
  288. package/target/src/main/typescript/test/queue/AsynchronousProbe.js.map +0 -1
  289. package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js +0 -133
  290. package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
  291. package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js +0 -101
  292. package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js.map +0 -1
  293. package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js +0 -175
  294. package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
  295. package/target/src/main/typescript/test/xhrCore/EventTests.spec.js +0 -184
  296. package/target/src/main/typescript/test/xhrCore/EventTests.spec.js.map +0 -1
  297. package/target/src/main/typescript/test/xhrCore/FakeWebsocket.js.map +0 -1
  298. package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js +0 -181
  299. package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js.map +0 -1
  300. package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
  301. package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
  302. package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js +0 -199
  303. package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
  304. package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js +0 -567
  305. package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
  306. package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js +0 -845
  307. package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js.map +0 -1
  308. package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js +0 -382
  309. package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js.map +0 -1
  310. package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js +0 -667
  311. package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js.map +0 -1
  312. package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js +0 -367
  313. package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js.map +0 -1
  314. package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js +0 -123
  315. package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
  316. package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
  317. package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
  318. package/target/src/main/typescript/test/xhrCore/WebsocketTest.js +0 -207
  319. package/target/src/main/typescript/test/xhrCore/WebsocketTest.js.map +0 -1
  320. package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js +0 -149
  321. package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
  322. package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js +0 -130
  323. package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
  324. package/target/test/api/MyFacesABTest.spec.js +0 -117
  325. package/target/test/api/MyFacesABTest.spec.js.map +0 -1
  326. package/target/test/frameworkBase/LangTest.spec.js +0 -123
  327. package/target/test/frameworkBase/LangTest.spec.js.map +0 -1
  328. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
  329. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
  330. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
  331. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
  332. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
  333. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
  334. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
  335. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
  336. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
  337. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
  338. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -1
  339. package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
  340. package/target/test/frameworkBase/_ext/monadish/fixtures/test.js.map +0 -1
  341. package/target/test/frameworkBase/_ext/monadish/fixtures/test2.js.map +0 -1
  342. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
  343. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
  344. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
  345. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
  346. package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
  347. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
  348. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
  349. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
  350. package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +0 -16
  351. package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js.map +0 -1
  352. package/target/test/impl/ImplTest.spec.js +0 -225
  353. package/target/test/impl/ImplTest.spec.js.map +0 -1
  354. package/target/test/impl/ImplTest_23.spec.js +0 -143
  355. package/target/test/impl/ImplTest_23.spec.js.map +0 -1
  356. package/target/test/impl/SeparatorCharsTest.spec.js +0 -106
  357. package/target/test/impl/SeparatorCharsTest.spec.js.map +0 -1
  358. package/target/test/impl/util/ExtDomQueryTest.spec.js +0 -77
  359. package/target/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
  360. package/target/test/myfaces/OamSubmit.spec.js +0 -118
  361. package/target/test/myfaces/OamSubmit.spec.js.map +0 -1
  362. package/target/test/myfaces/OnLoad.spec.js +0 -57
  363. package/target/test/myfaces/OnLoad.spec.js.map +0 -1
  364. package/target/test/myfaces/ReserveNamespace.spec.js +0 -60
  365. package/target/test/myfaces/ReserveNamespace.spec.js.map +0 -1
  366. package/target/test/queue/AsynchronousProbe.js +0 -93
  367. package/target/test/queue/AsynchronousProbe.js.map +0 -1
  368. package/target/test/queue/AsynchronousQueueTest.spec.js +0 -133
  369. package/target/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
  370. package/target/test/xhrCore/ClientWindow.spec.js +0 -101
  371. package/target/test/xhrCore/ClientWindow.spec.js.map +0 -1
  372. package/target/test/xhrCore/ErrorChainTest.spec.js +0 -175
  373. package/target/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
  374. package/target/test/xhrCore/EventTests.spec.js +0 -184
  375. package/target/test/xhrCore/EventTests.spec.js.map +0 -1
  376. package/target/test/xhrCore/FakeWebsocket.js +0 -38
  377. package/target/test/xhrCore/FakeWebsocket.js.map +0 -1
  378. package/target/test/xhrCore/FileUploadTest.spec.js +0 -181
  379. package/target/test/xhrCore/FileUploadTest.spec.js.map +0 -1
  380. package/target/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
  381. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
  382. package/target/test/xhrCore/OamSubmitTest.spec.js +0 -199
  383. package/target/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
  384. package/target/test/xhrCore/RequestParamsTest.spec.js +0 -567
  385. package/target/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
  386. package/target/test/xhrCore/RequestTest.spec.js +0 -845
  387. package/target/test/xhrCore/RequestTest.spec.js.map +0 -1
  388. package/target/test/xhrCore/RequestTest_23.spec.js +0 -382
  389. package/target/test/xhrCore/RequestTest_23.spec.js.map +0 -1
  390. package/target/test/xhrCore/ResponseTest.spec.js +0 -667
  391. package/target/test/xhrCore/ResponseTest.spec.js.map +0 -1
  392. package/target/test/xhrCore/ResponseTest23.spec.js +0 -367
  393. package/target/test/xhrCore/ResponseTest23.spec.js.map +0 -1
  394. package/target/test/xhrCore/ShadowDomTest.spec.js +0 -123
  395. package/target/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
  396. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
  397. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
  398. package/target/test/xhrCore/WebsocketTest.js +0 -207
  399. package/target/test/xhrCore/WebsocketTest.js.map +0 -1
  400. package/target/test/xhrCore/XhrFormDataTest.spec.js +0 -149
  401. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
  402. package/target/test/xhrCore/XhrRequestProgress.spec.js +0 -130
  403. package/target/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
  404. package/target/test/xhrCore/fixtures/addedViewHead1.js +0 -17
  405. package/target/test/xhrCore/fixtures/addedViewHead1.js.map +0 -1
  406. package/target/test/xhrCore/fixtures/addedViewHead2.js +0 -17
  407. package/target/test/xhrCore/fixtures/addedViewHead2.js.map +0 -1
  408. package/target/test/xhrCore/fixtures/addedViewHead3.js +0 -17
  409. package/target/test/xhrCore/fixtures/addedViewHead3.js.map +0 -1
  410. package/target/test/xhrCore/fixtures/nonce_script.js +0 -17
  411. package/target/test/xhrCore/fixtures/nonce_script.js.map +0 -1
  412. package/tsconfig.json +0 -9
  413. package/webpack.config.ts +0 -54
@@ -0,0 +1,126 @@
1
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // AI-generated: this file was created with assistance from Claude (Anthropic) — see AI_CONTRIBUTIONS.md
17
+ import {describe, it} from "mocha";
18
+ import {expect} from "chai";
19
+ import {Config} from "mona-dish";
20
+ import {decodeEncodedValues, encodeFormData, fixEmptyParameters} from "../../impl/util/FileUtils";
21
+ import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
22
+ import {Implementation} from "../../impl/AjaxImpl";
23
+
24
+ const defaultMyFaces = StandardInits.defaultMyFaces;
25
+
26
+ // Pure functions — no DOM required.
27
+ describe("decodeEncodedValues", () => {
28
+
29
+ it("decodes a single key=value pair", () => {
30
+ expect(decodeEncodedValues("foo=bar")).to.deep.eq([["foo", "bar"]]);
31
+ });
32
+
33
+ it("splits multiple pairs on &", () => {
34
+ expect(decodeEncodedValues("a=1&b=2")).to.deep.eq([["a", "1"], ["b", "2"]]);
35
+ });
36
+
37
+ it("returns a one-element array for a key-only segment (no =)", () => {
38
+ expect(decodeEncodedValues("keyonly")).to.deep.eq([["keyonly"]]);
39
+ });
40
+
41
+ it("decodes percent-encoded characters in key and value", () => {
42
+ // %20 = space, %21 = !; the & between pairs is literal so both segments are decoded
43
+ expect(decodeEncodedValues("hello%20world=test%21&a=b"))
44
+ .to.deep.eq([["hello world", "test!"], ["a", "b"]]);
45
+ });
46
+
47
+ it("splits only on the first = so values containing = are preserved", () => {
48
+ expect(decodeEncodedValues("key=val=ue")).to.deep.eq([["key", "val=ue"]]);
49
+ });
50
+
51
+ it("filters out blank and whitespace-only segments", () => {
52
+ expect(decodeEncodedValues("a=1& &b=2")).to.deep.eq([["a", "1"], ["b", "2"]]);
53
+ });
54
+
55
+ it("returns an empty array for an empty string", () => {
56
+ expect(decodeEncodedValues("")).to.deep.eq([]);
57
+ });
58
+ });
59
+
60
+ describe("fixEmptyParameters", () => {
61
+
62
+ it("fills both slots with empty arrays when the input is empty", () => {
63
+ expect(fixEmptyParameters([])).to.deep.eq([[], []]);
64
+ });
65
+
66
+ it("fills the second slot with an empty array when only a key is present", () => {
67
+ expect(fixEmptyParameters(["key"])).to.deep.eq(["key", []]);
68
+ });
69
+
70
+ it("passes through a two-element array unchanged", () => {
71
+ expect(fixEmptyParameters(["key", "val"])).to.deep.eq(["key", "val"]);
72
+ });
73
+
74
+ it("passes through arrays of three or more elements unchanged", () => {
75
+ expect(fixEmptyParameters(["key", "val", "extra"])).to.deep.eq(["key", "val", "extra"]);
76
+ });
77
+ });
78
+
79
+ // encodeFormData accesses window.File via ExtDomQuery.global(), so JSDOM is required.
80
+ describe("encodeFormData", () => {
81
+
82
+ beforeEach(async function () {
83
+ return defaultMyFaces().then((close) => {
84
+ this.closeIt = () => { Implementation.reset(); close(); };
85
+ });
86
+ });
87
+
88
+ afterEach(function () {
89
+ this.closeIt();
90
+ });
91
+
92
+ it("returns the defaultStr when the config is absent", () => {
93
+ expect(encodeFormData(new Config(null), undefined, "FALLBACK")).to.eq("FALLBACK");
94
+ });
95
+
96
+ it("returns empty string as default when no defaultStr is supplied and config is absent", () => {
97
+ expect(encodeFormData(new Config(null))).to.eq("");
98
+ });
99
+
100
+ it("encodes a single key-value pair", () => {
101
+ const config = new Config({name: ["Alice"]});
102
+ expect(encodeFormData(config)).to.eq("name=Alice");
103
+ });
104
+
105
+ it("encodes multiple values for one key as separate params", () => {
106
+ const config = new Config({color: ["red", "blue"]});
107
+ expect(encodeFormData(config)).to.eq("color=red&color=blue");
108
+ });
109
+
110
+ it("percent-encodes special characters in keys and values", () => {
111
+ const config = new Config({"a b": ["x=y"]});
112
+ expect(encodeFormData(config)).to.eq("a%20b=x%3Dy");
113
+ });
114
+
115
+ it("applies the paramsMapper to rename keys before encoding", () => {
116
+ const config = new Config({originalKey: ["value"]});
117
+ const mapper = (_key: string, val: any) => ["renamedKey", val];
118
+ expect(encodeFormData(config, mapper)).to.eq("renamedKey=value");
119
+ });
120
+
121
+ it("filters out File instances from the encoded output", () => {
122
+ const file = new (window as any).File(["content"], "upload.txt");
123
+ const config = new Config({text: ["hello"], upload: [file]});
124
+ expect(encodeFormData(config)).to.eq("text=hello");
125
+ });
126
+ });
@@ -20,7 +20,8 @@ import {expect} from 'chai';
20
20
  import * as sinon from 'sinon';
21
21
 
22
22
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
23
- import {CTX_PARAM_REQ_PASS_THR, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
23
+ import {CTX_PARAM_REQ_PASS_THR, IDENT_NONE, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
24
+ import {StateHolder} from "../../impl/core/ImplTypes";
24
25
  const defaultMyFaces = StandardInits.defaultMyFaces;
25
26
  import {_Es2019Array} from "mona-dish";
26
27
 
@@ -170,6 +171,22 @@ describe('faces.ajax.request test suite', () => {
170
171
 
171
172
  })
172
173
 
174
+ it("execute @none must delete P_EXECUTE from the request pass-through context", () => {
175
+ const addRequestToQueue = sinon.stub(Implementation.queueHandler, "addRequestToQueue");
176
+ try {
177
+ DomQuery.byId("input_2").addEventListener("click", (event: Event) => {
178
+ faces.ajax.request(null, event, {execute: IDENT_NONE, render: IDENT_NONE});
179
+ }).click();
180
+
181
+ expect(addRequestToQueue.called).to.be.true;
182
+ const context = addRequestToQueue.args[0][2] as Config;
183
+ // remapDefaultConstants must have deleted P_EXECUTE when execute="@none"
184
+ expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).isAbsent()).to.be.true;
185
+ } finally {
186
+ addRequestToQueue.restore();
187
+ }
188
+ });
189
+
173
190
  it("sidebehavior chain on undefined must not break the chain only a dedicated false does", function() {
174
191
  let called = {};
175
192
  window.called = called;
@@ -230,3 +247,60 @@ describe('faces.ajax.request test suite', () => {
230
247
  });
231
248
 
232
249
 
250
+ describe('AjaxImpl.getClientWindow differenceCheck', () => {
251
+ let oldFlatMap = null;
252
+
253
+ beforeEach(async () => {
254
+ return await StandardInits.defaultMyFaces().then(() => {
255
+ oldFlatMap = Array.prototype["flatMap"];
256
+ (window as any)["Es2019Array"] = _Es2019Array;
257
+ delete Array.prototype["flatMap"];
258
+ });
259
+ });
260
+
261
+ afterEach(() => {
262
+ if (oldFlatMap) {
263
+ Array.prototype["flatMap"] = oldFlatMap;
264
+ oldFlatMap = null;
265
+ }
266
+ });
267
+
268
+ it("must throw when two forms have different windowIds", () => {
269
+ document.body.innerHTML += `
270
+ <form id="form_wid_a">
271
+ <input type="hidden" name="jakarta.faces.ClientWindow" value="win1">
272
+ <input type="hidden" name="jakarta.faces.ViewState" value="vs1">
273
+ </form>
274
+ <form id="form_wid_b">
275
+ <input type="hidden" name="jakarta.faces.ClientWindow" value="win2">
276
+ <input type="hidden" name="jakarta.faces.ViewState" value="vs2">
277
+ </form>`;
278
+
279
+ expect(() => faces.getClientWindow(document.body)).to.throw();
280
+ });
281
+
282
+ it("must return the windowId when all forms agree", () => {
283
+ document.body.innerHTML = `
284
+ <form id="form_wid_ok">
285
+ <input type="hidden" name="jakarta.faces.ClientWindow" value="samewin">
286
+ <input type="hidden" name="jakarta.faces.ViewState" value="vs1">
287
+ </form>`;
288
+
289
+ const result = faces.getClientWindow(document.body);
290
+ expect(result).to.eq("samewin");
291
+ });
292
+ });
293
+
294
+ describe('StateHolder.hasNameSpace', () => {
295
+ it('returns false when id has no namespace prefix', () => {
296
+ const s = new StateHolder("jakarta.faces.ViewState", "val");
297
+ expect(s.hasNameSpace).to.be.false;
298
+ expect(s.nameSpace).to.eq("");
299
+ });
300
+
301
+ it('returns true when id has a namespace prefix', () => {
302
+ const s = new StateHolder("myForm:jakarta.faces.ViewState", "val");
303
+ expect(s.hasNameSpace).to.be.true;
304
+ expect(s.nameSpace).to.eq("myForm");
305
+ });
306
+ });
@@ -0,0 +1,62 @@
1
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // AI-generated: this file was created with assistance from Claude (Anthropic) — see AI_CONTRIBUTIONS.md
17
+ import {describe, it} from "mocha";
18
+ import {expect} from "chai";
19
+ import {resolveContexts} from "../../impl/xhrCore/ResponseDataResolver";
20
+ import {
21
+ CTX_PARAM_MF_INTERNAL,
22
+ DEFERRED_HEAD_INSERTS,
23
+ UPDATE_ELEMS,
24
+ UPDATE_FORMS
25
+ } from "../../impl/core/Const";
26
+
27
+ describe("resolveContexts", () => {
28
+
29
+ it("creates a fresh internal context when none is present in the external context", () => {
30
+ const {externalContext, internalContext} = resolveContexts({});
31
+
32
+ expect(internalContext.isPresent(),
33
+ "internalContext must be present even when none was supplied").to.be.true;
34
+ expect(internalContext.getIf(DEFERRED_HEAD_INSERTS).value,
35
+ "DEFERRED_HEAD_INSERTS must be initialised to an empty array").to.deep.eq([]);
36
+ expect(internalContext.getIf(UPDATE_FORMS).value,
37
+ "UPDATE_FORMS must be initialised to an empty array").to.deep.eq([]);
38
+ expect(internalContext.getIf(UPDATE_ELEMS).value,
39
+ "UPDATE_ELEMS must be initialised to an empty array").to.deep.eq([]);
40
+ });
41
+
42
+ it("reuses the existing internal context when one is present in the external context", () => {
43
+ // assign/getIf in mona-dish treat dot-strings as flat keys, not nested paths.
44
+ // CTX_PARAM_MF_INTERNAL = "myfaces.internal" is stored as a literal flat key.
45
+ const context = {[CTX_PARAM_MF_INTERNAL]: {existingKey: "existingValue"}};
46
+ const {externalContext, internalContext} = resolveContexts(context);
47
+
48
+ expect(internalContext.getIf("existingKey").value,
49
+ "existing internal context values must be preserved").to.eq("existingValue");
50
+ expect(internalContext.getIf(DEFERRED_HEAD_INSERTS).value,
51
+ "DEFERRED_HEAD_INSERTS must be initialised even when reusing an existing context").to.deep.eq([]);
52
+ expect(internalContext.getIf(UPDATE_FORMS).value).to.deep.eq([]);
53
+ expect(internalContext.getIf(UPDATE_ELEMS).value).to.deep.eq([]);
54
+ });
55
+
56
+ it("wraps the original object as the external context", () => {
57
+ const context = {source: "button1"};
58
+ const {externalContext} = resolveContexts(context);
59
+
60
+ expect(externalContext.getIf("source").value).to.eq("button1");
61
+ });
62
+ });
@@ -17,10 +17,11 @@
17
17
  import {afterEach, describe, it} from 'mocha';
18
18
  import {expect} from 'chai';
19
19
 
20
- import {ExtDomQuery} from "../../../impl/util/ExtDomQuery";
20
+ import {ExtConfig, ExtDomQuery} from "../../../impl/util/ExtDomQuery";
21
21
  import {StandardInits} from "../../frameworkBase/_ext/shared/StandardInits";
22
22
  const defaultMyFaces = StandardInits.defaultMyFaces;
23
23
  import Sinon from "sinon";
24
+ import {Implementation} from "../../../impl/AjaxImpl";
24
25
 
25
26
  declare var faces: any;
26
27
  let oldProjectStage = null;
@@ -65,4 +66,93 @@ describe('ExtDomQuery test suite', () => {
65
66
  }
66
67
  done();
67
68
  });
69
+
70
+ it('ExtDomQuery.nonce falls back to finding nonce on a faces script tag in the DOM', () => {
71
+ const script = document.createElement("script");
72
+ // /javax.faces.resource/jsf.js matches IS_FACES_SOURCE pattern \/javax\.faces\.resource.*\/jsf\.js.*
73
+ script.setAttribute("src", "/javax.faces.resource/jsf.js");
74
+ script.setAttribute("nonce", "test-nonce-abc");
75
+ document.head.appendChild(script);
76
+ try {
77
+ const nonce = new ExtDomQuery(document.body).nonce;
78
+ expect(nonce.value).to.eq("test-nonce-abc");
79
+ } finally {
80
+ document.head.removeChild(script);
81
+ }
82
+ });
83
+
84
+ it('ExtDomQuery.runHeadInserts handles text nodes (no tagName) without throwing', () => {
85
+ const text = document.createTextNode("inline text");
86
+ expect(() => new ExtDomQuery(text as any).runHeadInserts()).not.to.throw();
87
+ });
88
+
89
+ it('runHeadInserts with suppressDoubleIncludes=false inserts duplicate link resources', () => {
90
+ const href = "/test-res-no-dedup.css";
91
+ const existing = document.createElement("link");
92
+ existing.setAttribute("href", href);
93
+ document.head.appendChild(existing);
94
+
95
+ const before = document.head.querySelectorAll(`link[href="${href}"]`).length;
96
+
97
+ const dup = document.createElement("link");
98
+ dup.setAttribute("href", href);
99
+ new ExtDomQuery(dup as any).runHeadInserts(false);
100
+
101
+ expect(document.head.querySelectorAll(`link[href="${href}"]`).length).to.be.gt(before);
102
+ });
103
+
104
+ it('runHeadInserts with suppressDoubleIncludes=true skips duplicate link resources', () => {
105
+ const href = "/test-res-with-dedup.css";
106
+ const existing = document.createElement("link");
107
+ existing.setAttribute("href", href);
108
+ document.head.appendChild(existing);
109
+
110
+ const before = document.head.querySelectorAll(`link[href="${href}"]`).length;
111
+
112
+ const dup = document.createElement("link");
113
+ dup.setAttribute("href", href);
114
+ new ExtDomQuery(dup as any).runHeadInserts(true);
115
+
116
+ expect(document.head.querySelectorAll(`link[href="${href}"]`).length).to.eq(before);
117
+ });
118
+ });
119
+
120
+ describe('ExtConfig', () => {
121
+ let closeIt: () => void;
122
+
123
+ beforeEach(async function () {
124
+ return defaultMyFaces().then((close) => {
125
+ closeIt = () => { Implementation.reset(); close(); };
126
+ });
127
+ });
128
+
129
+ afterEach(function () { closeIt(); });
130
+
131
+ it('append stores a value under the given key', () => {
132
+ const config = new ExtConfig({});
133
+ config.append("items").value = ["first"];
134
+ expect(config.getIf("items").value).to.deep.eq(["first"]);
135
+ });
136
+
137
+ it('appendIf stores a value when condition is true', () => {
138
+ const config = new ExtConfig({});
139
+ config.appendIf(true, "key").value = ["yes"];
140
+ expect(config.getIf("key").value).to.deep.eq(["yes"]);
141
+ });
142
+
143
+ it('appendIf is a no-op when condition is false', () => {
144
+ const config = new ExtConfig({existing: "val"});
145
+ config.appendIf(false, "existing");
146
+ expect(config.getIf("existing").value).to.eq("val");
147
+ });
148
+
149
+ it('deepCopy produces an independent copy', () => {
150
+ const config = new ExtConfig({name: "Alice"});
151
+ const copy = config.deepCopy;
152
+ expect(copy.getIf("name").value).to.eq("Alice");
153
+ // mutating the copy must not affect the original
154
+ copy.assign("name").value = "Bob";
155
+ expect(config.getIf("name").value).to.eq("Alice");
156
+ });
157
+
68
158
  });
@@ -0,0 +1,110 @@
1
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // AI-generated: this file was created with assistance from Claude (Anthropic) — see AI_CONTRIBUTIONS.md
17
+
18
+ import {describe} from "mocha";
19
+ import {expect} from "chai";
20
+ import * as sinon from "sinon";
21
+ import {Config} from "mona-dish";
22
+ import {ExtLang} from "../../../impl/util/Lang";
23
+ import {StandardInits} from "../../frameworkBase/_ext/shared/StandardInits";
24
+
25
+ describe("ExtLang", function () {
26
+
27
+ beforeEach(function () {
28
+ return StandardInits.defaultMyFaces().then((close) => {
29
+ this.closeIt = close;
30
+ });
31
+ });
32
+
33
+ afterEach(function () {
34
+ this.closeIt();
35
+ });
36
+
37
+ it("must resolve messages with default fallback and template replacement", function () {
38
+ expect(ExtLang.getMessage("missing.key", "Hello {0}", "World")).to.eq("Hello World");
39
+ expect(ExtLang.getMessage("missing.key")).to.eq("missing.key");
40
+ });
41
+
42
+ it("must return a message string when the key exists in Messages", function () {
43
+ // MSG_TEST is defined in Messages.ts as "Testmessage" — covers the left branch of ?? defaultMessage ?? key
44
+ expect(ExtLang.getMessage("MSG_TEST")).to.eq("Testmessage");
45
+ });
46
+
47
+ it("must read global and local myfaces config with local priority", function () {
48
+ window.myfaces.config = {...window.myfaces.config, delay: 50, timeout: 100};
49
+
50
+ expect(ExtLang.getGlobalConfig("delay", 0)).to.eq(50);
51
+ expect(ExtLang.getGlobalConfig("unknown", 7)).to.eq(7);
52
+
53
+ const localOptions = new Config({myfaces: {config: {delay: 10}}});
54
+
55
+ expect(ExtLang.getLocalOrGlobalConfig(localOptions, "delay", 0)).to.eq(10);
56
+ expect(ExtLang.getLocalOrGlobalConfig(localOptions, "timeout", 0)).to.eq(100);
57
+ expect(ExtLang.getLocalOrGlobalConfig(localOptions, "unknown", 7)).to.eq(7);
58
+ });
59
+
60
+ it("must convert associative objects to tuples and collect tuples back into an object", function () {
61
+ const tuples = ExtLang.ofAssoc({one: 1, two: 2});
62
+
63
+ expect(tuples).to.deep.eq([["one", 1], ["two", 2]]);
64
+ expect(tuples.reduce(ExtLang.collectAssoc, {})).to.deep.eq({one: 1, two: 2});
65
+ });
66
+
67
+ it("must provide fail-safe resolving and execution helpers", function () {
68
+ let executed = false;
69
+
70
+ expect(ExtLang.failSaveResolve(() => "ok").value).to.eq("ok");
71
+ expect(ExtLang.failSaveResolve(() => { throw new Error("boom"); }, "fallback").isAbsent()).to.be.true;
72
+ expect(() => ExtLang.failSaveExecute(() => { executed = true; })).not.to.throw();
73
+ expect(() => ExtLang.failSaveExecute(() => { throw new Error("boom"); })).not.to.throw();
74
+ expect(executed).to.be.true;
75
+ });
76
+
77
+ it("must resolve forms from direct form, form attribute and parent form", function () {
78
+ document.body.innerHTML = `
79
+ <form id="outer">
80
+ <button id="nested"></button>
81
+ </form>
82
+ <form id="target"></form>
83
+ <button id="detached" form="target"></button>`;
84
+
85
+ expect(ExtLang.getForm(document.getElementById("outer")!).id.value).to.eq("outer");
86
+ expect(ExtLang.getForm(document.getElementById("detached")!).id.value).to.eq("target");
87
+ expect(ExtLang.getForm(document.getElementById("nested")!).id.value).to.eq("outer");
88
+ });
89
+
90
+ it("must debounce repeated calls by key", function () {
91
+ const clock = sinon.useFakeTimers();
92
+ let callCount = 0;
93
+
94
+ try {
95
+ ExtLang.debounce("key", () => { callCount++; }, 50);
96
+ ExtLang.debounce("key", () => { callCount++; }, 50);
97
+
98
+ clock.tick(49);
99
+ expect(callCount).to.eq(0);
100
+
101
+ clock.tick(1);
102
+ expect(callCount).to.eq(1);
103
+
104
+ ExtLang.debounce("immediate", () => { callCount++; }, 0);
105
+ expect(callCount).to.eq(2);
106
+ } finally {
107
+ clock.restore();
108
+ }
109
+ });
110
+ });
@@ -0,0 +1,74 @@
1
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // AI-generated: this file was created with assistance from Claude (Anthropic) — see AI_CONTRIBUTIONS.md
17
+
18
+ import {describe} from "mocha";
19
+ import {expect} from "chai";
20
+ import {DQ} from "mona-dish";
21
+ import {Implementation} from "../../../impl/AjaxImpl";
22
+ import {HiddenInputBuilder} from "../../../impl/util/HiddenInputBuilder";
23
+ import {StandardInits} from "../../frameworkBase/_ext/shared/StandardInits";
24
+
25
+ describe("HiddenInputBuilder", function () {
26
+
27
+ beforeEach(function () {
28
+ return StandardInits.defaultMyFaces().then((close) => {
29
+ this.closeIt = () => {
30
+ Implementation.reset();
31
+ close();
32
+ };
33
+ });
34
+ });
35
+
36
+ afterEach(function () {
37
+ this.closeIt();
38
+ });
39
+
40
+ it("must build and append the next ViewState hidden input for a named view root", function () {
41
+ document.body.innerHTML = `
42
+ <form id="viewroot_1:form1">
43
+ <input type="hidden" id="viewroot_1:jakarta.faces.ViewState:2" name="viewroot_1:jakarta.faces.ViewState" value="old">
44
+ </form>`;
45
+
46
+ const form = DQ.byId("viewroot_1:form1");
47
+ const hiddenInput = new HiddenInputBuilder("input[name*='jakarta.faces.ViewState']")
48
+ .withNamingContainerId("viewroot_1")
49
+ .withNamedViewRoot(true)
50
+ .withParent(form)
51
+ .build();
52
+
53
+ hiddenInput.val = "new";
54
+
55
+ expect(hiddenInput.id.value).to.eq("viewroot_1:jakarta.faces.ViewState:3");
56
+ expect(hiddenInput.name.value).to.eq("viewroot_1:jakarta.faces.ViewState");
57
+ expect(hiddenInput.val).to.eq("new");
58
+ expect(form.querySelectorAll("#viewroot_1\\:jakarta\\.faces\\.ViewState\\:3").isPresent()).to.be.true;
59
+ });
60
+
61
+ it("must build ClientWindow without prefixing the name for a non-named view root", function () {
62
+ document.body.innerHTML = `<form id="form1"></form>`;
63
+
64
+ const hiddenInput = new HiddenInputBuilder("input[name*='jakarta.faces.ClientWindow']")
65
+ .withNamingContainerId("viewroot_1")
66
+ .withNamedViewRoot(false)
67
+ .withParent(DQ.byId("form1"))
68
+ .build();
69
+
70
+ expect(hiddenInput.id.value).to.eq("viewroot_1:jakarta.faces.ClientWindow:1");
71
+ expect(hiddenInput.name.value).to.eq("jakarta.faces.ClientWindow");
72
+ expect(DQ.byId("form1").querySelectorAll("[name='jakarta.faces.ClientWindow']").isPresent()).to.be.true;
73
+ });
74
+ });
@@ -130,5 +130,65 @@ describe('Tests on the xhr core when it starts to call the request', function ()
130
130
 
131
131
  })
132
132
 
133
+ it('onsubmit must receive null for compatibility', function () {
134
+ let FORM_ID = "blarg";
135
+ let form = DomQuery.byId(FORM_ID);
136
+ const onsumbit = Sinon.spy(() => false);
137
+ const submit_spy = Sinon.spy(() => {
138
+ });
139
+
140
+ (form.value.value as any).onsubmit = onsumbit;
141
+ (form.value.value as any).submit = submit_spy;
142
+
143
+ submitForm(FORM_ID, 'mylink', 'target1', {
144
+ booga1: "val_booga1",
145
+ booga2: "val_booga2"
146
+ });
147
+
148
+ expect(onsumbit.calledOnce).to.eq(true);
149
+ expect(onsumbit.firstCall.args.length).to.eq(1);
150
+ expect((onsumbit.firstCall.args as any[])[0]).to.eq(null);
151
+ expect(submit_spy.called).to.eq(false);
152
+ })
153
+
154
+ it('setHiddenInput must update the value when the field already exists', function () {
155
+ let FORM_ID = "blarg";
156
+ setHiddenInput(FORM_ID, "existing_field", "first_value");
157
+ setHiddenInput(FORM_ID, "existing_field", "updated_value");
158
+ const inputs = DomQuery.byId(FORM_ID).querySelectorAll("input[name='existing_field']");
159
+ expect(inputs.length).to.eq(1, "must not create a duplicate input");
160
+ expect(inputs.inputValue.value).to.eq("updated_value", "must update the value in-place");
161
+ });
162
+
163
+ it('clearHiddenInput must not throw when the field does not exist', function () {
164
+ let FORM_ID = "blarg";
165
+ expect(() => clearHiddenInput(FORM_ID, "nonexistent_field")).not.to.throw();
166
+ });
167
+
168
+ it('submitForm must work with array-style params', function () {
169
+ let FORM_ID = "blarg";
170
+ let form = DomQuery.byId(FORM_ID);
171
+ const submit_spy = Sinon.spy(() => {});
172
+ (form.value.value as any).submit = submit_spy;
173
+
174
+ submitForm(FORM_ID, 'mylink', null, [["arrKey1", "arrVal1"], ["arrKey2", "arrVal2"]]);
175
+
176
+ expect(submit_spy.called).to.eq(true);
177
+ form = DomQuery.byId(FORM_ID);
178
+ expect(form.querySelectorAll("input[name='arrKey1']").isAbsent()).to.eq(true, "params must be cleaned up after submit");
179
+ expect(form.querySelectorAll("input[name='arrKey2']").isAbsent()).to.eq(true, "params must be cleaned up after submit");
180
+ });
181
+
182
+ it('submitForm must work when params is null', function () {
183
+ let FORM_ID = "blarg";
184
+ let form = DomQuery.byId(FORM_ID);
185
+ const submit_spy = Sinon.spy(() => {});
186
+ (form.value.value as any).submit = submit_spy;
187
+
188
+ submitForm(FORM_ID, null, null, null);
189
+
190
+ expect(submit_spy.called).to.eq(true);
191
+ });
192
+
133
193
  // further tests will follow if needed, for now the namespace must be restored
134
- });
194
+ });