jsf.js_next_gen 4.0.1-beta.2 → 4.0.1-beta.4
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/README.md +6 -0
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/myfaces.ab.html +1 -1
- package/dist/docs/functions/{myfaces.onOnDomReady.html → myfaces.onDomReady.html} +5 -5
- package/dist/docs/index.html +9 -0
- package/dist/docs/modules/myfaces.html +2 -2
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1292 -1296
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1292 -1296
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +5 -5
- package/plans for 4.0.1.txt +8 -0
- package/src/main/typescript/api/_api.ts +1 -1
- package/src/main/typescript/impl/AjaxImpl.ts +63 -47
- package/src/main/typescript/impl/core/Const.ts +5 -2
- package/src/main/typescript/impl/util/AsyncRunnable.ts +81 -6
- package/src/main/typescript/impl/util/ExtDomQuery.ts +7 -9
- package/src/main/typescript/impl/util/FileUtils.ts +26 -22
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +7 -3
- package/src/main/typescript/impl/util/Lang.ts +62 -4
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +12 -10
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +33 -19
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +51 -72
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +179 -40
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +3 -2
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +24 -6
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +9 -1
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +13 -5
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +9 -2
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +89 -8
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +6 -1
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +32 -24
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +9 -1
- package/src/main/typescript/test/xhrCore/WebsocketTest.ts +10 -3
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +9 -2
- package/target/api/_api.js +2 -2
- package/target/api/_api.js.map +1 -1
- package/target/impl/AjaxImpl.js +51 -41
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +7 -5
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +60 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +8 -8
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +21 -19
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/util/HiddenInputBuilder.js +7 -3
- package/target/impl/util/HiddenInputBuilder.js.map +1 -1
- package/target/impl/util/Lang.js +53 -1
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +9 -7
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +30 -15
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +43 -64
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +5 -3
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +138 -37
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +3 -2
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +19 -1
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +26 -19
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +8 -0
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +11 -3
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/OamSubmitTest.spec.js +8 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +81 -4
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +6 -0
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +30 -15
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +8 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +9 -0
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +8 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export const tobagoSheetWithoutHeader = `<tobago-sheet id="page:mainForm:s1" data-tobago-selection-mode="multi" data-tobago-first="0" rows="0" row-count="88" data-tobago-layout="{"columns":[1.0]}">
|
|
2
|
+
<style nonce="" id="page:mainForm:s1:j_id_2n">#page\\:mainForm\\:s1{max-height:486px;}
|
|
3
|
+
</style>
|
|
4
|
+
<input id="page:mainForm:s1::widths" name="page:mainForm:s1::widths" type="hidden" value="[]">
|
|
5
|
+
<input id="page:mainForm:s1::rendered" name="page:mainForm:s1::rendered" type="hidden" value="[true]">
|
|
6
|
+
<input id="page:mainForm:s1::scrollPosition" name="page:mainForm:s1::scrollPosition" type="hidden" value="[0,0]">
|
|
7
|
+
<input id="page:mainForm:s1::selected" name="page:mainForm:s1::selected" type="hidden" value="[]">
|
|
8
|
+
<div class="tobago-body">
|
|
9
|
+
<table cellspacing="0" cellpadding="0" summary="" class="table table-sm tobago-tableLayout-fixed">
|
|
10
|
+
<colgroup>
|
|
11
|
+
<col>
|
|
12
|
+
<col>
|
|
13
|
+
</colgroup>
|
|
14
|
+
<tbody>
|
|
15
|
+
<tr row-index="0" id="page:mainForm:s1:0:sample0">
|
|
16
|
+
<td>
|
|
17
|
+
<tobago-out id="page:mainForm:s1:0:t_name"><span class="form-control-plaintext">Sun</span></tobago-out>
|
|
18
|
+
</td>
|
|
19
|
+
<td>
|
|
20
|
+
<div>
|
|
21
|
+
</div>
|
|
22
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:0:sample0" execute="page:mainForm:s1:0:sample0"></tobago-behavior>
|
|
23
|
+
</td>
|
|
24
|
+
</tr>
|
|
25
|
+
<tr row-index="1" id="page:mainForm:s1:1:sample0">
|
|
26
|
+
<td>
|
|
27
|
+
<tobago-out id="page:mainForm:s1:1:t_name"><span class="form-control-plaintext">Mercury</span></tobago-out>
|
|
28
|
+
</td>
|
|
29
|
+
<td>
|
|
30
|
+
<div>
|
|
31
|
+
</div>
|
|
32
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:1:sample0" execute="page:mainForm:s1:1:sample0"></tobago-behavior>
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
<tr row-index="2" id="page:mainForm:s1:2:sample0">
|
|
36
|
+
<td>
|
|
37
|
+
<tobago-out id="page:mainForm:s1:2:t_name"><span class="form-control-plaintext">Venus</span></tobago-out>
|
|
38
|
+
</td>
|
|
39
|
+
<td>
|
|
40
|
+
<div>
|
|
41
|
+
</div>
|
|
42
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:2:sample0" execute="page:mainForm:s1:2:sample0"></tobago-behavior>
|
|
43
|
+
</td>
|
|
44
|
+
</tr>
|
|
45
|
+
<tr row-index="3" id="page:mainForm:s1:3:sample0">
|
|
46
|
+
<td>
|
|
47
|
+
<tobago-out id="page:mainForm:s1:3:t_name"><span class="form-control-plaintext">Earth</span></tobago-out>
|
|
48
|
+
</td>
|
|
49
|
+
<td>
|
|
50
|
+
<div>
|
|
51
|
+
</div>
|
|
52
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:3:sample0" execute="page:mainForm:s1:3:sample0"></tobago-behavior>
|
|
53
|
+
</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr row-index="4" id="page:mainForm:s1:4:sample0">
|
|
56
|
+
<td>
|
|
57
|
+
<tobago-out id="page:mainForm:s1:4:t_name"><span class="form-control-plaintext">Mars</span></tobago-out>
|
|
58
|
+
</td>
|
|
59
|
+
<td>
|
|
60
|
+
<div>
|
|
61
|
+
</div>
|
|
62
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:4:sample0" execute="page:mainForm:s1:4:sample0"></tobago-behavior>
|
|
63
|
+
</td>
|
|
64
|
+
</tr>
|
|
65
|
+
<tr row-index="5" id="page:mainForm:s1:5:sample0">
|
|
66
|
+
<td>
|
|
67
|
+
<tobago-out id="page:mainForm:s1:5:t_name"><span class="form-control-plaintext">Jupiter</span></tobago-out>
|
|
68
|
+
</td>
|
|
69
|
+
<td>
|
|
70
|
+
<div>
|
|
71
|
+
</div>
|
|
72
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:5:sample0" execute="page:mainForm:s1:5:sample0"></tobago-behavior>
|
|
73
|
+
</td>
|
|
74
|
+
</tr>
|
|
75
|
+
<tr row-index="6" id="page:mainForm:s1:6:sample0">
|
|
76
|
+
<td>
|
|
77
|
+
<tobago-out id="page:mainForm:s1:6:t_name"><span class="form-control-plaintext">Saturn</span></tobago-out>
|
|
78
|
+
</td>
|
|
79
|
+
<td>
|
|
80
|
+
<div>
|
|
81
|
+
</div>
|
|
82
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:6:sample0" execute="page:mainForm:s1:6:sample0"></tobago-behavior>
|
|
83
|
+
</td>
|
|
84
|
+
</tr>
|
|
85
|
+
<tr row-index="7" id="page:mainForm:s1:7:sample0">
|
|
86
|
+
<td>
|
|
87
|
+
<tobago-out id="page:mainForm:s1:7:t_name"><span class="form-control-plaintext">Uranus</span></tobago-out>
|
|
88
|
+
</td>
|
|
89
|
+
<td>
|
|
90
|
+
<div>
|
|
91
|
+
</div>
|
|
92
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:7:sample0" execute="page:mainForm:s1:7:sample0"></tobago-behavior>
|
|
93
|
+
</td>
|
|
94
|
+
</tr>
|
|
95
|
+
<tr row-index="8" id="page:mainForm:s1:8:sample0">
|
|
96
|
+
<td>
|
|
97
|
+
<tobago-out id="page:mainForm:s1:8:t_name"><span class="form-control-plaintext">Neptune</span></tobago-out>
|
|
98
|
+
</td>
|
|
99
|
+
<td>
|
|
100
|
+
<div>
|
|
101
|
+
</div>
|
|
102
|
+
<tobago-behavior event="click" client-id="page:mainForm:s1:8:sample0" execute="page:mainForm:s1:8:sample0"></tobago-behavior>
|
|
103
|
+
</td>
|
|
104
|
+
</tr>
|
|
105
|
+
</tbody>
|
|
106
|
+
</table>
|
|
107
|
+
</div>
|
|
108
|
+
</tobago-sheet>`;
|
|
@@ -83,6 +83,7 @@ export module StandardInits {
|
|
|
83
83
|
<body>
|
|
84
84
|
<form id="blarg">
|
|
85
85
|
<input type="text" id="input_1" name="input_1" value="input_1_val"></input>
|
|
86
|
+
<input type="text" id="input_2_text" name="input_2_text" value="input_2_text_val"></input>
|
|
86
87
|
<input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
|
|
87
88
|
<input type="button" id="input_2" name="input_2" value="input_1_val"></input>
|
|
88
89
|
</form>
|
|
@@ -222,7 +223,7 @@ export module StandardInits {
|
|
|
222
223
|
<meta charset="UTF-8">
|
|
223
224
|
<title>Title</title>
|
|
224
225
|
<script type="text/javascript"
|
|
225
|
-
src="
|
|
226
|
+
src="./fixtures/${IS_40 ? 'jakarta' : 'javax'}.faces.resource/${IS_40 ? 'faces': 'jsf'}.js.jsf?ln=jakarta.faces&separator=${separatorChar}"></script>
|
|
226
227
|
</head>
|
|
227
228
|
<body>
|
|
228
229
|
<form id="blarg">
|
|
@@ -513,7 +514,7 @@ export module StandardInits {
|
|
|
513
514
|
//let dom2 = new JSDOM(template)
|
|
514
515
|
//return initMyFacesFromDom(dom2);
|
|
515
516
|
let clean = null;
|
|
516
|
-
//we use jsdom global to
|
|
517
|
+
//we use jsdom global to fulfill our requirements
|
|
517
518
|
//we need to import dynamically and use awaits
|
|
518
519
|
if (withJsf) {
|
|
519
520
|
|
|
File without changes
|
|
@@ -15,13 +15,14 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import {Config, DomQuery} from "mona-dish";
|
|
18
|
-
import {describe, it} from 'mocha';
|
|
18
|
+
import {afterEach, describe, it} from 'mocha';
|
|
19
19
|
import {expect} from 'chai';
|
|
20
20
|
import * as sinon from 'sinon';
|
|
21
21
|
|
|
22
22
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
23
23
|
import {CTX_PARAM_REQ_PASS_THR, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
|
|
24
24
|
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
25
|
+
import {_Es2019Array} from "mona-dish";
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
sinon.reset();
|
|
@@ -37,11 +38,26 @@ declare var Implementation: any;
|
|
|
37
38
|
*/
|
|
38
39
|
|
|
39
40
|
describe('faces.ajax.request test suite', () => {
|
|
40
|
-
|
|
41
|
+
let oldFlatMap = null;
|
|
41
42
|
beforeEach(async () => {
|
|
42
|
-
|
|
43
|
+
//we test ES2019 with it and whether we have missed
|
|
44
|
+
//a map somewhere
|
|
45
|
+
return await defaultMyFaces().then( () => {
|
|
46
|
+
if(Array.prototype.map) {
|
|
47
|
+
oldFlatMap =Array.prototype["flatMap"];
|
|
48
|
+
window["Es2019Array"] = _Es2019Array;
|
|
49
|
+
delete Array.prototype["flatMap"];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
43
52
|
});
|
|
44
53
|
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
if(oldFlatMap) {
|
|
56
|
+
Array.prototype["flatMap"] = oldFlatMap;
|
|
57
|
+
oldFlatMap = null;
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
|
|
45
61
|
it("faces.ajax.request can be called", () => {
|
|
46
62
|
//we stub the addRequestToQueue, to enable the request check only
|
|
47
63
|
//without any xhr and response, both will be tested separately for
|
|
@@ -50,12 +66,15 @@ describe('faces.ajax.request test suite', () => {
|
|
|
50
66
|
//now the faces.ajax.request should trigger but should not go into
|
|
51
67
|
//the asynchronous event loop.
|
|
52
68
|
//lets check it out
|
|
69
|
+
let flatMap = Array.prototype.flatMap;
|
|
53
70
|
|
|
54
71
|
try {
|
|
55
72
|
DomQuery.byId("input_2").addEventListener("click", (event: Event) => {
|
|
56
|
-
|
|
73
|
+
|
|
74
|
+
faces.ajax.request(null, event, {render: '@all', execute: '@form'});
|
|
57
75
|
}).click();
|
|
58
76
|
|
|
77
|
+
|
|
59
78
|
expect(addRequestToQueue.called).to.be.true;
|
|
60
79
|
expect(addRequestToQueue.callCount).to.eq(1);
|
|
61
80
|
const context = (<Config>addRequestToQueue.args[0][2]);
|
|
@@ -103,7 +122,7 @@ describe('faces.ajax.request test suite', () => {
|
|
|
103
122
|
called["func5"] = true;
|
|
104
123
|
return false;
|
|
105
124
|
};
|
|
106
|
-
|
|
125
|
+
delete Array.prototype["flatMap"];
|
|
107
126
|
faces.util.chain(this, called, func1, func2, func3, func4, func5);
|
|
108
127
|
|
|
109
128
|
expect(called["func1"]).to.be.true;
|
|
@@ -118,7 +137,6 @@ describe('faces.ajax.request test suite', () => {
|
|
|
118
137
|
expect(called["func2"]).to.be.true;
|
|
119
138
|
expect(!!called["func4"]).to.be.true;
|
|
120
139
|
expect(!!called["func5"]).to.be.false;
|
|
121
|
-
|
|
122
140
|
});
|
|
123
141
|
|
|
124
142
|
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3
|
+
* this work for additional information regarding copyright ownership.
|
|
4
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
|
6
|
+
* the License. You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {describe, it} from "mocha";
|
|
18
|
+
|
|
19
|
+
import {expect} from "chai";
|
|
20
|
+
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
21
|
+
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
declare var myfaces: any;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Adds test s for the newly introduced onload handling
|
|
29
|
+
*/
|
|
30
|
+
describe('Tests on the xhr core when it starts to call the request', function () {
|
|
31
|
+
|
|
32
|
+
beforeEach(async () => {
|
|
33
|
+
return
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("must be present", async function(done) {
|
|
37
|
+
await defaultMyFaces();
|
|
38
|
+
expect(myfaces?.onDomReady).to.exist;
|
|
39
|
+
done();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("must be called on onDocumentReady", async function(done) {
|
|
43
|
+
let called: boolean = false;
|
|
44
|
+
const onDomCalled = () => {
|
|
45
|
+
expect(true).to.true;
|
|
46
|
+
done();
|
|
47
|
+
}
|
|
48
|
+
myfaces?.onDomReady(onDomCalled);
|
|
49
|
+
await defaultMyFaces();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
});
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
* we need a probe to test our asynchronous behavior
|
|
19
19
|
* the asynchronous behavior needs to be in an asynchronous runnable
|
|
20
20
|
*/
|
|
21
|
-
import {
|
|
21
|
+
import {IAsyncRunnable} from "../../impl/util/AsyncRunnable";
|
|
22
22
|
import {IValueHolder} from "mona-dish";
|
|
23
23
|
|
|
24
|
-
export class ProbeClass implements
|
|
24
|
+
export class ProbeClass implements IAsyncRunnable<Promise<any>>, IValueHolder<Promise<any>> {
|
|
25
25
|
|
|
26
26
|
value: Promise<any>;
|
|
27
27
|
fCatch: (data: any) => any;
|
|
@@ -44,7 +44,7 @@ export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Pro
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
catch(func: (data: any) => any):
|
|
47
|
+
catch(func: (data: any) => any): IAsyncRunnable<boolean> {
|
|
48
48
|
let catchFunc = (data: any) => {
|
|
49
49
|
this.catchPerformed = true;
|
|
50
50
|
return func(data);
|
|
@@ -57,7 +57,7 @@ export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Pro
|
|
|
57
57
|
return this;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
finally(func: () => void):
|
|
60
|
+
finally(func: () => void): IAsyncRunnable<boolean> {
|
|
61
61
|
let finallyFunc = () => {
|
|
62
62
|
this.finallyPerformed = true;
|
|
63
63
|
func();
|
|
@@ -88,7 +88,7 @@ export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Pro
|
|
|
88
88
|
//TODO do something with it
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
then(func: (data: any) => any):
|
|
91
|
+
then(func: (data: any) => any): IAsyncRunnable<boolean> {
|
|
92
92
|
|
|
93
93
|
let thenFunc = (data: any) => {
|
|
94
94
|
this.thenPerformed = true;
|
|
@@ -18,10 +18,11 @@ import {describe, it} from 'mocha';
|
|
|
18
18
|
import {expect} from 'chai';
|
|
19
19
|
import * as sinon from 'sinon';
|
|
20
20
|
import {ProbeClass} from "./AsynchronousProbe";
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
23
23
|
import {Implementation} from "../../impl/AjaxImpl";
|
|
24
24
|
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
25
|
+
import {XhrQueueController} from "../../impl/util/XhrQueueController";
|
|
25
26
|
|
|
26
27
|
describe('Asynchronous Queue tests', () => {
|
|
27
28
|
|
|
@@ -60,7 +61,7 @@ describe('Asynchronous Queue tests', () => {
|
|
|
60
61
|
|
|
61
62
|
const probe1 = new ProbeClass(setTimeout);
|
|
62
63
|
|
|
63
|
-
const queue = new
|
|
64
|
+
const queue = new XhrQueueController();
|
|
64
65
|
probe1.then(() => {
|
|
65
66
|
expect(probe1.thenPerformed, "called").to.be.true;
|
|
66
67
|
done();
|
|
@@ -69,7 +70,7 @@ describe('Asynchronous Queue tests', () => {
|
|
|
69
70
|
});
|
|
70
71
|
|
|
71
72
|
it('multiple entries', (done) => {
|
|
72
|
-
const queue = new
|
|
73
|
+
const queue = new XhrQueueController();
|
|
73
74
|
const probe1 = new ProbeClass(setTimeout);
|
|
74
75
|
const probe2 = new ProbeClass(setTimeout);
|
|
75
76
|
const probe3 = new ProbeClass(setTimeout);
|
|
@@ -87,28 +87,34 @@ describe('tests the addOnEvent and addOnError handling', function () {
|
|
|
87
87
|
});
|
|
88
88
|
|
|
89
89
|
it("must have onError called in case of error", function () {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
errorTitle =
|
|
97
|
-
errorMessage =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
90
|
+
const oldErr = console.error;
|
|
91
|
+
console.error = () => {}
|
|
92
|
+
try {
|
|
93
|
+
let onErrorCalled1 = 0;
|
|
94
|
+
let onErrorCalled2 = 0;
|
|
95
|
+
|
|
96
|
+
let errorTitle = '';
|
|
97
|
+
let errorMessage = '';
|
|
98
|
+
faces.ajax.addOnError((data: any) => {
|
|
99
|
+
errorTitle = data.errorName;
|
|
100
|
+
errorMessage = data.errorMessage;
|
|
101
|
+
onErrorCalled1++
|
|
102
|
+
});
|
|
103
|
+
faces.ajax.addOnError(() => {
|
|
104
|
+
onErrorCalled2++;
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
//cmd_error_component
|
|
108
|
+
DQ.byId("cmd_error_component").click();
|
|
109
|
+
this.respond(XmlResponses.ERROR_2);
|
|
110
|
+
|
|
111
|
+
expect(onErrorCalled1).to.eq(1);
|
|
112
|
+
expect(onErrorCalled2).to.eq(1);
|
|
113
|
+
expect(errorTitle).to.eq('Erro21');
|
|
114
|
+
expect(errorMessage).to.eq('serverError: Error2 Text');
|
|
115
|
+
} finally {
|
|
116
|
+
console.error = oldErr;
|
|
117
|
+
}
|
|
112
118
|
});
|
|
113
119
|
|
|
114
120
|
it("must have an id set if there is an emitting element", function () {
|
|
@@ -17,7 +17,7 @@ import {describe, it} from "mocha";
|
|
|
17
17
|
import * as sinon from "sinon";
|
|
18
18
|
import {expect} from "chai";
|
|
19
19
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
20
|
-
import {DomQuery, DQ} from "mona-dish";
|
|
20
|
+
import {_Es2019Array, DomQuery, DQ} from "mona-dish";
|
|
21
21
|
import defaultFileForm = StandardInits.defaultFileForm;
|
|
22
22
|
import {Implementation} from "../../impl/AjaxImpl";
|
|
23
23
|
|
|
@@ -27,6 +27,7 @@ declare var faces: any;
|
|
|
27
27
|
* specialized tests testing the xhr core behavior when it hits the xmlHttpRequest object
|
|
28
28
|
*/
|
|
29
29
|
describe('Tests on the xhr core when it starts to call the request', function () {
|
|
30
|
+
let oldFlatMap = null;
|
|
30
31
|
beforeEach(async function () {
|
|
31
32
|
|
|
32
33
|
let waitForResult = defaultFileForm();
|
|
@@ -47,6 +48,9 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
47
48
|
};
|
|
48
49
|
(<any>global).XMLHttpRequest = this.xhr;
|
|
49
50
|
window.XMLHttpRequest = this.xhr;
|
|
51
|
+
oldFlatMap =Array.prototype["flatMap"];
|
|
52
|
+
window["Es2019Array"] = _Es2019Array;
|
|
53
|
+
delete Array.prototype["flatMap"];
|
|
50
54
|
|
|
51
55
|
this.closeIt = () => {
|
|
52
56
|
(<any>global).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
@@ -59,6 +63,10 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
59
63
|
});
|
|
60
64
|
afterEach(function () {
|
|
61
65
|
this.closeIt();
|
|
66
|
+
if(oldFlatMap) {
|
|
67
|
+
Array.prototype["flatMap"] = oldFlatMap;
|
|
68
|
+
oldFlatMap = null;
|
|
69
|
+
}
|
|
62
70
|
});
|
|
63
71
|
|
|
64
72
|
it('must have sent a form multipart request', function (done) {
|
|
@@ -18,13 +18,13 @@ 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 {DomQuery, DQ$, Stream} from "mona-dish";
|
|
21
|
+
import {_Es2019Array, DomQuery, DQ$, Stream} from "mona-dish";
|
|
22
22
|
import {
|
|
23
23
|
$nsp,
|
|
24
24
|
COMPLETE,
|
|
25
25
|
P_AJAX,
|
|
26
26
|
P_EXECUTE,
|
|
27
|
-
|
|
27
|
+
P_AJAX_SOURCE,
|
|
28
28
|
P_RENDER,
|
|
29
29
|
P_VIEWSTATE,
|
|
30
30
|
P_WINDOW_ID,
|
|
@@ -50,6 +50,7 @@ let issueStdReq = function (element) {
|
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
describe('Namespacing tests', function () {
|
|
53
|
+
let oldFlatMap = null;
|
|
53
54
|
beforeEach(async function () {
|
|
54
55
|
|
|
55
56
|
let waitForResult = defaultMyFacesNamespaces();
|
|
@@ -65,6 +66,9 @@ describe('Namespacing tests', function () {
|
|
|
65
66
|
window.XMLHttpRequest = this.xhr;
|
|
66
67
|
|
|
67
68
|
this.jsfAjaxResponse = sinon.spy((<any>global).faces.ajax, "response");
|
|
69
|
+
oldFlatMap =Array.prototype["flatMap"];
|
|
70
|
+
window["Es2019Array"] = _Es2019Array;
|
|
71
|
+
delete Array.prototype["flatMap"];
|
|
68
72
|
|
|
69
73
|
this.closeIt = () => {
|
|
70
74
|
(<any>global).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
@@ -77,6 +81,10 @@ describe('Namespacing tests', function () {
|
|
|
77
81
|
|
|
78
82
|
afterEach(function () {
|
|
79
83
|
this.closeIt();
|
|
84
|
+
if(oldFlatMap) {
|
|
85
|
+
Array.prototype["flatMap"] = oldFlatMap;
|
|
86
|
+
oldFlatMap = null;
|
|
87
|
+
}
|
|
80
88
|
});
|
|
81
89
|
|
|
82
90
|
it('must send the element identifiers properly encoded', function () {
|
|
@@ -107,7 +115,7 @@ describe('Namespacing tests', function () {
|
|
|
107
115
|
expect(!!resultsMap["execute"]).to.be.false;
|
|
108
116
|
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
109
117
|
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
110
|
-
expect(resultsMap[
|
|
118
|
+
expect(resultsMap[P_AJAX_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
111
119
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
112
120
|
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
|
|
113
121
|
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
@@ -143,7 +151,7 @@ describe('Namespacing tests', function () {
|
|
|
143
151
|
expect(!!resultsMap["execute"]).to.be.false;
|
|
144
152
|
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
145
153
|
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
146
|
-
expect(resultsMap[
|
|
154
|
+
expect(resultsMap[P_AJAX_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
147
155
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
148
156
|
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
|
|
149
157
|
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
@@ -191,7 +199,7 @@ describe('Namespacing tests', function () {
|
|
|
191
199
|
let viewState = Stream.ofAssoc(resultsMap).filter(data => data[0].indexOf(P_VIEWSTATE) != -1).map(item => item[1]).first().value;
|
|
192
200
|
|
|
193
201
|
expect(viewState).to.eq("booga");
|
|
194
|
-
expect(resultsMap[NAMING_CONTAINER_PREF +
|
|
202
|
+
expect(resultsMap[NAMING_CONTAINER_PREF + P_AJAX_SOURCE]).to.eq("jd_0:input_2");
|
|
195
203
|
expect(resultsMap[NAMING_CONTAINER_PREF + P_AJAX]).to.eq("true");
|
|
196
204
|
expect(resultsMap[NAMING_CONTAINER_PREF + P_RENDER]).to.eq("jd_0:blarg jd_0:input_2");
|
|
197
205
|
expect(resultsMap[NAMING_CONTAINER_PREF + P_EXECUTE]).to.eq("jd_0:input_1 jd_0:input_2");
|
|
@@ -19,11 +19,11 @@ import * as sinon from "sinon";
|
|
|
19
19
|
import {Implementation} from "../../impl/AjaxImpl";
|
|
20
20
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
21
21
|
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
22
|
-
import {DQ, DQ$} from "mona-dish";
|
|
22
|
+
import {_Es2019Array, DQ, DQ$} from "mona-dish";
|
|
23
23
|
import {expect} from "chai";
|
|
24
24
|
|
|
25
25
|
describe('Tests for the MyFaces specifig oam submit', function () {
|
|
26
|
-
|
|
26
|
+
let oldFlatMap = null;
|
|
27
27
|
beforeEach(async function () {
|
|
28
28
|
|
|
29
29
|
let waitForResult = defaultMyFaces();
|
|
@@ -39,6 +39,9 @@ describe('Tests for the MyFaces specifig oam submit', function () {
|
|
|
39
39
|
window.XMLHttpRequest = this.xhr;
|
|
40
40
|
|
|
41
41
|
this.jsfAjaxResponse = sinon.spy((<any>global).faces.ajax, "response");
|
|
42
|
+
oldFlatMap =Array.prototype["flatMap"];
|
|
43
|
+
window["Es2019Array"] = _Es2019Array;
|
|
44
|
+
delete Array.prototype["flatMap"];
|
|
42
45
|
|
|
43
46
|
this.closeIt = () => {
|
|
44
47
|
(<any>global).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
@@ -51,6 +54,10 @@ describe('Tests for the MyFaces specifig oam submit', function () {
|
|
|
51
54
|
|
|
52
55
|
afterEach(function () {
|
|
53
56
|
this.closeIt();
|
|
57
|
+
if(oldFlatMap) {
|
|
58
|
+
Array.prototype["flatMap"] = oldFlatMap;
|
|
59
|
+
oldFlatMap = null;
|
|
60
|
+
}
|
|
54
61
|
});
|
|
55
62
|
|
|
56
63
|
it(("must handle oam submit correctly, tuples"), (done) => {
|
|
@@ -31,7 +31,7 @@ import {ExtConfig} from "../../impl/util/ExtDomQuery";
|
|
|
31
31
|
* @param keyValueEntries a list of key value entries divided by =
|
|
32
32
|
* @param paramsMapper a key value remapper
|
|
33
33
|
*/
|
|
34
|
-
function mergeKeyValueEntries(target: Config, keyValueEntries:
|
|
34
|
+
function mergeKeyValueEntries(target: Config, keyValueEntries: string[][], paramsMapper = (key, value) => [key, value]) {
|
|
35
35
|
|
|
36
36
|
function fixKeyWithoutVal(keyVal: string[]) {
|
|
37
37
|
return keyVal.length < 3 ? [keyVal?.[0] ?? [], keyVal?.[1] ?? []] : keyVal;
|
|
@@ -42,7 +42,7 @@ function mergeKeyValueEntries(target: Config, keyValueEntries: Stream<string[]>,
|
|
|
42
42
|
//special case of having keys without values
|
|
43
43
|
.map(keyVal => fixKeyWithoutVal(keyVal))
|
|
44
44
|
.map(keyVal => paramsMapper(keyVal[0] as string, keyVal[1]))
|
|
45
|
-
.
|
|
45
|
+
.forEach(keyVal => {
|
|
46
46
|
let value = keyVal?.splice(1)?.join("") ?? "";
|
|
47
47
|
if(toMerge.getIfPresent(keyVal[0]).isPresent()) {
|
|
48
48
|
toMerge.append(keyVal[0] as string).value = value;
|