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
@@ -18,17 +18,30 @@ import {describe, it} from "mocha";
18
18
  import * as sinon from "sinon";
19
19
  import {expect} from "chai";
20
20
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
21
- import {_Es2019Array, DomQuery, DQ$} from "mona-dish";
21
+ import {_Es2019Array, Config, DomQuery, DQ$} from "mona-dish";
22
22
  import {
23
23
  COMPLETE, EMPTY_STR,
24
+ EMPTY_RESPONSE,
25
+ HTTP_ERROR,
26
+ MALFORMEDXML,
24
27
  P_AJAX,
25
28
  P_EXECUTE,
26
29
  P_AJAX_SOURCE,
27
30
  P_RENDER,
28
31
  P_VIEWSTATE,
29
32
  P_WINDOW_ID,
30
- SUCCESS
33
+ STATE_EVT_TIMEOUT,
34
+ SUCCESS,
35
+ CTX_PARAM_SRC_FRM_ID,
36
+ CTX_PARAM_REQ_PASS_THR,
37
+ CTX_PARAM_PPS,
38
+ IDENT_NONE,
39
+ REQ_TYPE_GET,
40
+ SOURCE,
31
41
  } from "../../impl/core/Const";
42
+ import {XhrRequest} from "../../impl/xhrCore/XhrRequest";
43
+ import {ExtConfig} from "../../impl/util/ExtDomQuery";
44
+ import {EventData} from "../../impl/xhrCore/EventData";
32
45
  const defaultMyFaces = StandardInits.defaultMyFaces;
33
46
  const initVirtualElement = StandardInits.initVirtualElement;
34
47
  const STD_XML = StandardInits.STD_XML;
@@ -38,6 +51,12 @@ import * as nise from "nise";
38
51
  declare var faces: any;
39
52
  declare var Implementation: any;
40
53
 
54
+ function suppressErrorOutput(): () => void {
55
+ const oldErr = console.error;
56
+ console.error = () => {};
57
+ return () => { console.error = oldErr; };
58
+ }
59
+
41
60
  let issueStdReq = function (element) {
42
61
  faces.ajax.request(element, null, {
43
62
  execute: "input_1",
@@ -215,6 +234,65 @@ describe('Tests on the xhr core when it starts to call the request', function ()
215
234
  done();
216
235
  });
217
236
 
237
+ it('jakarta.faces.partial.event must be present in the body when an event is passed', function (done) {
238
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
239
+ try {
240
+ const element = DomQuery.byId("input_2").getAsElem(0).value;
241
+ // Simulate a real DOM event — its .type feeds jakarta.faces.partial.event
242
+ const clickEvent = new Event("click");
243
+ faces.ajax.request(element, clickEvent, {
244
+ execute: "input_1",
245
+ render: "@form"
246
+ });
247
+
248
+ const params: Record<string, string> = {};
249
+ (send.args[0][0] as string).split("&").forEach(p => {
250
+ const [k, v] = p.split("=");
251
+ params[decodeURIComponent(k)] = decodeURIComponent(v ?? "");
252
+ });
253
+
254
+ expect(params["jakarta.faces.partial.event"]).to.eq("click");
255
+ } finally {
256
+ send.restore();
257
+ }
258
+ done();
259
+ });
260
+
261
+ it('jakarta.faces.partial.event must be absent when no event is passed', function (done) {
262
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
263
+ try {
264
+ const element = DomQuery.byId("input_2").getAsElem(0).value;
265
+ // null event → assignIf(false, ...) skips P_EVT assignment
266
+ issueStdReq(element);
267
+
268
+ const body = send.args[0][0] as string;
269
+ expect(body).not.to.include("jakarta.faces.partial.event");
270
+ } finally {
271
+ send.restore();
272
+ }
273
+ done();
274
+ });
275
+
276
+ it('jakarta.faces.windowId must NOT appear in the POST body — it is stored in request context only', function (done) {
277
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
278
+ try {
279
+ const element = DomQuery.byId("input_2").getAsElem(0).value;
280
+ // windowId resolves from options.windowId; it is assigned to the top-level
281
+ // requestCtx (not to the pass-through map), so it never reaches the body.
282
+ faces.ajax.request(element, null, {
283
+ execute: "input_1",
284
+ render: "@form",
285
+ windowId: "test-window-id"
286
+ });
287
+
288
+ const body = send.args[0][0] as string;
289
+ expect(body).not.to.include("jakarta.faces.windowId");
290
+ } finally {
291
+ send.restore();
292
+ }
293
+ done();
294
+ });
295
+
218
296
  });
219
297
 
220
298
  describe('Tests after core when it hits response', function () {
@@ -835,6 +913,33 @@ describe('Tests after core when it hits response', function () {
835
913
  });
836
914
  });
837
915
 
916
+ it("must include a checked checkbox issuing item via appendIssuingItem when not already in form data", () => {
917
+ // Use a form where name != id so the checkbox is NOT pre-encoded under the issuing item ID
918
+ const waitForResult = initCheckboxForm();
919
+ return waitForResult.then(() => {
920
+ document.body.innerHTML += `
921
+ <form id="cb-name-id-form">
922
+ <input type="checkbox" id="cb-issuing-item" name="cb-group" value="chkval" checked>
923
+ <input type="hidden" name="jakarta.faces.ViewState" value="test-viewstate">
924
+ </form>`;
925
+
926
+ const send = sinon.spy(XMLHttpRequest.prototype, "send");
927
+ try {
928
+ const element = document.getElementById("cb-issuing-item");
929
+ faces.ajax.request(element, null, {
930
+ execute: "@none",
931
+ render: "@none"
932
+ });
933
+
934
+ const body: string = send.args[0][0] as string;
935
+ // appendIssuingItem must have added the issuing element keyed by its ID
936
+ expect(body).to.include("cb-issuing-item");
937
+ } finally {
938
+ send.restore();
939
+ }
940
+ });
941
+ });
942
+
838
943
  /**
839
944
  * https://issues.apache.org/jira/browse/MYFACES-4638
840
945
  */
@@ -887,7 +992,9 @@ describe('Tests after core when it hits response', function () {
887
992
  // Chrome sets responseXML=null for unparseable XML but still provides responseText,
888
993
  // which is the code path added in processRequestErrors for Chrome compatibility.
889
994
  // We simulate this by responding with a non-XML content type so responseXML stays null.
995
+ const restoreErrorOutput = suppressErrorOutput();
890
996
  try {
997
+ let assertionError: any = null;
891
998
  let element = DomQuery.byId("input_2").getAsElem(0).value;
892
999
  faces.ajax.request(element, null, {
893
1000
  execute: "input_1",
@@ -900,9 +1007,8 @@ describe('Tests after core when it hits response', function () {
900
1007
  try {
901
1008
  expect(error.type).to.eq("error");
902
1009
  expect(error.status).to.eq("malformedXML");
903
- done();
904
1010
  } catch (e) {
905
- done(e);
1011
+ assertionError = e;
906
1012
  }
907
1013
  }
908
1014
  });
@@ -911,10 +1017,263 @@ describe('Tests after core when it hits response', function () {
911
1017
  // Content-Type text/plain ensures responseXML is null while responseText is non-empty,
912
1018
  // matching Chrome's behavior when it encounters unparseable XML
913
1019
  xhrReq.respond(200, {'Content-Type': 'text/plain'}, "this is not valid xml content");
1020
+ restoreErrorOutput();
1021
+ done(assertionError);
914
1022
  } catch (e) {
1023
+ restoreErrorOutput();
915
1024
  done(e);
916
1025
  }
917
1026
  });
918
1027
 
919
1028
  });
920
1029
 
1030
+ describe('XhrRequest error handling and lifecycle', function () {
1031
+
1032
+ let restoreConsoleError: () => void;
1033
+ beforeEach(function () { restoreConsoleError = suppressErrorOutput(); });
1034
+ afterEach(function () { restoreConsoleError?.(); });
1035
+
1036
+ beforeEach(async function () {
1037
+ let waitForResult = defaultMyFaces();
1038
+ return waitForResult.then((close) => {
1039
+ this.xhr = nise.fakeXhr.useFakeXMLHttpRequest();
1040
+ this.requests = [];
1041
+ this.xhr.onCreate = (xhr: any) => this.requests.push(xhr);
1042
+ (global as any).XMLHttpRequest = this.xhr;
1043
+ window.XMLHttpRequest = this.xhr;
1044
+ this.jsfAjaxResponse = sinon.spy((global as any).faces.ajax, "response");
1045
+
1046
+ this.closeIt = () => {
1047
+ (global as any).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
1048
+ this.jsfAjaxResponse.restore();
1049
+ Implementation.reset();
1050
+ close();
1051
+ };
1052
+ });
1053
+ });
1054
+
1055
+ afterEach(function () {
1056
+ this.closeIt();
1057
+ });
1058
+
1059
+ // ── HTTP error responses ──────────────────────────────────────────────────
1060
+
1061
+ // HTTP status is checked first, so any non-2xx response is reported as httpError
1062
+ // regardless of body content (HTML error pages, valid XML, empty body, etc.)
1063
+
1064
+ it('must call onerror with httpError when a 4xx response has a non-XML body', function (done) {
1065
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1066
+ faces.ajax.request(element, null, {
1067
+ execute: "input_1",
1068
+ render: "@form",
1069
+ onerror: (error: any) => {
1070
+ try {
1071
+ expect(error.status).to.eq(HTTP_ERROR);
1072
+ done();
1073
+ } catch (e) { done(e); }
1074
+ }
1075
+ });
1076
+ this.requests[0].respond(404, {'Content-Type': 'text/html'}, "Not Found");
1077
+ });
1078
+
1079
+ it('must call onerror with httpError when a 5xx response has a valid XML body', function (done) {
1080
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1081
+ faces.ajax.request(element, null, {
1082
+ execute: "input_1",
1083
+ render: "@form",
1084
+ onerror: (error: any) => {
1085
+ try {
1086
+ expect(error.status).to.eq(HTTP_ERROR);
1087
+ done();
1088
+ } catch (e) { done(e); }
1089
+ }
1090
+ });
1091
+ this.requests[0].respond(500, {'Content-Type': 'text/xml'}, STD_XML);
1092
+ });
1093
+
1094
+ // ── Empty / malformed response ────────────────────────────────────────────
1095
+
1096
+ it('must call onerror with emptyResponse status when the response body is empty', function (done) {
1097
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1098
+ faces.ajax.request(element, null, {
1099
+ execute: "input_1",
1100
+ render: "@form",
1101
+ onerror: (error: any) => {
1102
+ try {
1103
+ expect(error.status).to.eq(EMPTY_RESPONSE);
1104
+ done();
1105
+ } catch (e) { done(e); }
1106
+ }
1107
+ });
1108
+ // Empty body: responseXML absent AND responseText empty → EMPTY_RESPONSE branch
1109
+ this.requests[0].respond(200, {'Content-Type': 'text/xml'}, "");
1110
+ });
1111
+
1112
+ it('must call onerror with malformedXML on a text/xml response with an invalid body', function (done) {
1113
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1114
+ faces.ajax.request(element, null, {
1115
+ execute: "input_1",
1116
+ render: "@form",
1117
+ onerror: (error: any) => {
1118
+ try {
1119
+ expect(error.status).to.eq(MALFORMEDXML);
1120
+ done();
1121
+ } catch (e) { done(e); }
1122
+ }
1123
+ });
1124
+ // Depending on the JS engine: JSDOM may produce a parseerror document (Firefox path)
1125
+ // or null responseXML with non-empty responseText (Chrome path).
1126
+ // Both processRequestErrors branches produce the same malformedXML status.
1127
+ this.requests[0].respond(200, {'Content-Type': 'text/xml'}, "<unclosed");
1128
+ });
1129
+
1130
+ // ── Timeout ───────────────────────────────────────────────────────────────
1131
+
1132
+ it('must fire the TIMEOUT_EVENT and then call onerror with httpError on xhr timeout', function (done) {
1133
+ let timeoutEventReceived = false;
1134
+ faces.ajax.addOnEvent((evt: any) => {
1135
+ if (evt.status === STATE_EVT_TIMEOUT) {
1136
+ timeoutEventReceived = true;
1137
+ }
1138
+ });
1139
+
1140
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1141
+ faces.ajax.request(element, null, {
1142
+ execute: "input_1",
1143
+ render: "@form",
1144
+ onerror: (error: any) => {
1145
+ try {
1146
+ expect(timeoutEventReceived).to.be.true;
1147
+ expect(error.status).to.eq(HTTP_ERROR);
1148
+ done();
1149
+ } catch (e) { done(e); }
1150
+ }
1151
+ });
1152
+
1153
+ // Directly invoke the ontimeout handler registered on the fake XHR by registerXhrCallbacks
1154
+ this.requests[0].ontimeout?.();
1155
+ });
1156
+
1157
+ // ── Abort ─────────────────────────────────────────────────────────────────
1158
+
1159
+ it('must call onerror with httpError when the xhr request is aborted', function (done) {
1160
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1161
+ faces.ajax.request(element, null, {
1162
+ execute: "input_1",
1163
+ render: "@form",
1164
+ onerror: (error: any) => {
1165
+ try {
1166
+ expect(error.status).to.eq(HTTP_ERROR);
1167
+ done();
1168
+ } catch (e) { done(e); }
1169
+ }
1170
+ });
1171
+
1172
+ // Directly invoke the onabort handler registered on the fake XHR by registerXhrCallbacks
1173
+ this.requests[0].onabort?.();
1174
+ });
1175
+
1176
+ // ── Browser-cancelled response guard ──────────────────────────────────────
1177
+
1178
+ it('must treat browser-cancelled xhr errors as cleanup and not call onerror', function (done) {
1179
+ let errorFired = false;
1180
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
1181
+ faces.ajax.request(element, null, {
1182
+ execute: "input_1",
1183
+ render: "@form",
1184
+ onerror: () => { errorFired = true; }
1185
+ });
1186
+
1187
+ const fakeXhr = this.requests[0];
1188
+ // Simulate the observed older browser cancelled-request fingerprint:
1189
+ // status=0, readyState=4, empty responseText, null responseXML
1190
+ Object.defineProperty(fakeXhr, 'status', {value: 0, configurable: true});
1191
+ Object.defineProperty(fakeXhr, 'readyState', {value: 4, configurable: true});
1192
+ Object.defineProperty(fakeXhr, 'responseText', {value: '', configurable: true});
1193
+ Object.defineProperty(fakeXhr, 'responseXML', {value: null, configurable: true});
1194
+
1195
+ fakeXhr.onerror?.({} as Event);
1196
+
1197
+ // isCancelledResponse returns true → reject() called, onerror suppressed
1198
+ setTimeout(() => {
1199
+ expect(errorFired).to.be.false;
1200
+ done();
1201
+ }, 0);
1202
+ });
1203
+ });
1204
+
1205
+ describe('XhrRequest GET method', function () {
1206
+
1207
+ beforeEach(async function () {
1208
+ return defaultMyFaces().then((close) => {
1209
+ this.xhr = nise.fakeXhr.useFakeXMLHttpRequest();
1210
+ this.requests = [];
1211
+ this.xhr.onCreate = (xhr: any) => this.requests.push(xhr);
1212
+ (global as any).XMLHttpRequest = this.xhr;
1213
+ window.XMLHttpRequest = this.xhr;
1214
+ this.closeIt = () => {
1215
+ (global as any).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
1216
+ close();
1217
+ };
1218
+ });
1219
+ });
1220
+
1221
+ afterEach(function () { this.closeIt(); });
1222
+
1223
+ it('must call send(null) for a GET request', function () {
1224
+ const send = sinon.spy(XMLHttpRequest.prototype, "send");
1225
+ try {
1226
+ const internalCtx = new Config({});
1227
+ internalCtx.assign(CTX_PARAM_SRC_FRM_ID).value = "blarg";
1228
+ internalCtx.assign(CTX_PARAM_PPS).value = false;
1229
+
1230
+ const reqCtx = new ExtConfig({});
1231
+ reqCtx.assign(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value = IDENT_NONE;
1232
+
1233
+ const request = new XhrRequest(reqCtx, internalCtx, 0, REQ_TYPE_GET);
1234
+ request.start();
1235
+
1236
+ expect(this.requests[0].method).to.eq("GET");
1237
+ expect(send.calledOnce).to.be.true;
1238
+ expect(send.firstCall.args[0]).to.be.null;
1239
+ } finally {
1240
+ send.restore();
1241
+ }
1242
+ });
1243
+ });
1244
+
1245
+ describe('EventData source resolution fallback', function () {
1246
+
1247
+ beforeEach(async function () {
1248
+ return defaultMyFaces().then((close) => {
1249
+ this.closeIt = close;
1250
+ });
1251
+ });
1252
+
1253
+ afterEach(function () { this.closeIt(); });
1254
+
1255
+ it('must resolve source from context when _source._element is absent', function () {
1256
+ const fakeXhr = { status: 200, responseText: "", responseXML: null } as any;
1257
+ const internalCtx = new Config({});
1258
+
1259
+ const reqCtx = new ExtConfig({});
1260
+ reqCtx.assign(SOURCE).value = "input_2";
1261
+
1262
+ const event = EventData.createFromRequest(fakeXhr, internalCtx, reqCtx, "begin");
1263
+
1264
+ expect(event.source).to.not.be.null;
1265
+ expect(event.source).to.not.be.undefined;
1266
+ expect((event.source as HTMLElement).id).to.eq("input_2");
1267
+ });
1268
+
1269
+ it('must store resolved source in internalContext for subsequent calls', function () {
1270
+ const fakeXhr = { status: 200, responseText: "", responseXML: null } as any;
1271
+ const internalCtx = new Config({});
1272
+ const reqCtx = new ExtConfig({});
1273
+ reqCtx.assign(SOURCE).value = "input_2";
1274
+
1275
+ EventData.createFromRequest(fakeXhr, internalCtx, reqCtx, "begin");
1276
+
1277
+ expect(internalCtx.getIf("_source", "_element").value).to.not.be.null;
1278
+ });
1279
+ });
@@ -28,6 +28,12 @@ const protocolPage = StandardInits.protocolPage;
28
28
  declare var faces: any;
29
29
  declare var Implementation: any;
30
30
 
31
+ function suppressErrorOutput(): () => void {
32
+ const oldErr = console.error;
33
+ console.error = () => {};
34
+ return () => { console.error = oldErr; };
35
+ }
36
+
31
37
  /**
32
38
  * response test
33
39
  * the idea is simply to pass in a dom
@@ -395,7 +401,6 @@ describe('Tests of the various aspects of the response protocol functionality',
395
401
  done();
396
402
  })
397
403
 
398
- //TODO implement secondary response mockup
399
404
  it("must handle complex resource responses properly", function (done) {
400
405
  DQ.byId("cmd_complex_resource").click();
401
406
  this.respond(XmlResponses.MULTIPLE_RESOURCE_RESPONSE);
@@ -733,8 +738,7 @@ describe('Tests of the various aspects of the response protocol functionality',
733
738
  it('must handle a ViewExpired Error correctly, and only once in a listener', function (done) {
734
739
 
735
740
  document.body.innerHTML = TCK_790_NAV_MARKUP;
736
- const oldErr = console.error;
737
- console.error = () => {};
741
+ const restore = suppressErrorOutput();
738
742
  try {
739
743
  let errorCalled = 0;
740
744
  faces.ajax.addOnError((error) => {
@@ -759,11 +763,221 @@ describe('Tests of the various aspects of the response protocol functionality',
759
763
 
760
764
  expect(errorCalled).to.eq(1);
761
765
  } finally {
762
- console.error = oldErr;
766
+ restore();
763
767
  }
764
768
  done();
765
769
 
766
770
  });
767
771
 
772
+ // ── redirect ──────────────────────────────────────────────────────────────
773
+
774
+ it('must set window.location.href to the url given in a <redirect> response', function () {
775
+ // global-jsdom copies window properties onto the Node.js global as plain values, so
776
+ // global.window is a regular writable property. We replace it with a Proxy that
777
+ // intercepts .location reads and returns a plain stub — giving us a capturable href
778
+ // without fighting jsdom's non-configurable Location object.
779
+ const originalWindow = (global as any).window;
780
+ const mockLocation = { href: 'about:blank' };
781
+ (global as any).window = new Proxy(originalWindow, {
782
+ get(target, prop) {
783
+ if (prop === 'location') return mockLocation;
784
+ const val = (target as any)[prop];
785
+ return typeof val === 'function' ? val.bind(target) : val;
786
+ }
787
+ });
788
+ try {
789
+ faces.ajax.request(document.getElementById("cmd_eval"), null, {execute: "@form", render: "@none"});
790
+ this.respond(`<?xml version="1.0" encoding="UTF-8"?>
791
+ <partial-response>
792
+ <redirect url="http://example.com/redirected"/>
793
+ </partial-response>`);
794
+
795
+ expect(mockLocation.href).to.eq("http://example.com/redirected");
796
+ } finally {
797
+ (global as any).window = originalWindow;
798
+ }
799
+ });
800
+
801
+ it('must not change window.location.href when the redirect url is empty', function () {
802
+ const originalWindow = (global as any).window;
803
+ const mockLocation = { href: 'about:blank' };
804
+ (global as any).window = new Proxy(originalWindow, {
805
+ get(target, prop) {
806
+ if (prop === 'location') return mockLocation;
807
+ const val = (target as any)[prop];
808
+ return typeof val === 'function' ? val.bind(target) : val;
809
+ }
810
+ });
811
+ try {
812
+ faces.ajax.request(document.getElementById("cmd_eval"), null, {execute: "@form", render: "@none"});
813
+ this.respond(`<?xml version="1.0" encoding="UTF-8"?>
814
+ <partial-response>
815
+ <redirect url=""/>
816
+ </partial-response>`);
817
+
818
+ expect(mockLocation.href).to.eq('about:blank');
819
+ } finally {
820
+ (global as any).window = originalWindow;
821
+ }
822
+ });
823
+
824
+ // ── attributes tag ────────────────────────────────────────────────────────
825
+
826
+ it('must apply attribute changes from an <attributes> response to the target element', function () {
827
+ faces.ajax.request(document.getElementById("cmd_attributeschange"), null, {execute: "@form", render: "@none"});
828
+ this.respond(XmlResponses.ATTRIBUTE_CHANGE);
829
+
830
+ const target = document.getElementById("attributeChange");
831
+ // last <attribute name="style"> wins
832
+ expect(target.getAttribute("style")).to.eq("border:1px solid black;");
833
+ // onclick is set as a plain attribute string
834
+ expect(target.getAttribute("onclick")).to.include("evalarea4");
835
+ });
836
+
837
+ // ── error() with responseXML present ──────────────────────────────────────
838
+
839
+ it('must attach responseXML to the error data when the server returns a well-formed error response', function (done) {
840
+ const restore = suppressErrorOutput();
841
+ try {
842
+ let capturedError: any = null;
843
+ faces.ajax.addOnError((error: any) => {
844
+ capturedError = error;
845
+ });
846
+
847
+ faces.ajax.request(document.getElementById("cmd_eval"), null, {execute: "@form", render: "@none"});
848
+
849
+ this.respond(`<?xml version="1.0" encoding="UTF-8"?>
850
+ <partial-response>
851
+ <error>
852
+ <error-name>com.example.SomeServerException</error-name>
853
+ <error-message><![CDATA[Something went wrong on the server.]]></error-message>
854
+ </error>
855
+ </partial-response>`);
856
+
857
+ expect(capturedError).not.to.be.null;
858
+ expect(capturedError.errorName).to.eq("com.example.SomeServerException");
859
+ // responseXML must be present because the response was well-formed XML
860
+ expect(capturedError.responseXML).not.to.be.null;
861
+ expect(capturedError.responseXML).not.to.be.undefined;
862
+ } finally {
863
+ restore();
864
+ }
865
+ done();
866
+ });
867
+
868
+ // ── caret preservation on partial updates (Tobago regression) ─────────────
869
+
870
+ it('must keep the caret of a focused input when a partial response re-renders only a different component', function (done) {
871
+ // Reproduces the Tobago "<tc:in> triggers ajax, renders only <tc:out>" case.
872
+ // Every keystroke fires an ajax request that re-renders ONLY the output component,
873
+ // not the focused input. The caret of the input must survive each update so the
874
+ // next typed digit lands behind the previous one ("123") and not in front ("321").
875
+ const form = document.getElementById("form1");
876
+ const input = document.createElement("input");
877
+ input.setAttribute("type", "text");
878
+ input.id = "inputAjax";
879
+ input.setAttribute("name", "inputAjax");
880
+ form.appendChild(input);
881
+ const output = document.createElement("span");
882
+ output.id = "outputAjax";
883
+ form.appendChild(output);
884
+
885
+ (input as HTMLInputElement).focus();
886
+ (input as HTMLInputElement).setSelectionRange(0, 0);
887
+
888
+ // simulates the browser inserting a character at the current caret position
889
+ const typeChar = (ch: string) => {
890
+ const el = input as HTMLInputElement;
891
+ const pos = el.selectionStart ?? el.value.length;
892
+ el.value = el.value.slice(0, pos) + ch + el.value.slice(pos);
893
+ el.setSelectionRange(pos + 1, pos + 1);
894
+ };
895
+
896
+ // ajax request that re-renders only the output, followed by the matching partial response
897
+ const fireAjaxRenderingOnlyOutput = () => {
898
+ faces.ajax.request(input, null, {execute: "inputAjax", render: "outputAjax"});
899
+ this.respond(`<?xml version="1.0" encoding="UTF-8"?>
900
+ <partial-response>
901
+ <changes>
902
+ <update id="outputAjax"><![CDATA[<span id='outputAjax'>${(input as HTMLInputElement).value}</span>]]></update>
903
+ </changes>
904
+ </partial-response>`);
905
+ };
906
+
907
+ typeChar("1");
908
+ fireAjaxRenderingOnlyOutput();
909
+ // the focused input is untouched by the output update -> caret stays behind the "1"
910
+ expect(document.activeElement?.id).to.eq("inputAjax");
911
+ expect((input as HTMLInputElement).selectionStart).to.eq(1);
912
+
913
+ typeChar("2");
914
+ fireAjaxRenderingOnlyOutput();
915
+ expect((input as HTMLInputElement).selectionStart).to.eq(2);
916
+
917
+ typeChar("3");
918
+ fireAjaxRenderingOnlyOutput();
919
+
920
+ expect((input as HTMLInputElement).value).to.eq("123");
921
+ expect((input as HTMLInputElement).selectionStart).to.eq(3);
922
+ expect(document.getElementById("outputAjax").innerHTML).to.eq("123");
923
+ done();
924
+ });
925
+
926
+ it('must keep the caret of a focused input when the partial response re-renders the input itself', function (done) {
927
+ // Same as above, but now the focused input IS part of the re-rendered markup, so the
928
+ // DOM node gets replaced. The caret must be re-applied to the freshly inserted node
929
+ // (this is what the getCaretPosition/selectionStart fix guards) so the next typed digit
930
+ // still lands behind the previous one ("123") and not in front ("321").
931
+ const form = document.getElementById("form1");
932
+ const input = document.createElement("input");
933
+ input.setAttribute("type", "text");
934
+ input.id = "inputAjax";
935
+ input.setAttribute("name", "inputAjax");
936
+ form.appendChild(input);
937
+
938
+ (input as HTMLInputElement).focus();
939
+ (input as HTMLInputElement).setSelectionRange(0, 0);
940
+
941
+ // the input node is recreated on every update, so we always re-read the live element
942
+ const current = () => document.getElementById("inputAjax") as HTMLInputElement;
943
+
944
+ const typeChar = (ch: string) => {
945
+ const el = current();
946
+ const pos = el.selectionStart ?? el.value.length;
947
+ el.value = el.value.slice(0, pos) + ch + el.value.slice(pos);
948
+ el.setSelectionRange(pos + 1, pos + 1);
949
+ };
950
+
951
+ // ajax request that re-renders the input itself, echoing back the typed value
952
+ const fireAjaxRerenderingInput = () => {
953
+ const value = current().value;
954
+ faces.ajax.request(current(), null, {execute: "inputAjax", render: "inputAjax"});
955
+ this.respond(`<?xml version="1.0" encoding="UTF-8"?>
956
+ <partial-response>
957
+ <changes>
958
+ <update id="inputAjax"><![CDATA[<input type='text' id='inputAjax' name='inputAjax' value='${value}'>]]></update>
959
+ </changes>
960
+ </partial-response>`);
961
+ };
962
+
963
+ typeChar("1");
964
+ fireAjaxRerenderingInput();
965
+ // the input node was replaced, but it must still be focused with the caret behind the "1"
966
+ expect(document.activeElement?.id).to.eq("inputAjax");
967
+ expect(current().value).to.eq("1");
968
+ expect(current().selectionStart).to.eq(1);
969
+
970
+ typeChar("2");
971
+ fireAjaxRerenderingInput();
972
+ expect(current().value).to.eq("12");
973
+ expect(current().selectionStart).to.eq(2);
974
+
975
+ typeChar("3");
976
+ fireAjaxRerenderingInput();
977
+
978
+ expect(current().value).to.eq("123");
979
+ expect(current().selectionStart).to.eq(3);
980
+ done();
981
+ });
768
982
 
769
983
  });