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
|
@@ -1,657 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
-
* contributor license agreements. See the NOTICE file distributed with
|
|
4
|
-
* this work for additional information regarding copyright ownership.
|
|
5
|
-
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
6
|
-
* (the "License"); you may not use this file except in compliance with
|
|
7
|
-
* the License. You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
const chai_1 = require("chai");
|
|
28
|
-
const mocha_1 = require("mocha");
|
|
29
|
-
const rxjs_1 = require("rxjs");
|
|
30
|
-
const mona_dish_1 = require("mona-dish");
|
|
31
|
-
const tobago_with_header_1 = require("./markups/tobago-with-header");
|
|
32
|
-
const tobago_without_header_1 = require("./markups/tobago-without-header");
|
|
33
|
-
const jsdom = require("jsdom");
|
|
34
|
-
const { JSDOM } = jsdom;
|
|
35
|
-
const trim = mona_dish_1.Lang.trim;
|
|
36
|
-
global.window = {};
|
|
37
|
-
let dom = null;
|
|
38
|
-
(0, mocha_1.describe)('DOMQuery tests', function () {
|
|
39
|
-
beforeEach(function () {
|
|
40
|
-
dom = new JSDOM(`
|
|
41
|
-
<!DOCTYPE html>
|
|
42
|
-
<html lang="en">
|
|
43
|
-
<head>
|
|
44
|
-
<meta charset="UTF-8">
|
|
45
|
-
<title>Title</title>
|
|
46
|
-
</head>
|
|
47
|
-
<body>
|
|
48
|
-
<div id="id_1"></div>
|
|
49
|
-
<div id="id_2" booga="blarg" class="blarg2"></div>
|
|
50
|
-
<div id="id_3" class="blarg1 blarg2"></div>
|
|
51
|
-
<div id="id_4"></div>
|
|
52
|
-
</body>
|
|
53
|
-
</html>
|
|
54
|
-
|
|
55
|
-
`, {
|
|
56
|
-
contentType: "text/html",
|
|
57
|
-
runScripts: "dangerously",
|
|
58
|
-
resources: "usable",
|
|
59
|
-
url: `file://${__dirname}/index.html`
|
|
60
|
-
});
|
|
61
|
-
let window = dom.window;
|
|
62
|
-
global.dom = dom;
|
|
63
|
-
global.window = window;
|
|
64
|
-
global.body = window.document.body;
|
|
65
|
-
global.document = window.document;
|
|
66
|
-
});
|
|
67
|
-
this.afterEach(function () {
|
|
68
|
-
});
|
|
69
|
-
(0, mocha_1.it)('basic init', function () {
|
|
70
|
-
let probe1 = new mona_dish_1.DomQuery(window.document.body);
|
|
71
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
72
|
-
let probe3 = new mona_dish_1.DomQuery(probe1, probe2);
|
|
73
|
-
let probe4 = new mona_dish_1.DomQuery(window.document.body, probe3);
|
|
74
|
-
(0, chai_1.expect)(probe1.length).to.be.eq(1);
|
|
75
|
-
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
76
|
-
(0, chai_1.expect)(probe3.length == 5).to.be.true;
|
|
77
|
-
//still under discussion (we might index to avoid doubles)
|
|
78
|
-
(0, chai_1.expect)(probe4.length == 6).to.be.true;
|
|
79
|
-
});
|
|
80
|
-
(0, mocha_1.it)('proper iterator api and rxjs mapping', function () {
|
|
81
|
-
let probe1 = new mona_dish_1.DomQuery(window.document.body);
|
|
82
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
83
|
-
let o1 = (0, rxjs_1.from)(mona_dish_1.Stream.ofDataSource(probe1));
|
|
84
|
-
let o2 = (0, rxjs_1.from)(mona_dish_1.Stream.ofDataSource(probe2));
|
|
85
|
-
let cnt1 = 0;
|
|
86
|
-
let isDQuery = false;
|
|
87
|
-
let cnt2 = 0;
|
|
88
|
-
o1.subscribe((item) => {
|
|
89
|
-
cnt1++;
|
|
90
|
-
});
|
|
91
|
-
o2.subscribe((item) => {
|
|
92
|
-
cnt2++;
|
|
93
|
-
isDQuery = (item.length == 1) && (item instanceof mona_dish_1.DomQuery);
|
|
94
|
-
});
|
|
95
|
-
(0, chai_1.expect)(probe1.length).to.be.eq(1);
|
|
96
|
-
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
97
|
-
(0, chai_1.expect)(isDQuery).to.be.true;
|
|
98
|
-
});
|
|
99
|
-
(0, mocha_1.it)('proper iterator api and rxjs mapping with observable', function () {
|
|
100
|
-
let probe1 = new mona_dish_1.DomQuery(window.document.body);
|
|
101
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
102
|
-
let o1 = (0, rxjs_1.from)(mona_dish_1.Stream.ofDataSource(probe1));
|
|
103
|
-
let o2 = (0, rxjs_1.from)(mona_dish_1.Stream.ofDataSource(probe2));
|
|
104
|
-
let cnt1 = 0;
|
|
105
|
-
let isDQuery = false;
|
|
106
|
-
let cnt2 = 0;
|
|
107
|
-
o1.subscribe((item) => {
|
|
108
|
-
cnt1++;
|
|
109
|
-
});
|
|
110
|
-
o2.subscribe((item) => {
|
|
111
|
-
cnt2++;
|
|
112
|
-
isDQuery = (item.length == 1) && (item instanceof mona_dish_1.DomQuery);
|
|
113
|
-
});
|
|
114
|
-
(0, chai_1.expect)(probe1.length).to.be.eq(1);
|
|
115
|
-
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
116
|
-
(0, chai_1.expect)(isDQuery).to.be.true;
|
|
117
|
-
});
|
|
118
|
-
(0, mocha_1.it)('domquery ops test filter', function () {
|
|
119
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
120
|
-
probe2 = probe2.filter((item) => item.id.match((id) => id != "id_1"));
|
|
121
|
-
(0, chai_1.expect)(probe2.length == 3);
|
|
122
|
-
});
|
|
123
|
-
(0, mocha_1.it)('global eval test', function () {
|
|
124
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
125
|
-
probe2 = probe2.filter((item) => item.id.match((id) => id != "id_1"));
|
|
126
|
-
(0, chai_1.expect)(probe2.length == 3);
|
|
127
|
-
});
|
|
128
|
-
(0, mocha_1.it)('must detach', function () {
|
|
129
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div#id_1");
|
|
130
|
-
probe2.detach();
|
|
131
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div#id_1").isPresent()).to.be.false;
|
|
132
|
-
probe2.appendTo(mona_dish_1.DomQuery.querySelectorAll("body"));
|
|
133
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div#id_1").isPresent()).to.be.true;
|
|
134
|
-
});
|
|
135
|
-
(0, mocha_1.it)('domquery ops test2 each', () => {
|
|
136
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div#id_1");
|
|
137
|
-
mona_dish_1.DomQuery.globalEval("document.getElementById('id_1').innerHTML = 'hello'");
|
|
138
|
-
(0, chai_1.expect)(probe2.html().value).to.eq("hello");
|
|
139
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId(document.head).innerHTML.indexOf("document.getElementById('id_1').innerHTML = 'hello'")).to.eq(-1);
|
|
140
|
-
mona_dish_1.DomQuery.globalEval("document.getElementById('id_1').innerHTML = 'hello2'", "nonci");
|
|
141
|
-
(0, chai_1.expect)(probe2.html().value).to.eq("hello2");
|
|
142
|
-
});
|
|
143
|
-
(0, mocha_1.it)('domquery ops test2 with sticky eval code', () => {
|
|
144
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div#id_1");
|
|
145
|
-
mona_dish_1.DomQuery.globalEvalSticky("document.getElementById('id_1').innerHTML = 'hello'");
|
|
146
|
-
(0, chai_1.expect)(probe2.html().value).to.eq("hello");
|
|
147
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId(document.head).innerHTML.indexOf("document.getElementById('id_1').innerHTML = 'hello'")).not.to.eq(-1);
|
|
148
|
-
mona_dish_1.DomQuery.globalEvalSticky("document.getElementById('id_1').innerHTML = 'hello2'", "nonci");
|
|
149
|
-
(0, chai_1.expect)(probe2.html().value).to.eq("hello2");
|
|
150
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId(document.head).innerHTML.indexOf("document.getElementById('id_1').innerHTML = 'hello2'")).not.to.eq(-1);
|
|
151
|
-
});
|
|
152
|
-
(0, mocha_1.it)('domquery ops test2 eachNode', function () {
|
|
153
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
154
|
-
let noIter = 0;
|
|
155
|
-
probe2 = probe2.each((item, cnt) => {
|
|
156
|
-
(0, chai_1.expect)(item instanceof mona_dish_1.DomQuery).to.be.true;
|
|
157
|
-
(0, chai_1.expect)(noIter == cnt).to.be.true;
|
|
158
|
-
noIter++;
|
|
159
|
-
});
|
|
160
|
-
(0, chai_1.expect)(noIter == 4).to.be.true;
|
|
161
|
-
});
|
|
162
|
-
(0, mocha_1.it)('domquery ops test2 byId', function () {
|
|
163
|
-
let probe2 = mona_dish_1.DomQuery.byId("id_1");
|
|
164
|
-
(0, chai_1.expect)(probe2.length == 1).to.be.true;
|
|
165
|
-
probe2 = mona_dish_1.DomQuery.byTagName("div");
|
|
166
|
-
(0, chai_1.expect)(probe2.length == 4).to.be.true;
|
|
167
|
-
});
|
|
168
|
-
(0, mocha_1.it)('outerhtml and eval tests', function () {
|
|
169
|
-
let probe1 = new mona_dish_1.DomQuery(window.document.body);
|
|
170
|
-
probe1.querySelectorAll("#id_1").outerHTML(`
|
|
171
|
-
<div id='barg'>
|
|
172
|
-
|
|
173
|
-
</div>
|
|
174
|
-
<script type="text/javascript">
|
|
175
|
-
document.getElementById('blarg').innerHTML = 'hello world';
|
|
176
|
-
</script>
|
|
177
|
-
`, true, true);
|
|
178
|
-
(0, chai_1.expect)(window.document.body.innerHTML.indexOf("hello world") != -1).to.be.true;
|
|
179
|
-
(0, chai_1.expect)(window.document.head.innerHTML.indexOf("hello world") == -1).to.be.true;
|
|
180
|
-
(0, chai_1.expect)(window.document.body.innerHTML.indexOf("id_1") == -1).to.be.true;
|
|
181
|
-
(0, chai_1.expect)(window.document.body.innerHTML.indexOf("blarg") != -1).to.be.true;
|
|
182
|
-
});
|
|
183
|
-
(0, mocha_1.it)('attr test and eval tests', function () {
|
|
184
|
-
let probe1 = new mona_dish_1.DomQuery(document);
|
|
185
|
-
probe1.querySelectorAll("div#id_2").attr("style").value = "border=1;";
|
|
186
|
-
let blarg = probe1.querySelectorAll("div#id_2").attr("booga").value;
|
|
187
|
-
let style = probe1.querySelectorAll("div#id_2").attr("style").value;
|
|
188
|
-
let nonexistent = probe1.querySelectorAll("div#id_2").attr("buhaha").value;
|
|
189
|
-
(0, chai_1.expect)(blarg).to.be.eq("blarg");
|
|
190
|
-
(0, chai_1.expect)(style).to.be.eq("border=1;");
|
|
191
|
-
(0, chai_1.expect)(nonexistent).to.be.eq(null);
|
|
192
|
-
});
|
|
193
|
-
(0, mocha_1.it)('style must work ', function () {
|
|
194
|
-
let probe1 = new mona_dish_1.DomQuery(document);
|
|
195
|
-
let probe = probe1.querySelectorAll("div#id_2");
|
|
196
|
-
probe.style("border").value = "10px solid red";
|
|
197
|
-
probe.style("color").value = "blue";
|
|
198
|
-
let styleNodeLevel = probe.getAsElem(0).value.style['color'];
|
|
199
|
-
(0, chai_1.expect)(probe.style("border").value).to.eq("10px solid red");
|
|
200
|
-
(0, chai_1.expect)(probe.style("color").value).to.eq("blue");
|
|
201
|
-
(0, chai_1.expect)(styleNodeLevel).to.eq('blue');
|
|
202
|
-
});
|
|
203
|
-
(0, mocha_1.it)('must perform addClass and hasClass correctly', function () {
|
|
204
|
-
let probe1 = new mona_dish_1.DomQuery(document);
|
|
205
|
-
let element = probe1.querySelectorAll("div#id_2");
|
|
206
|
-
element.addClass("booga").addClass("Booga2");
|
|
207
|
-
let classdef = element.attr("class").value;
|
|
208
|
-
(0, chai_1.expect)(classdef).to.eq("blarg2 booga Booga2");
|
|
209
|
-
element.removeClass("booga2");
|
|
210
|
-
(0, chai_1.expect)(element.hasClass("booga2")).to.be.false;
|
|
211
|
-
(0, chai_1.expect)(element.hasClass("booga")).to.be.true;
|
|
212
|
-
});
|
|
213
|
-
(0, mocha_1.it)('must perform addClass and hasClass correctly 2', function () {
|
|
214
|
-
let probe1 = new mona_dish_1.DomQuery(document);
|
|
215
|
-
let element = probe1.querySelectorAll(".blarg2");
|
|
216
|
-
element.addClass("booga").addClass("Booga2");
|
|
217
|
-
let classdef = element.attr("class").value;
|
|
218
|
-
(0, chai_1.expect)(classdef).to.eq("blarg2 booga Booga2");
|
|
219
|
-
element.removeClass("booga2");
|
|
220
|
-
(0, chai_1.expect)(element.hasClass("booga2")).to.be.false;
|
|
221
|
-
(0, chai_1.expect)(element.hasClass("booga")).to.be.true;
|
|
222
|
-
(0, chai_1.expect)(element.hasClass("blarg2")).to.be.true;
|
|
223
|
-
});
|
|
224
|
-
(0, mocha_1.it)('must perform addClass and hasClass correctly 2', function () {
|
|
225
|
-
let probe1 = new mona_dish_1.DomQuery(document);
|
|
226
|
-
let element = probe1.querySelectorAll(".blarg2");
|
|
227
|
-
element.addClass("booga").addClass("Booga2");
|
|
228
|
-
(0, chai_1.expect)(probe1.querySelectorAll(".Booga2").length).eq(2);
|
|
229
|
-
});
|
|
230
|
-
(0, mocha_1.it)('must perform insert before and insert after correctly', function () {
|
|
231
|
-
let probe1 = new mona_dish_1.DomQuery(document).querySelectorAll("#id_2");
|
|
232
|
-
let insert = mona_dish_1.DomQuery.fromMarkup("<div id='insertedBefore'></div><div id='insertedBefore2'></div>");
|
|
233
|
-
let insert2 = mona_dish_1.DomQuery.fromMarkup("<div id='insertedAfter'></div><div id='insertedAfter2'></div>");
|
|
234
|
-
probe1.insertBefore(insert);
|
|
235
|
-
probe1.insertAfter(insert2);
|
|
236
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("#insertedBefore").isPresent()).to.be.true;
|
|
237
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("#insertedBefore2").isPresent()).to.be.true;
|
|
238
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("#id_2").isPresent()).to.be.true;
|
|
239
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("#insertedAfter").isPresent()).to.be.true;
|
|
240
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("#insertedAfter2").isPresent()).to.be.true;
|
|
241
|
-
});
|
|
242
|
-
(0, mocha_1.it)('do not create new <html> tag on <header', function () {
|
|
243
|
-
const fromMarkupWithHeader = mona_dish_1.DomQuery.fromMarkup(tobago_with_header_1.tobagoSheetWithHeader);
|
|
244
|
-
const fromMarkupWithoutHeader = mona_dish_1.DomQuery.fromMarkup(tobago_without_header_1.tobagoSheetWithoutHeader);
|
|
245
|
-
(0, chai_1.expect)(fromMarkupWithHeader.tagName.value === "HTML").to.be.false;
|
|
246
|
-
(0, chai_1.expect)(fromMarkupWithoutHeader.tagName.value === "HTML").to.be.false;
|
|
247
|
-
});
|
|
248
|
-
(0, mocha_1.it)('do not falsely assume standard tag', function () {
|
|
249
|
-
const fromMarkup1 = mona_dish_1.DomQuery.fromMarkup(`
|
|
250
|
-
<head-mine>booga</head-mine>
|
|
251
|
-
`);
|
|
252
|
-
const fromMarkup2 = mona_dish_1.DomQuery.fromMarkup(`
|
|
253
|
-
<body_mine>booga</body_mine>
|
|
254
|
-
|
|
255
|
-
`);
|
|
256
|
-
(0, chai_1.expect)(fromMarkup1.tagName.value === "HTML").to.be.false;
|
|
257
|
-
(0, chai_1.expect)(fromMarkup1.tagName.value === "HTML").to.be.false;
|
|
258
|
-
(0, chai_1.expect)(fromMarkup1.tagName.value === "HEAD").to.be.false;
|
|
259
|
-
(0, chai_1.expect)(fromMarkup2.tagName.value === "BODY").to.be.false;
|
|
260
|
-
});
|
|
261
|
-
(0, mocha_1.it)('it must stream', function () {
|
|
262
|
-
let probe1 = new mona_dish_1.DomQuery(document).querySelectorAll("div");
|
|
263
|
-
let coll = mona_dish_1.Stream.ofDomQuery(probe1).collect(new mona_dish_1.ArrayCollector());
|
|
264
|
-
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
265
|
-
coll = mona_dish_1.LazyStream.ofDomQuery(probe1).collect(new mona_dish_1.ArrayCollector());
|
|
266
|
-
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
267
|
-
});
|
|
268
|
-
(0, mocha_1.it)('it must stream - DQ API (dynamically added)', function () {
|
|
269
|
-
let probe1 = new mona_dish_1.DomQuery(document).querySelectorAll("div");
|
|
270
|
-
let coll = probe1.asArray;
|
|
271
|
-
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
272
|
-
});
|
|
273
|
-
(0, mocha_1.it)('it must stream to a domquery', function () {
|
|
274
|
-
let probe1 = new mona_dish_1.DomQuery(document).querySelectorAll("div");
|
|
275
|
-
let coll = mona_dish_1.Stream.ofDataSource(probe1).collect(new mona_dish_1.DomQueryCollector());
|
|
276
|
-
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
277
|
-
probe1.reset();
|
|
278
|
-
coll = mona_dish_1.LazyStream.ofStreamDataSource(probe1).collect(new mona_dish_1.DomQueryCollector());
|
|
279
|
-
(0, chai_1.expect)(coll.length == 4).to.be.true;
|
|
280
|
-
});
|
|
281
|
-
(0, mocha_1.it)('it must have parents', function () {
|
|
282
|
-
let probe1 = new mona_dish_1.DomQuery(document).querySelectorAll("div");
|
|
283
|
-
let coll = mona_dish_1.Stream.ofDataSource(probe1.parentsWhileMatch("body")).collect(new mona_dish_1.ArrayCollector());
|
|
284
|
-
(0, chai_1.expect)(coll.length == 1).to.be.true;
|
|
285
|
-
});
|
|
286
|
-
(0, mocha_1.it)("must have a working insertBefore and insertAfter", function () {
|
|
287
|
-
let probe1 = new mona_dish_1.DomQuery(document).byId("id_2");
|
|
288
|
-
probe1.insertBefore(mona_dish_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
289
|
-
probe1.insertAfter(mona_dish_1.DomQuery.fromMarkup(` <div id="id_x_0_1"></div><div id="id_x_1_1"></div>`));
|
|
290
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div").length).to.eq(8);
|
|
291
|
-
mona_dish_1.DomQuery.querySelectorAll("body").innerHTML = trim(mona_dish_1.DomQuery.querySelectorAll("body").innerHTML.replace(/>\s*</gi, "><"));
|
|
292
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("body").childNodes.length).to.eq(8);
|
|
293
|
-
let innerHtml = mona_dish_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
294
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_x_1")).to.be.true;
|
|
295
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_2")).to.be.true;
|
|
296
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
297
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0_1") > innerHtml.indexOf("id_2")).to.be.true;
|
|
298
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1_1") > innerHtml.indexOf("id_x_0_1")).to.be.true;
|
|
299
|
-
});
|
|
300
|
-
(0, mocha_1.it)("must have a working replace", function () {
|
|
301
|
-
let probe1 = new mona_dish_1.DomQuery(document).byId("id_1");
|
|
302
|
-
probe1.replace(mona_dish_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
303
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div").length).to.eq(5);
|
|
304
|
-
let innerHtml = mona_dish_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
305
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
306
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_2")).to.be.true;
|
|
307
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_3")).to.be.true;
|
|
308
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_x_1")).to.be.true;
|
|
309
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > 0).to.be.true;
|
|
310
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") < innerHtml.indexOf("id_2")).to.be.true;
|
|
311
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") < innerHtml.indexOf("id_3")).to.be.true;
|
|
312
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_1") == -1).to.be.true;
|
|
313
|
-
});
|
|
314
|
-
(0, mocha_1.it)("must have a working replace - 2", function () {
|
|
315
|
-
let probe1 = new mona_dish_1.DomQuery(document).byId("id_2");
|
|
316
|
-
probe1.replace(mona_dish_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
317
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div").length).to.eq(5);
|
|
318
|
-
let innerHtml = mona_dish_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
319
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_1")).to.be.true;
|
|
320
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
321
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_0")).to.be.true;
|
|
322
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_3")).to.be.true;
|
|
323
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > 0).to.be.true;
|
|
324
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > innerHtml.indexOf("id_0")).to.be.true;
|
|
325
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") < innerHtml.indexOf("id_3")).to.be.true;
|
|
326
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_2") == -1).to.be.true;
|
|
327
|
-
});
|
|
328
|
-
(0, mocha_1.it)("must have a working replace - 3", function () {
|
|
329
|
-
let probe1 = new mona_dish_1.DomQuery(document).byId("id_4");
|
|
330
|
-
probe1.replace(mona_dish_1.DomQuery.fromMarkup(` <div id="id_x_0"></div><div id="id_x_1"></div>`));
|
|
331
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div").length).to.eq(5);
|
|
332
|
-
let innerHtml = mona_dish_1.DomQuery.querySelectorAll("body").innerHTML;
|
|
333
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > 0).to.be.true;
|
|
334
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_1")).to.be.true;
|
|
335
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_2")).to.be.true;
|
|
336
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") > innerHtml.indexOf("id_3")).to.be.true;
|
|
337
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_0") < innerHtml.indexOf("id_x_1")).to.be.true;
|
|
338
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > 0).to.be.true;
|
|
339
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > innerHtml.indexOf("id_1")).to.be.true;
|
|
340
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > innerHtml.indexOf("id_2")).to.be.true;
|
|
341
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_x_1") > innerHtml.indexOf("id_3")).to.be.true;
|
|
342
|
-
(0, chai_1.expect)(innerHtml.indexOf("id_4") == -1).to.be.true;
|
|
343
|
-
});
|
|
344
|
-
(0, mocha_1.it)("must have a working input handling", function () {
|
|
345
|
-
mona_dish_1.DomQuery.querySelectorAll("body").innerHTML = `<form id="blarg">
|
|
346
|
-
<div id="embed1">
|
|
347
|
-
<input type="text" id="id_1" name="id_1" value="id_1_val"></input>
|
|
348
|
-
<input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled"> </input>
|
|
349
|
-
<textarea type="text" id="id_3" name="id_3">textareaVal</textarea>
|
|
350
|
-
|
|
351
|
-
<fieldset>
|
|
352
|
-
<input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked"></input>
|
|
353
|
-
<label for="mc"> Mastercard</label>
|
|
354
|
-
<input type="radio" id="vi" name="cc_1" value="Visa"></input>
|
|
355
|
-
<label for="vi"> Visa</label>
|
|
356
|
-
<input type="radio" id="ae" name="cc_1" value="AmericanExpress"></input>
|
|
357
|
-
<label for="ae"> American Express</label>
|
|
358
|
-
</fieldset>
|
|
359
|
-
<select id="val_5" name="val_5" name="top5" size="5">
|
|
360
|
-
<option>barg</option>
|
|
361
|
-
<option>jjj</option>
|
|
362
|
-
<option selected>akaka</option>
|
|
363
|
-
<option>blon</option>
|
|
364
|
-
<option>slashs</option>
|
|
365
|
-
</select>
|
|
366
|
-
</div>
|
|
367
|
-
</form>
|
|
368
|
-
`;
|
|
369
|
-
let length = mona_dish_1.DomQuery.querySelectorAll("form").elements.length;
|
|
370
|
-
(0, chai_1.expect)(length == 8).to.be.true;
|
|
371
|
-
let length1 = mona_dish_1.DomQuery.querySelectorAll("body").elements.length;
|
|
372
|
-
(0, chai_1.expect)(length1 == 8).to.be.true;
|
|
373
|
-
let length2 = mona_dish_1.DomQuery.byId("embed1").elements.length;
|
|
374
|
-
(0, chai_1.expect)(length2 == 8).to.be.true;
|
|
375
|
-
let count = mona_dish_1.Stream.ofDataSource(mona_dish_1.DomQuery.byId("embed1").elements)
|
|
376
|
-
.map(item => item.disabled ? 1 : 0)
|
|
377
|
-
.reduce((val1, val2) => val1 + val2, 0);
|
|
378
|
-
(0, chai_1.expect)(count.value).to.eq(1);
|
|
379
|
-
mona_dish_1.Stream.ofDataSource(mona_dish_1.DomQuery.byId("embed1").elements)
|
|
380
|
-
.filter(item => item.disabled)
|
|
381
|
-
.each(item => item.disabled = false);
|
|
382
|
-
count = mona_dish_1.Stream.ofDataSource(mona_dish_1.DomQuery.byId("embed1").elements)
|
|
383
|
-
.map(item => item.disabled ? 1 : 0)
|
|
384
|
-
.reduce((val1, val2) => val1 + val2, 0);
|
|
385
|
-
(0, chai_1.expect)(count.value).to.eq(0);
|
|
386
|
-
count = mona_dish_1.Stream.ofDataSource(mona_dish_1.DomQuery.byId("embed1").elements)
|
|
387
|
-
.map(item => item.attr("checked").isPresent() ? 1 : 0)
|
|
388
|
-
.reduce((val1, val2) => val1 + val2, 0);
|
|
389
|
-
(0, chai_1.expect)(count.value).to.eq(1);
|
|
390
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_1").inputValue.value == "id_1_val").to.be.true;
|
|
391
|
-
mona_dish_1.DomQuery.byId("id_1").inputValue.value = "booga";
|
|
392
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_1").inputValue.value == "booga").to.be.true;
|
|
393
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_3").inputValue.value).to.eq("textareaVal");
|
|
394
|
-
mona_dish_1.DomQuery.byId("id_3").inputValue.value = "hello world";
|
|
395
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_3").inputValue.value).to.eq("hello world");
|
|
396
|
-
let cfg = new mona_dish_1.Config(mona_dish_1.DomQuery.querySelectorAll("form").elements.encodeFormElement());
|
|
397
|
-
(0, chai_1.expect)(cfg.getIf("id_1").value[0]).to.eq("booga");
|
|
398
|
-
(0, chai_1.expect)(cfg.getIf("id_2").value[0]).to.eq("id_2_val");
|
|
399
|
-
(0, chai_1.expect)(cfg.getIf("id_3").value[0]).to.eq("hello world");
|
|
400
|
-
(0, chai_1.expect)(cfg.getIf("cc_1").value[0]).to.eq("Mastercard");
|
|
401
|
-
(0, chai_1.expect)(cfg.getIf("val_5").value[0]).to.eq("akaka");
|
|
402
|
-
});
|
|
403
|
-
(0, mocha_1.it)("must have a proper loadScriptEval execution", function (done) {
|
|
404
|
-
mona_dish_1.DomQuery.byTagName("body").loadScriptEval("./fixtures/test.js");
|
|
405
|
-
setTimeout(() => {
|
|
406
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_1").innerHTML == "hello world").to.be.true;
|
|
407
|
-
done();
|
|
408
|
-
}, 100);
|
|
409
|
-
});
|
|
410
|
-
(0, mocha_1.it)("must have first etc working", function () {
|
|
411
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.querySelectorAll("div").first().id.value).to.eq("id_1");
|
|
412
|
-
});
|
|
413
|
-
(0, mocha_1.it)("runscript runcss", function (done) {
|
|
414
|
-
mona_dish_1.DomQuery.byTagName("body").innerHTML = `
|
|
415
|
-
<div id="first"></div>
|
|
416
|
-
<div id="second"></div>
|
|
417
|
-
<div id="third"></div>
|
|
418
|
-
<div id="fourth"></div>
|
|
419
|
-
|
|
420
|
-
<script type="text/javascript">
|
|
421
|
-
document.getElementById("first").innerHTML = "hello world";
|
|
422
|
-
</script>
|
|
423
|
-
<script type="text/javascript">
|
|
424
|
-
//<![CDATA[
|
|
425
|
-
document.getElementById("second").innerHTML = "hello world";
|
|
426
|
-
//]]>
|
|
427
|
-
</script>
|
|
428
|
-
<script type="text/javascript">
|
|
429
|
-
<!--
|
|
430
|
-
document.getElementById("third").innerHTML = "hello world";
|
|
431
|
-
//-->
|
|
432
|
-
</script>
|
|
433
|
-
<script type="text/javascript">
|
|
434
|
-
//<!--
|
|
435
|
-
document.getElementById("fourth").innerHTML = "hello world";
|
|
436
|
-
//-->
|
|
437
|
-
</script>
|
|
438
|
-
|
|
439
|
-
<style type="text/css">
|
|
440
|
-
#first {
|
|
441
|
-
border: 1px solid black;
|
|
442
|
-
}
|
|
443
|
-
</style>
|
|
444
|
-
|
|
445
|
-
<link rel="stylesheet" href="./fixtures/blank.css"></link>
|
|
446
|
-
`;
|
|
447
|
-
let content = mona_dish_1.DomQuery.byTagName("body").runScripts().runCss();
|
|
448
|
-
(0, chai_1.expect)(content.byId("first").innerHTML).to.eq("hello world");
|
|
449
|
-
(0, chai_1.expect)(content.byId("second").innerHTML).to.eq("hello world");
|
|
450
|
-
(0, chai_1.expect)(content.byId("third").innerHTML).to.eq("hello world");
|
|
451
|
-
(0, chai_1.expect)(content.byId("fourth").innerHTML).to.eq("hello world");
|
|
452
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byTagName("body")
|
|
453
|
-
.querySelectorAll("link[rel='stylesheet'][href='./fixtures/blank.css']").length).to.eq(1);
|
|
454
|
-
done();
|
|
455
|
-
});
|
|
456
|
-
//TODO defer does not work in jsdom
|
|
457
|
-
(0, mocha_1.it)("must have a proper loadScriptEval deferred", function (done) {
|
|
458
|
-
mona_dish_1.DomQuery.byId(document.body).loadScriptEval("./fixtures/test2.js", 200);
|
|
459
|
-
setTimeout(() => {
|
|
460
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_1").innerHTML == "hello world").to.be.false;
|
|
461
|
-
}, 100);
|
|
462
|
-
setTimeout(() => {
|
|
463
|
-
(0, chai_1.expect)(mona_dish_1.DomQuery.byId("id_1").innerHTML == "hello world").to.be.true;
|
|
464
|
-
done();
|
|
465
|
-
}, 1500);
|
|
466
|
-
});
|
|
467
|
-
(0, mocha_1.it)("it must handle events properly", function () {
|
|
468
|
-
let clicked = 0;
|
|
469
|
-
let listener = (evt) => {
|
|
470
|
-
clicked++;
|
|
471
|
-
};
|
|
472
|
-
let eventReceiver = mona_dish_1.DomQuery.byId("id_1");
|
|
473
|
-
eventReceiver.addEventListener("click", listener);
|
|
474
|
-
eventReceiver.click();
|
|
475
|
-
(0, chai_1.expect)(clicked).to.eq(1);
|
|
476
|
-
eventReceiver.removeEventListener("click", listener);
|
|
477
|
-
eventReceiver.click();
|
|
478
|
-
(0, chai_1.expect)(clicked).to.eq(1);
|
|
479
|
-
});
|
|
480
|
-
/*it("it must handle innerText properly", function (done) {
|
|
481
|
-
|
|
482
|
-
//jsdom bug
|
|
483
|
-
Object.defineProperty(Object.prototype, 'innerText', {
|
|
484
|
-
get() {
|
|
485
|
-
return this.textContent;
|
|
486
|
-
},
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
let probe = DomQuery.byId("id_1");
|
|
490
|
-
probe.innerHTML = "<div>hello</div><div>world</div>";
|
|
491
|
-
// bug in domjs in current revision, textContent is ignored
|
|
492
|
-
// todo reenable when jsdom has fixed innerText
|
|
493
|
-
expect(probe.innerText()).to.eq("helloworld");
|
|
494
|
-
done();
|
|
495
|
-
});*/
|
|
496
|
-
(0, mocha_1.it)("it must handle textContent properly", function () {
|
|
497
|
-
let probe = mona_dish_1.DomQuery.byId("id_1");
|
|
498
|
-
probe.innerHTML = "<div>hello</div><div>world</div>";
|
|
499
|
-
(0, chai_1.expect)(probe.textContent()).to.eq("helloworld");
|
|
500
|
-
});
|
|
501
|
-
(0, mocha_1.it)("it must handle iterations properly", function () {
|
|
502
|
-
let probe = mona_dish_1.DomQuery.byTagName("div");
|
|
503
|
-
let resArr = mona_dish_1.LazyStream.ofStreamDataSource(probe).collect(new mona_dish_1.ArrayCollector());
|
|
504
|
-
(0, chai_1.expect)(resArr.length).to.eq(4);
|
|
505
|
-
probe.reset();
|
|
506
|
-
while (probe.hasNext()) {
|
|
507
|
-
let el = probe.next();
|
|
508
|
-
(0, chai_1.expect)(el.tagName.value.toLowerCase()).to.eq("div");
|
|
509
|
-
}
|
|
510
|
-
(0, chai_1.expect)(probe.next()).to.eq(null);
|
|
511
|
-
let probe2 = mona_dish_1.DomQuery.byTagName("div").limits(2);
|
|
512
|
-
resArr = mona_dish_1.LazyStream.ofStreamDataSource(probe2).collect(new mona_dish_1.ArrayCollector());
|
|
513
|
-
(0, chai_1.expect)(resArr.length).to.eq(2);
|
|
514
|
-
});
|
|
515
|
-
(0, mocha_1.it)("it must handle subnodes properly", function () {
|
|
516
|
-
let probe = mona_dish_1.DomQuery.byTagName("div");
|
|
517
|
-
(0, chai_1.expect)(probe.subNodes(1, 3).length).to.eq(2);
|
|
518
|
-
probe = mona_dish_1.DomQuery.byTagName("body").childNodes.subNodes(0, 2);
|
|
519
|
-
(0, chai_1.expect)(probe.length).to.eq(2);
|
|
520
|
-
probe = mona_dish_1.DomQuery.byTagName("div").subNodes(2);
|
|
521
|
-
(0, chai_1.expect)(probe.length).to.eq(2);
|
|
522
|
-
});
|
|
523
|
-
(0, mocha_1.it)("it must ensure shadow dom creation works properly", function () {
|
|
524
|
-
let probe = mona_dish_1.DomQuery.byTagName("div");
|
|
525
|
-
try {
|
|
526
|
-
//probably not testable atm, mocha does not have shadow dom support
|
|
527
|
-
//we might be able to shim it in one way or the other
|
|
528
|
-
let element = probe.attachShadow();
|
|
529
|
-
(0, chai_1.expect)(element.length > 0).to.eq(true);
|
|
530
|
-
}
|
|
531
|
-
catch (e) {
|
|
532
|
-
//not supported we still need to get an error here
|
|
533
|
-
(0, chai_1.expect)(e.message.indexOf("not supported") != -1).to.be.true;
|
|
534
|
-
}
|
|
535
|
-
});
|
|
536
|
-
(0, mocha_1.it)("parent must break shadow barriers", function () {
|
|
537
|
-
let probe = mona_dish_1.DomQuery.fromMarkup("<div id='shadowItem'>hello</div>'");
|
|
538
|
-
try {
|
|
539
|
-
//probably not testable atm, mocha does not have shadow dom support
|
|
540
|
-
//we might be able to shim it in one way or the other
|
|
541
|
-
let element = mona_dish_1.DomQuery.byId("id_1").attachShadow();
|
|
542
|
-
element.append(probe);
|
|
543
|
-
(0, chai_1.expect)(probe.firstParent("#id_1").length > 0).to.eq(true);
|
|
544
|
-
}
|
|
545
|
-
catch (e) {
|
|
546
|
-
//not supported we still need to get an error here
|
|
547
|
-
(0, chai_1.expect)(e.message.indexOf("not supported") != -1).to.be.true;
|
|
548
|
-
}
|
|
549
|
-
});
|
|
550
|
-
(0, mocha_1.it)('it must have a working wait for dom with mut observer and must detect condition after change', function () {
|
|
551
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
552
|
-
let probe = mona_dish_1.DomQuery.byId('id_1');
|
|
553
|
-
probe.innerHTML = 'true';
|
|
554
|
-
let ret = yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
555
|
-
(0, chai_1.expect)(ret.isPresent());
|
|
556
|
-
probe = mona_dish_1.DomQuery.byId('bosushsdhs');
|
|
557
|
-
ret = yield probe.waitUntilDom((element) => element.isAbsent());
|
|
558
|
-
(0, chai_1.expect)(ret.isAbsent());
|
|
559
|
-
});
|
|
560
|
-
});
|
|
561
|
-
(0, mocha_1.it)('it must have a working wait for dom with mut observer', function () {
|
|
562
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
563
|
-
let probe = mona_dish_1.DomQuery.byId('id_1');
|
|
564
|
-
setTimeout(() => probe.innerHTML = 'true', 300);
|
|
565
|
-
let ret = yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
566
|
-
delete window.MutationObserver;
|
|
567
|
-
delete global.MutationObserver;
|
|
568
|
-
probe.innerHTML = "";
|
|
569
|
-
setTimeout(() => probe.innerHTML = 'true', 300);
|
|
570
|
-
let ret2 = yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
571
|
-
(0, chai_1.expect)(ret.isPresent() && ret2.isPresent());
|
|
572
|
-
});
|
|
573
|
-
});
|
|
574
|
-
(0, mocha_1.it)('it must have a timeout', function () {
|
|
575
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
576
|
-
let probe = mona_dish_1.DomQuery.byId('booga');
|
|
577
|
-
try {
|
|
578
|
-
setTimeout(() => probe.innerHTML = 'true', 300);
|
|
579
|
-
yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
580
|
-
chai_1.expect.fail("must have a timeout");
|
|
581
|
-
}
|
|
582
|
-
catch (ex) {
|
|
583
|
-
(0, chai_1.expect)(!!ex);
|
|
584
|
-
}
|
|
585
|
-
try {
|
|
586
|
-
delete window.MutationObserver;
|
|
587
|
-
delete global.MutationObserver;
|
|
588
|
-
probe.innerHTML = "";
|
|
589
|
-
setTimeout(() => probe.innerHTML = 'true', 300);
|
|
590
|
-
yield probe.waitUntilDom((element) => element.innerHTML.indexOf('true') != -1);
|
|
591
|
-
chai_1.expect.fail("must have a timeout");
|
|
592
|
-
}
|
|
593
|
-
catch (ex2) {
|
|
594
|
-
(0, chai_1.expect)(!!ex2);
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
});
|
|
598
|
-
(0, mocha_1.it)('must handle null inputs correctly', function () {
|
|
599
|
-
const dq = new mona_dish_1.DomQuery(null);
|
|
600
|
-
(0, chai_1.expect)(dq.isAbsent()).to.eq(true);
|
|
601
|
-
});
|
|
602
|
-
(0, mocha_1.it)('concat must work as expected resulting', function () {
|
|
603
|
-
let probe = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
604
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("body");
|
|
605
|
-
let result = probe.concat(probe2);
|
|
606
|
-
(0, chai_1.expect)(result.length).to.eq(probe.length + probe2.length);
|
|
607
|
-
//lets now check for filter double
|
|
608
|
-
probe2 = mona_dish_1.DomQuery.querySelectorAll('div');
|
|
609
|
-
result = probe.concat(probe2);
|
|
610
|
-
(0, chai_1.expect)(result.length).to.eq(probe.length);
|
|
611
|
-
});
|
|
612
|
-
(0, mocha_1.it)('must handle match correctly', function () {
|
|
613
|
-
let probe = mona_dish_1.DomQuery.querySelectorAll("div").first();
|
|
614
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("body").first();
|
|
615
|
-
(0, chai_1.expect)(probe.matchesSelector("div")).to.eq(true);
|
|
616
|
-
(0, chai_1.expect)(probe2.matchesSelector("body")).to.eq(true);
|
|
617
|
-
(0, chai_1.expect)(probe2.matchesSelector("div")).to.eq(false);
|
|
618
|
-
});
|
|
619
|
-
(0, mocha_1.it)('must by recycleable', function () {
|
|
620
|
-
let probe = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
621
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("body");
|
|
622
|
-
let res1 = probe.filter(item => item.matchesSelector("div"));
|
|
623
|
-
(0, chai_1.expect)(res1.length).to.eq(4);
|
|
624
|
-
let res2 = probe.filter(item => item.matchesSelector("div"));
|
|
625
|
-
(0, chai_1.expect)(res2.length).to.eq(4);
|
|
626
|
-
});
|
|
627
|
-
(0, mocha_1.it)('delete must work', function () {
|
|
628
|
-
let probe = mona_dish_1.DomQuery.querySelectorAll("body");
|
|
629
|
-
let probe2 = mona_dish_1.DomQuery.fromMarkup("<div id='deleteprobe1'>snafu</div>");
|
|
630
|
-
probe2.appendTo(probe);
|
|
631
|
-
(0, chai_1.expect)(probe.querySelectorAll("#deleteprobe1").isPresent()).to.eq(true);
|
|
632
|
-
probe2.delete();
|
|
633
|
-
(0, chai_1.expect)(probe.querySelectorAll("#deleteprobe1").isAbsent()).to.eq(true);
|
|
634
|
-
});
|
|
635
|
-
(0, mocha_1.it)('must work with rxjs and domquery', function () {
|
|
636
|
-
let probe = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
637
|
-
let probe2 = mona_dish_1.DomQuery.querySelectorAll("div");
|
|
638
|
-
let probeCnt = 0;
|
|
639
|
-
let probe2Cnt = 0;
|
|
640
|
-
(0, rxjs_1.from)(probe).subscribe(el => probeCnt++);
|
|
641
|
-
(0, rxjs_1.from)(mona_dish_1.Stream.ofDataSource(probe2)).subscribe(el => probe2Cnt++);
|
|
642
|
-
(0, chai_1.expect)(probeCnt).to.be.above(0);
|
|
643
|
-
(0, chai_1.expect)(probeCnt).to.eq(probe2Cnt);
|
|
644
|
-
});
|
|
645
|
-
(0, mocha_1.it)('must handle closest properly', function () {
|
|
646
|
-
let probe = mona_dish_1.DomQuery.byId("id_1");
|
|
647
|
-
probe.innerHTML = "<div id='inner_elem'>hello world<div id='inner_elem2'></div></div>";
|
|
648
|
-
let probe2 = mona_dish_1.DomQuery.byId("inner_elem");
|
|
649
|
-
(0, chai_1.expect)(probe2.closest("div#id_1").id.value).to.eq("id_1");
|
|
650
|
-
(0, chai_1.expect)(probe2.parent().closest("div").id.value).to.eq("id_1");
|
|
651
|
-
probe2 = mona_dish_1.DomQuery.byId("inner_elem2");
|
|
652
|
-
(0, chai_1.expect)(probe2.closest("div").id.value).to.eq("inner_elem2");
|
|
653
|
-
(0, chai_1.expect)(probe2.closest("div#id_1").id.value).to.eq("id_1");
|
|
654
|
-
(0, chai_1.expect)(probe2.parent().parent().closest("div").id.value).to.eq("id_1");
|
|
655
|
-
});
|
|
656
|
-
});
|
|
657
|
-
//# sourceMappingURL=DomQueryTest.spec.js.map
|