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.
- package/AI_CONTRIBUTIONS.md +71 -0
- package/README.md +254 -78
- package/api-extractor.faces.json +38 -0
- package/dist/docs/assets/hierarchy.js +1 -1
- package/dist/docs/assets/navigation.js +1 -1
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/faces.ajax.addOnError.html +2 -2
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -2
- package/dist/docs/functions/faces.ajax.request.html +2 -2
- package/dist/docs/functions/faces.ajax.response.html +2 -2
- package/dist/docs/functions/faces.getClientWindow.html +2 -2
- package/dist/docs/functions/faces.getProjectStage.html +2 -2
- package/dist/docs/functions/faces.getViewState.html +1 -1
- package/dist/docs/functions/faces.push.close.html +1 -1
- package/dist/docs/functions/faces.push.init.html +6 -6
- package/dist/docs/functions/faces.push.open.html +1 -1
- package/dist/docs/functions/faces.util.chain.html +2 -2
- package/dist/docs/functions/myfaces.ab.html +3 -3
- package/dist/docs/functions/myfaces.onDomReady.html +1 -1
- package/dist/docs/functions/myfaces.reserveNamespace.html +1 -1
- package/dist/docs/hierarchy.html +1 -1
- package/dist/docs/index.html +292 -71
- package/dist/docs/interfaces/faces.AjaxData.html +6 -0
- package/dist/docs/interfaces/faces.AjaxError.html +18 -0
- package/dist/docs/interfaces/faces.AjaxEvent.html +8 -0
- package/dist/docs/interfaces/faces.ajax.RequestContext.html +6 -0
- package/dist/docs/interfaces/faces.ajax.RequestOptions.html +10 -0
- package/dist/docs/modules/faces.ajax.html +1 -1
- package/dist/docs/modules/faces.html +1 -1
- package/dist/docs/modules/faces.push.html +1 -1
- package/dist/docs/modules/faces.util.html +1 -1
- package/dist/docs/modules/myfaces.html +1 -1
- package/dist/docs/modules.html +1 -1
- package/dist/docs/types/faces.AjaxErrorStatus.html +2 -0
- package/dist/docs/types/faces.AjaxEventStatus.html +2 -0
- package/dist/docs/types/faces.ProjectStage.html +2 -0
- package/dist/docs/types/faces.ajax.OnErrorCallback.html +2 -0
- package/dist/docs/types/faces.ajax.OnEventCallback.html +2 -0
- package/dist/docs/types/faces.push.OnCloseHandler.html +2 -0
- package/dist/docs/types/faces.push.OnErrorHandler.html +2 -0
- package/dist/docs/types/faces.push.OnMessageHandler.html +2 -0
- package/dist/docs/types/faces.push.OnOpenHandler.html +2 -0
- package/dist/docs/variables/faces.contextpath.html +1 -1
- package/dist/docs/variables/faces.implversion.html +1 -1
- package/dist/docs/variables/faces.separatorchar.html +1 -1
- package/dist/docs/variables/faces.specversion.html +1 -1
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1801 -499
- package/dist/window/faces-development.js.map +1 -1
- package/{target/api/_api.js → dist/window/faces.d.ts} +124 -151
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.LICENSE.txt +0 -17
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1806 -513
- package/dist/window/jsf-development.js.map +1 -1
- package/{target/src/main/typescript/api/_api.js → dist/window/jsf.d.ts} +125 -153
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.LICENSE.txt +0 -17
- package/dist/window/jsf.js.map +1 -1
- package/package.json +22 -18
- package/scripts/build-dts.mjs +239 -0
- package/src/main/typescript/@types/definitions/index.d.ts +22 -122
- package/{target/test/frameworkBase/_ext/monadish/fixtures/test2.js → src/main/typescript/@types/definitions/modules.d.ts} +18 -2
- package/src/main/typescript/api/_api.ts +132 -29
- package/{target/test/frameworkBase/_ext/monadish/fixtures/test.js → src/main/typescript/api/_api_ae_stub.d.ts} +6 -2
- package/src/main/typescript/api/faces.ts +2 -2
- package/src/main/typescript/api/jsf.ts +15 -23
- package/src/main/typescript/impl/AjaxImpl.ts +15 -15
- package/src/main/typescript/impl/PushImpl.ts +139 -69
- package/src/main/typescript/impl/core/Const.ts +2 -2
- package/src/main/typescript/impl/i18n/Messages.ts +1 -1
- package/src/main/typescript/impl/util/Assertions.ts +1 -2
- package/src/main/typescript/impl/util/AsyncRunnable.ts +3 -4
- package/src/main/typescript/impl/util/ExtDomQuery.ts +19 -19
- package/src/main/typescript/impl/util/FileUtils.ts +30 -14
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +34 -34
- package/src/main/typescript/impl/util/Lang.ts +19 -22
- package/src/main/typescript/impl/util/XhrQueueController.ts +25 -3
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +17 -12
- package/src/main/typescript/impl/xhrCore/EventData.ts +8 -7
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +3 -3
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +7 -6
- package/src/main/typescript/impl/xhrCore/Response.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseDataResolver.ts +0 -38
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +17 -15
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +72 -63
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -134
- package/src/main/typescript/mona_dish_shim.ts +6 -2
- package/src/main/typescript/myfaces/OamSubmit.ts +10 -6
- package/src/main/typescript/test/api/JsfPushShimTest.spec.ts +126 -0
- package/src/main/typescript/test/api/MyFacesABTest.spec.ts +16 -0
- package/src/main/typescript/test/api/PushTypeCompatibility.ts +65 -0
- package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +16 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +55 -9
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +16 -0
- package/src/main/typescript/test/impl/AssertionsTest.spec.ts +168 -0
- package/src/main/typescript/test/impl/FileUtilsTest.spec.ts +126 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +75 -1
- package/src/main/typescript/test/impl/ResponseDataResolverTest.spec.ts +62 -0
- package/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.ts +91 -1
- package/src/main/typescript/test/impl/util/ExtLangTest.spec.ts +110 -0
- package/src/main/typescript/test/impl/util/HiddenInputBuilderTest.spec.ts +74 -0
- package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +61 -1
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +191 -2
- package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +16 -0
- package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +14 -0
- package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +21 -5
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +363 -4
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +218 -4
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/WebsocketTest.spec.ts +764 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +265 -62
- package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +16 -0
- package/{target/src/main/typescript/test/xhrCore/FakeWebsocket.js → src/main/typescript/tsconfig.ae.json} +16 -23
- package/src/main/typescript/{tsconfig.json → tsconfig.dts.json} +11 -27
- package/src/main/typescript/tsconfig.test.json +17 -0
- package/tsconfig.api-extractor.json +17 -0
- package/.claude/settings.local.json +0 -16
- package/.github/workflows/codeql-analysis.yml +0 -83
- package/.github/workflows/nodejs.yml +0 -26
- package/.mocharc.json +0 -10
- package/.nyc_output/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
- package/.nyc_output/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
- package/.nyc_output/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
- package/.nyc_output/processinfo/384344d4-4f46-455f-84c3-010f829098cb.json +0 -1
- package/.nyc_output/processinfo/a0f90016-f4f9-4039-bb51-57f4f7050541.json +0 -1
- package/.nyc_output/processinfo/db388b5d-0b79-4bce-afd2-001aaf6f0245.json +0 -1
- package/.nyc_output/processinfo/index.json +0 -1
- package/.nycrc +0 -6
- package/build.cmd +0 -1
- package/build.sh +0 -3
- package/mvnw +0 -286
- package/mvnw.cmd +0 -161
- package/plans for 4.0.1.txt +0 -8
- package/remap.ts +0 -51
- package/src/main/typescript/test/xhrCore/WebsocketTest.ts +0 -221
- package/target/api/_api.js.map +0 -1
- package/target/api/faces.js +0 -45
- package/target/api/faces.js.map +0 -1
- package/target/api/jsf.js +0 -56
- package/target/api/jsf.js.map +0 -1
- package/target/impl/AjaxImpl.js +0 -748
- package/target/impl/AjaxImpl.js.map +0 -1
- package/target/impl/PushImpl.js +0 -265
- package/target/impl/PushImpl.js.map +0 -1
- package/target/impl/core/Const.js +0 -177
- package/target/impl/core/Const.js.map +0 -1
- package/target/impl/core/ImplTypes.js +0 -38
- package/target/impl/core/ImplTypes.js.map +0 -1
- package/target/impl/i18n/Messages.js +0 -113
- package/target/impl/i18n/Messages.js.map +0 -1
- package/target/impl/util/Assertions.js +0 -101
- package/target/impl/util/Assertions.js.map +0 -1
- package/target/impl/util/AsyncRunnable.js +0 -78
- package/target/impl/util/AsyncRunnable.js.map +0 -1
- package/target/impl/util/ExtDomQuery.js +0 -306
- package/target/impl/util/ExtDomQuery.js.map +0 -1
- package/target/impl/util/FileUtils.js +0 -98
- package/target/impl/util/FileUtils.js.map +0 -1
- package/target/impl/util/HiddenInputBuilder.js +0 -83
- package/target/impl/util/HiddenInputBuilder.js.map +0 -1
- package/target/impl/util/IListener.js +0 -3
- package/target/impl/util/IListener.js.map +0 -1
- package/target/impl/util/Lang.js +0 -263
- package/target/impl/util/Lang.js.map +0 -1
- package/target/impl/util/XhrQueueController.js +0 -92
- package/target/impl/util/XhrQueueController.js.map +0 -1
- package/target/impl/xhrCore/ErrorData.js +0 -87
- package/target/impl/xhrCore/ErrorData.js.map +0 -1
- package/target/impl/xhrCore/EventData.js +0 -52
- package/target/impl/xhrCore/EventData.js.map +0 -1
- package/target/impl/xhrCore/IResponseProcessor.js +0 -3
- package/target/impl/xhrCore/IResponseProcessor.js.map +0 -1
- package/target/impl/xhrCore/RequestDataResolver.js +0 -186
- package/target/impl/xhrCore/RequestDataResolver.js.map +0 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +0 -104
- package/target/impl/xhrCore/ResonseDataResolver.js.map +0 -1
- package/target/impl/xhrCore/Response.js +0 -186
- package/target/impl/xhrCore/Response.js.map +0 -1
- package/target/impl/xhrCore/ResponseDataResolver.js +0 -104
- package/target/impl/xhrCore/ResponseDataResolver.js.map +0 -1
- package/target/impl/xhrCore/ResponseProcessor.js +0 -468
- package/target/impl/xhrCore/ResponseProcessor.js.map +0 -1
- package/target/impl/xhrCore/XhrFormData.js +0 -163
- package/target/impl/xhrCore/XhrFormData.js.map +0 -1
- package/target/impl/xhrCore/XhrRequest.js +0 -433
- package/target/impl/xhrCore/XhrRequest.js.map +0 -1
- package/target/mona_dish_shim.js +0 -70
- package/target/mona_dish_shim.js.map +0 -1
- package/target/myfaces/OamSubmit.js +0 -128
- package/target/myfaces/OamSubmit.js.map +0 -1
- package/target/src/main/typescript/api/_api.js.map +0 -1
- package/target/src/main/typescript/api/faces.js +0 -45
- package/target/src/main/typescript/api/faces.js.map +0 -1
- package/target/src/main/typescript/api/jsf.js +0 -56
- package/target/src/main/typescript/api/jsf.js.map +0 -1
- package/target/src/main/typescript/impl/AjaxImpl.js +0 -748
- package/target/src/main/typescript/impl/AjaxImpl.js.map +0 -1
- package/target/src/main/typescript/impl/PushImpl.js +0 -265
- package/target/src/main/typescript/impl/PushImpl.js.map +0 -1
- package/target/src/main/typescript/impl/core/Const.js +0 -177
- package/target/src/main/typescript/impl/core/Const.js.map +0 -1
- package/target/src/main/typescript/impl/core/ImplTypes.js +0 -38
- package/target/src/main/typescript/impl/core/ImplTypes.js.map +0 -1
- package/target/src/main/typescript/impl/i18n/Messages.js +0 -113
- package/target/src/main/typescript/impl/i18n/Messages.js.map +0 -1
- package/target/src/main/typescript/impl/util/Assertions.js +0 -101
- package/target/src/main/typescript/impl/util/Assertions.js.map +0 -1
- package/target/src/main/typescript/impl/util/AsyncRunnable.js +0 -78
- package/target/src/main/typescript/impl/util/AsyncRunnable.js.map +0 -1
- package/target/src/main/typescript/impl/util/ExtDomQuery.js +0 -306
- package/target/src/main/typescript/impl/util/ExtDomQuery.js.map +0 -1
- package/target/src/main/typescript/impl/util/FileUtils.js +0 -98
- package/target/src/main/typescript/impl/util/FileUtils.js.map +0 -1
- package/target/src/main/typescript/impl/util/HiddenInputBuilder.js +0 -83
- package/target/src/main/typescript/impl/util/HiddenInputBuilder.js.map +0 -1
- package/target/src/main/typescript/impl/util/IListener.js +0 -3
- package/target/src/main/typescript/impl/util/IListener.js.map +0 -1
- package/target/src/main/typescript/impl/util/Lang.js +0 -263
- package/target/src/main/typescript/impl/util/Lang.js.map +0 -1
- package/target/src/main/typescript/impl/util/XhrQueueController.js +0 -92
- package/target/src/main/typescript/impl/util/XhrQueueController.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/ErrorData.js +0 -87
- package/target/src/main/typescript/impl/xhrCore/ErrorData.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/EventData.js +0 -52
- package/target/src/main/typescript/impl/xhrCore/EventData.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js +0 -3
- package/target/src/main/typescript/impl/xhrCore/IResponseProcessor.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js +0 -186
- package/target/src/main/typescript/impl/xhrCore/RequestDataResolver.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/Response.js +0 -186
- package/target/src/main/typescript/impl/xhrCore/Response.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js +0 -104
- package/target/src/main/typescript/impl/xhrCore/ResponseDataResolver.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js +0 -468
- package/target/src/main/typescript/impl/xhrCore/ResponseProcessor.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/XhrFormData.js +0 -163
- package/target/src/main/typescript/impl/xhrCore/XhrFormData.js.map +0 -1
- package/target/src/main/typescript/impl/xhrCore/XhrRequest.js +0 -433
- package/target/src/main/typescript/impl/xhrCore/XhrRequest.js.map +0 -1
- package/target/src/main/typescript/mona_dish_shim.js +0 -70
- package/target/src/main/typescript/mona_dish_shim.js.map +0 -1
- package/target/src/main/typescript/myfaces/OamSubmit.js +0 -128
- package/target/src/main/typescript/myfaces/OamSubmit.js.map +0 -1
- package/target/src/main/typescript/test/api/MyFacesABTest.spec.js +0 -117
- package/target/src/main/typescript/test/api/MyFacesABTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js +0 -123
- package/target/src/main/typescript/test/frameworkBase/LangTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -2
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
- package/target/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
- package/target/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
- package/target/src/main/typescript/test/impl/ImplTest.spec.js +0 -225
- package/target/src/main/typescript/test/impl/ImplTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/impl/ImplTest_23.spec.js +0 -143
- package/target/src/main/typescript/test/impl/ImplTest_23.spec.js.map +0 -1
- package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js +0 -106
- package/target/src/main/typescript/test/impl/SeparatorCharsTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js +0 -77
- package/target/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js +0 -118
- package/target/src/main/typescript/test/myfaces/OamSubmit.spec.js.map +0 -1
- package/target/src/main/typescript/test/myfaces/OnLoad.spec.js +0 -57
- package/target/src/main/typescript/test/myfaces/OnLoad.spec.js.map +0 -1
- package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js +0 -60
- package/target/src/main/typescript/test/myfaces/ReserveNamespace.spec.js.map +0 -1
- package/target/src/main/typescript/test/queue/AsynchronousProbe.js +0 -93
- package/target/src/main/typescript/test/queue/AsynchronousProbe.js.map +0 -1
- package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js +0 -133
- package/target/src/main/typescript/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js +0 -101
- package/target/src/main/typescript/test/xhrCore/ClientWindow.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js +0 -175
- package/target/src/main/typescript/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/EventTests.spec.js +0 -184
- package/target/src/main/typescript/test/xhrCore/EventTests.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/FakeWebsocket.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js +0 -181
- package/target/src/main/typescript/test/xhrCore/FileUploadTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
- package/target/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js +0 -199
- package/target/src/main/typescript/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js +0 -567
- package/target/src/main/typescript/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js +0 -845
- package/target/src/main/typescript/test/xhrCore/RequestTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js +0 -382
- package/target/src/main/typescript/test/xhrCore/RequestTest_23.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js +0 -667
- package/target/src/main/typescript/test/xhrCore/ResponseTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js +0 -367
- package/target/src/main/typescript/test/xhrCore/ResponseTest23.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js +0 -123
- package/target/src/main/typescript/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
- package/target/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/WebsocketTest.js +0 -207
- package/target/src/main/typescript/test/xhrCore/WebsocketTest.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js +0 -149
- package/target/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
- package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js +0 -130
- package/target/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
- package/target/test/api/MyFacesABTest.spec.js +0 -117
- package/target/test/api/MyFacesABTest.spec.js.map +0 -1
- package/target/test/frameworkBase/LangTest.spec.js +0 -123
- package/target/test/frameworkBase/LangTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +0 -657
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +0 -107
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +0 -106
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +0 -39
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -153
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js +0 -1
- package/target/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/fixtures/test.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/fixtures/test2.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +0 -925
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +0 -1
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +0 -112
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +0 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +0 -728
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +0 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +0 -296
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +0 -1
- package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +0 -16
- package/target/test/frameworkBase/_ext/shared/fixtures/js/tobago.js.map +0 -1
- package/target/test/impl/ImplTest.spec.js +0 -225
- package/target/test/impl/ImplTest.spec.js.map +0 -1
- package/target/test/impl/ImplTest_23.spec.js +0 -143
- package/target/test/impl/ImplTest_23.spec.js.map +0 -1
- package/target/test/impl/SeparatorCharsTest.spec.js +0 -106
- package/target/test/impl/SeparatorCharsTest.spec.js.map +0 -1
- package/target/test/impl/util/ExtDomQueryTest.spec.js +0 -77
- package/target/test/impl/util/ExtDomQueryTest.spec.js.map +0 -1
- package/target/test/myfaces/OamSubmit.spec.js +0 -118
- package/target/test/myfaces/OamSubmit.spec.js.map +0 -1
- package/target/test/myfaces/OnLoad.spec.js +0 -57
- package/target/test/myfaces/OnLoad.spec.js.map +0 -1
- package/target/test/myfaces/ReserveNamespace.spec.js +0 -60
- package/target/test/myfaces/ReserveNamespace.spec.js.map +0 -1
- package/target/test/queue/AsynchronousProbe.js +0 -93
- package/target/test/queue/AsynchronousProbe.js.map +0 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +0 -133
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +0 -1
- package/target/test/xhrCore/ClientWindow.spec.js +0 -101
- package/target/test/xhrCore/ClientWindow.spec.js.map +0 -1
- package/target/test/xhrCore/ErrorChainTest.spec.js +0 -175
- package/target/test/xhrCore/ErrorChainTest.spec.js.map +0 -1
- package/target/test/xhrCore/EventTests.spec.js +0 -184
- package/target/test/xhrCore/EventTests.spec.js.map +0 -1
- package/target/test/xhrCore/FakeWebsocket.js +0 -38
- package/target/test/xhrCore/FakeWebsocket.js.map +0 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +0 -181
- package/target/test/xhrCore/FileUploadTest.spec.js.map +0 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +0 -226
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +0 -1
- package/target/test/xhrCore/OamSubmitTest.spec.js +0 -199
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +0 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +0 -567
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +0 -1
- package/target/test/xhrCore/RequestTest.spec.js +0 -845
- package/target/test/xhrCore/RequestTest.spec.js.map +0 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +0 -382
- package/target/test/xhrCore/RequestTest_23.spec.js.map +0 -1
- package/target/test/xhrCore/ResponseTest.spec.js +0 -667
- package/target/test/xhrCore/ResponseTest.spec.js.map +0 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +0 -367
- package/target/test/xhrCore/ResponseTest23.spec.js.map +0 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +0 -123
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +0 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +0 -147
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +0 -1
- package/target/test/xhrCore/WebsocketTest.js +0 -207
- package/target/test/xhrCore/WebsocketTest.js.map +0 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +0 -149
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +0 -1
- package/target/test/xhrCore/XhrRequestProgress.spec.js +0 -130
- package/target/test/xhrCore/XhrRequestProgress.spec.js.map +0 -1
- package/target/test/xhrCore/fixtures/addedViewHead1.js +0 -17
- package/target/test/xhrCore/fixtures/addedViewHead1.js.map +0 -1
- package/target/test/xhrCore/fixtures/addedViewHead2.js +0 -17
- package/target/test/xhrCore/fixtures/addedViewHead2.js.map +0 -1
- package/target/test/xhrCore/fixtures/addedViewHead3.js +0 -17
- package/target/test/xhrCore/fixtures/addedViewHead3.js.map +0 -1
- package/target/test/xhrCore/fixtures/nonce_script.js +0 -17
- package/target/test/xhrCore/fixtures/nonce_script.js.map +0 -1
- package/tsconfig.json +0 -9
- 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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
});
|