jsf.js_next_gen 4.0.0-beta-23 → 4.0.1-alpha.0
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/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +13 -21
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +2 -0
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onDomReady.html +72 -0
- package/dist/docs/index.html +16 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2846 -2085
- 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.LICENSE.txt +17 -2
- 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 +2856 -2084
- 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.LICENSE.txt +17 -2
- 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 +19 -18
- package/plans for 4.0.1.txt +8 -0
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +19 -2
- package/src/main/typescript/api/_api.ts +68 -25
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +204 -100
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +56 -40
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncRunnable.ts +85 -10
- package/src/main/typescript/impl/util/ExtDomQuery.ts +65 -54
- package/src/main/typescript/impl/util/FileUtils.ts +108 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +93 -0
- package/src/main/typescript/impl/util/Lang.ts +91 -35
- package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +211 -138
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +92 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +111 -120
- package/src/main/typescript/myfaces/OamSubmit.ts +30 -14
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +163 -27
- 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 +111 -3
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- 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 +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
- 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 +5 -2
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +320 -15
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +45 -4
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +374 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +63 -21
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- package/target/api/jsf.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +177 -81
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +54 -39
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/util/Assertions.js +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.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 +66 -48
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +97 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +83 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/{types/index.js → impl/util/IAsyncRunnable.js} +11 -2
- package/target/impl/util/IAsyncRunnable.js.map +1 -0
- package/target/impl/util/Lang.js +81 -31
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +107 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.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/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +187 -119
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +82 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +94 -106
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +25 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +124 -23
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- 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/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +103 -3
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- 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 +2 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +288 -11
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +40 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +315 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
- package/target/types/index.js.map +0 -1
|
@@ -20,10 +20,10 @@ import {expect} from "chai";
|
|
|
20
20
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
21
21
|
import {DomQuery} from "mona-dish";
|
|
22
22
|
import {
|
|
23
|
-
COMPLETE,
|
|
23
|
+
COMPLETE, EMPTY_STR,
|
|
24
24
|
P_AJAX,
|
|
25
25
|
P_EXECUTE,
|
|
26
|
-
|
|
26
|
+
P_AJAX_SOURCE,
|
|
27
27
|
P_RENDER,
|
|
28
28
|
P_VIEWSTATE,
|
|
29
29
|
P_WINDOW_ID,
|
|
@@ -39,10 +39,35 @@ let issueStdReq = function (element) {
|
|
|
39
39
|
faces.ajax.request(element, null, {
|
|
40
40
|
execute: "input_1",
|
|
41
41
|
render: "@form",
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
params: {
|
|
43
|
+
pass1: "pass1",
|
|
44
|
+
pass2: "pass2"
|
|
45
|
+
}
|
|
44
46
|
});
|
|
45
47
|
};
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
let issueStdPPSReq = function (element) {
|
|
51
|
+
faces.ajax.request(element, null, {
|
|
52
|
+
execute: "input_1",
|
|
53
|
+
render: "@form",
|
|
54
|
+
/*
|
|
55
|
+
* myfaces is the extension placeholder, atm only pps is used
|
|
56
|
+
* which was the most useful extension in our legacy codebase
|
|
57
|
+
*/
|
|
58
|
+
myfaces: {
|
|
59
|
+
pps: true
|
|
60
|
+
},
|
|
61
|
+
/*
|
|
62
|
+
* params is the spec conform way to pass additional request paramerters
|
|
63
|
+
*/
|
|
64
|
+
params: {
|
|
65
|
+
pass1: "pass1",
|
|
66
|
+
pass2: "pass2"
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
|
|
46
71
|
/**
|
|
47
72
|
* specialized tests testing the xhr core behavior when it hits the xmlHttpRequest object
|
|
48
73
|
*/
|
|
@@ -103,7 +128,6 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
103
128
|
});
|
|
104
129
|
|
|
105
130
|
it('it must have the pass through values properly passed', function (done) {
|
|
106
|
-
|
|
107
131
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
108
132
|
try {
|
|
109
133
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
@@ -118,13 +142,16 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
118
142
|
resultsMap[keyVal[0]] = keyVal[1];
|
|
119
143
|
}
|
|
120
144
|
|
|
145
|
+
// normal request, all issuing form must be encoded!
|
|
146
|
+
expect(!!(resultsMap?.["input_2_text"] ?? false)).to.eq(true);
|
|
147
|
+
expect(!!(resultsMap?.["input_1"] ?? false)).to.eq(true);
|
|
121
148
|
expect(resultsMap["pass1"]).to.eq("pass1");
|
|
122
149
|
expect(resultsMap["pass2"]).to.eq("pass2");
|
|
123
150
|
expect(!!resultsMap["render"]).to.be.false;
|
|
124
151
|
expect(!!resultsMap["execute"]).to.be.false;
|
|
125
152
|
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
126
153
|
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
127
|
-
expect(resultsMap[
|
|
154
|
+
expect(resultsMap[P_AJAX_SOURCE]).to.eq("input_2");
|
|
128
155
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
129
156
|
expect(resultsMap[P_RENDER]).to.eq("blarg");
|
|
130
157
|
expect(resultsMap[P_EXECUTE]).to.eq("input_1%20input_2");
|
|
@@ -135,6 +162,35 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
135
162
|
done();
|
|
136
163
|
});
|
|
137
164
|
|
|
165
|
+
it('it must handle resetValues properly', function (done) {
|
|
166
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
167
|
+
try {
|
|
168
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
169
|
+
faces.ajax.request(element, null, {
|
|
170
|
+
execute: "input_1",
|
|
171
|
+
resetValues: true,
|
|
172
|
+
render: "@form",
|
|
173
|
+
params: {
|
|
174
|
+
pass1: "pass1",
|
|
175
|
+
pass2: "pass2"
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
expect(send.called).to.be.true;
|
|
180
|
+
let argsVal: any = send.args[0][0];
|
|
181
|
+
let arsArr = argsVal.split("&");
|
|
182
|
+
let resultsMap = {};
|
|
183
|
+
for (let val of arsArr) {
|
|
184
|
+
let keyVal = val.split("=");
|
|
185
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
186
|
+
}
|
|
187
|
+
expect(resultsMap["jakarta.faces.partial.resetValues"]).to.eq("true");
|
|
188
|
+
} finally {
|
|
189
|
+
send.restore();
|
|
190
|
+
}
|
|
191
|
+
done();
|
|
192
|
+
});
|
|
193
|
+
|
|
138
194
|
it('it must have the proper target type', function (done) {
|
|
139
195
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
140
196
|
try {
|
|
@@ -196,16 +252,24 @@ describe('Tests after core when it hits response', function () {
|
|
|
196
252
|
faces.ajax.request(element, null, {
|
|
197
253
|
execute: "input_1",
|
|
198
254
|
render: "@form",
|
|
199
|
-
|
|
200
|
-
|
|
255
|
+
params: {
|
|
256
|
+
pass1: "pass1",
|
|
257
|
+
pass2: "pass2"
|
|
258
|
+
},
|
|
259
|
+
message: "Hello World",
|
|
201
260
|
onevent: (evt: any) => {
|
|
202
261
|
localCnt++;
|
|
203
262
|
}
|
|
204
263
|
});
|
|
205
264
|
|
|
206
265
|
let xhrReq = this.requests[0];
|
|
266
|
+
let requestBody = xhrReq.requestBody.split("&");
|
|
207
267
|
|
|
208
268
|
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
269
|
+
expect(requestBody.indexOf("pass1=pass1")).not.to.eq(-1);
|
|
270
|
+
expect(requestBody.indexOf("pass2=pass2")).not.to.eq(-1);
|
|
271
|
+
expect(requestBody.indexOf("message=Hello%20World")).not.to.eq(-1);
|
|
272
|
+
|
|
209
273
|
expect(this.jsfAjaxResponse.callCount).to.eq(1);
|
|
210
274
|
//success ommitted due to fake response
|
|
211
275
|
expect(globalCnt == 3).to.eq(true);
|
|
@@ -220,7 +284,8 @@ describe('Tests after core when it hits response', function () {
|
|
|
220
284
|
|
|
221
285
|
});
|
|
222
286
|
|
|
223
|
-
it('it must have called request and the pass through values must be properly transferred
|
|
287
|
+
it('it must have called request and the pass through values must be properly transferred ' +
|
|
288
|
+
'into the context, via the old non spec conform behavior', function (done) {
|
|
224
289
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
225
290
|
let globalCnt = 0;
|
|
226
291
|
let localCnt = 0;
|
|
@@ -253,7 +318,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
253
318
|
expect(!!lastArg.onError).to.be.false;
|
|
254
319
|
expect(lastArg.pass1 == "pass1").to.be.true;
|
|
255
320
|
expect(lastArg.pass2 == "pass2").to.be.true;
|
|
256
|
-
expect(!!lastArg[
|
|
321
|
+
expect(!!lastArg[P_AJAX_SOURCE]).to.be.true;
|
|
257
322
|
expect(!!lastArg[P_AJAX]).to.be.true;
|
|
258
323
|
expect(!!lastArg[P_EXECUTE]).to.be.true;
|
|
259
324
|
expect(!!lastArg[P_RENDER]).to.be.true;
|
|
@@ -273,6 +338,67 @@ describe('Tests after core when it hits response', function () {
|
|
|
273
338
|
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
274
339
|
|
|
275
340
|
|
|
341
|
+
} catch (e) {
|
|
342
|
+
console.error(e);
|
|
343
|
+
|
|
344
|
+
} finally {
|
|
345
|
+
send.restore();
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
it('it must have allow array key value pairs as passthroughs', function (done) {
|
|
350
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
351
|
+
let globalCnt = 0;
|
|
352
|
+
let localCnt = 0;
|
|
353
|
+
let xhrReq = null;
|
|
354
|
+
|
|
355
|
+
try {
|
|
356
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
357
|
+
faces.ajax.addOnEvent(() => {
|
|
358
|
+
globalCnt++;
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
faces.ajax.request(element, null, {
|
|
363
|
+
execute: "input_1",
|
|
364
|
+
render: "@form",
|
|
365
|
+
params: [["pass1", "pass1"],
|
|
366
|
+
["pass2", "pass2"]],
|
|
367
|
+
|
|
368
|
+
onevent: (evt: any) => {
|
|
369
|
+
localCnt++;
|
|
370
|
+
if (evt.status == COMPLETE) {
|
|
371
|
+
expect(!!xhrReq.responseXML).to.be.true;
|
|
372
|
+
}
|
|
373
|
+
if (evt.status == SUCCESS) {
|
|
374
|
+
expect(this.jsfAjaxResponse.callCount).to.eq(1);
|
|
375
|
+
|
|
376
|
+
expect(this.jsfAjaxResponse.firstCall.args[0] instanceof XMLHttpRequest).to.be.true;
|
|
377
|
+
let lastArg = this.jsfAjaxResponse.firstCall.args[1];
|
|
378
|
+
expect(lastArg.onevent != null).to.be.true;
|
|
379
|
+
expect(lastArg.onevent instanceof Function).to.be.true;
|
|
380
|
+
expect(!!lastArg.onError).to.be.false;
|
|
381
|
+
expect(lastArg.pass1 == "pass1").to.be.true;
|
|
382
|
+
expect(lastArg.pass2 == "pass2").to.be.true;
|
|
383
|
+
expect(!!lastArg[P_AJAX_SOURCE]).to.be.true;
|
|
384
|
+
expect(!!lastArg[P_AJAX]).to.be.true;
|
|
385
|
+
expect(!!lastArg[P_EXECUTE]).to.be.true;
|
|
386
|
+
expect(!!lastArg[P_RENDER]).to.be.true;
|
|
387
|
+
|
|
388
|
+
expect(this.jsfAjaxResponse.firstCall.args.length).to.eq(2);
|
|
389
|
+
|
|
390
|
+
expect(globalCnt == 2).to.eq(true); //local before global
|
|
391
|
+
expect(localCnt == 3).to.eq(true);
|
|
392
|
+
|
|
393
|
+
done();
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
xhrReq = this.requests[0];
|
|
399
|
+
xhrReq.responsetype = "text/xml";
|
|
400
|
+
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
401
|
+
|
|
276
402
|
|
|
277
403
|
} catch (e) {
|
|
278
404
|
console.error(e);
|
|
@@ -282,6 +408,68 @@ describe('Tests after core when it hits response', function () {
|
|
|
282
408
|
}
|
|
283
409
|
});
|
|
284
410
|
|
|
411
|
+
it('it must have called request and the pass through values must be properly transferred into the context', function (done) {
|
|
412
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
413
|
+
let globalCnt = 0;
|
|
414
|
+
let localCnt = 0;
|
|
415
|
+
let xhrReq = null;
|
|
416
|
+
|
|
417
|
+
try {
|
|
418
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
419
|
+
faces.ajax.addOnEvent(() => {
|
|
420
|
+
globalCnt++;
|
|
421
|
+
});
|
|
422
|
+
|
|
423
|
+
|
|
424
|
+
faces.ajax.request(element, null, {
|
|
425
|
+
execute: "input_1",
|
|
426
|
+
render: "@form",
|
|
427
|
+
params: {
|
|
428
|
+
pass1: "pass1",
|
|
429
|
+
pass2: "pass2",
|
|
430
|
+
},
|
|
431
|
+
onevent: (evt: any) => {
|
|
432
|
+
localCnt++;
|
|
433
|
+
if (evt.status == COMPLETE) {
|
|
434
|
+
expect(!!xhrReq.responseXML).to.be.true;
|
|
435
|
+
}
|
|
436
|
+
if (evt.status == SUCCESS) {
|
|
437
|
+
expect(this.jsfAjaxResponse.callCount).to.eq(1);
|
|
438
|
+
|
|
439
|
+
expect(this.jsfAjaxResponse.firstCall.args[0] instanceof XMLHttpRequest).to.be.true;
|
|
440
|
+
let lastArg = this.jsfAjaxResponse.firstCall.args[1];
|
|
441
|
+
expect(lastArg.onevent != null).to.be.true;
|
|
442
|
+
expect(lastArg.onevent instanceof Function).to.be.true;
|
|
443
|
+
expect(!!lastArg.onError).to.be.false;
|
|
444
|
+
expect(lastArg.pass1 == "pass1").to.be.true;
|
|
445
|
+
expect(lastArg.pass2 == "pass2").to.be.true;
|
|
446
|
+
expect(!!lastArg[P_AJAX_SOURCE]).to.be.true;
|
|
447
|
+
expect(!!lastArg[P_AJAX]).to.be.true;
|
|
448
|
+
expect(!!lastArg[P_EXECUTE]).to.be.true;
|
|
449
|
+
expect(!!lastArg[P_RENDER]).to.be.true;
|
|
450
|
+
|
|
451
|
+
expect(this.jsfAjaxResponse.firstCall.args.length).to.eq(2);
|
|
452
|
+
|
|
453
|
+
expect(globalCnt == 2).to.eq(true); //local before global
|
|
454
|
+
expect(localCnt == 3).to.eq(true);
|
|
455
|
+
|
|
456
|
+
done();
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
});
|
|
460
|
+
|
|
461
|
+
xhrReq = this.requests[0];
|
|
462
|
+
xhrReq.responsetype = "text/xml";
|
|
463
|
+
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
464
|
+
|
|
465
|
+
|
|
466
|
+
} catch (e) {
|
|
467
|
+
console.error(e);
|
|
468
|
+
|
|
469
|
+
} finally {
|
|
470
|
+
send.restore();
|
|
471
|
+
}
|
|
472
|
+
});
|
|
285
473
|
|
|
286
474
|
|
|
287
475
|
it('it must have called onError in the error case', function (done) {
|
|
@@ -289,20 +477,23 @@ describe('Tests after core when it hits response', function () {
|
|
|
289
477
|
|
|
290
478
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
291
479
|
let xhrReq = null;
|
|
292
|
-
|
|
480
|
+
const oldErr = console.error;
|
|
293
481
|
try {
|
|
294
482
|
let errorCnt = 0;
|
|
483
|
+
|
|
295
484
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
296
485
|
faces.ajax.request(element, null, {
|
|
297
486
|
execute: "input_1",
|
|
298
487
|
render: "@form",
|
|
299
|
-
|
|
300
|
-
|
|
488
|
+
params: {
|
|
489
|
+
pass1: "pass1",
|
|
490
|
+
pass2: "pass2",
|
|
491
|
+
},
|
|
301
492
|
onerror: (error: any) => {
|
|
302
493
|
expect(error.type).to.eq("error");
|
|
303
|
-
expect(
|
|
494
|
+
expect(error.status).to.eq(EMPTY_STR);
|
|
304
495
|
expect(!!error.message).to.eq(true);
|
|
305
|
-
expect(!!error.source).to.eq(true);
|
|
496
|
+
expect(!!error.source?.id).to.eq(true);
|
|
306
497
|
expect(!!error.responseCode).to.eq(true);
|
|
307
498
|
expect(!!error.responseText).to.eq(true);
|
|
308
499
|
expect(!error.responseXML).to.eq(true);
|
|
@@ -310,6 +501,8 @@ describe('Tests after core when it hits response', function () {
|
|
|
310
501
|
},
|
|
311
502
|
onevent: (evt: any) => {
|
|
312
503
|
if (evt.status == COMPLETE) {
|
|
504
|
+
console.error = () => {
|
|
505
|
+
};
|
|
313
506
|
throw Error("This error is wanted, ignore the log");
|
|
314
507
|
}
|
|
315
508
|
}
|
|
@@ -320,12 +513,124 @@ describe('Tests after core when it hits response', function () {
|
|
|
320
513
|
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
321
514
|
|
|
322
515
|
} catch (e) {
|
|
516
|
+
if (e.message.indexOf("This error is wanted") != -1) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
323
519
|
console.error(e);
|
|
324
520
|
|
|
325
521
|
} finally {
|
|
522
|
+
console.error = oldErr;
|
|
326
523
|
send.restore();
|
|
327
524
|
}
|
|
328
525
|
|
|
329
526
|
});
|
|
527
|
+
|
|
528
|
+
// We can cover this TCK issue in a simple code unit test, the case is simple enough
|
|
529
|
+
it("must throw an error on invalid delays (MYFACES-4499, TCK_ISSUE320IT )", (done) => {
|
|
530
|
+
|
|
531
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
532
|
+
try {
|
|
533
|
+
faces.ajax.request(element, null, {
|
|
534
|
+
execute: "input_1",
|
|
535
|
+
render: "@form",
|
|
536
|
+
delay: NaN,
|
|
537
|
+
params: {
|
|
538
|
+
pass1: "pass1",
|
|
539
|
+
pass2: "pass2",
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
} catch (e) {
|
|
543
|
+
expect(e.message.indexOf("NaN") > 0).to.eq(true, "Invalid NaN in message");
|
|
544
|
+
done();
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
done("Expecting a client error to be thrown")
|
|
548
|
+
});
|
|
549
|
+
|
|
550
|
+
it("must throw an error on invalid delays (MYFACES-4499, TCK_ISSUE320IT ) - 2", (done) => {
|
|
551
|
+
|
|
552
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
553
|
+
try {
|
|
554
|
+
faces.ajax.request(element, null, {
|
|
555
|
+
execute: "input_1",
|
|
556
|
+
render: "@form",
|
|
557
|
+
delay: -1,
|
|
558
|
+
params: {
|
|
559
|
+
pass1: "pass1",
|
|
560
|
+
pass2: "pass2",
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
} catch (e) {
|
|
564
|
+
expect(e.message.indexOf("-1") > 0).to
|
|
565
|
+
.eq(true, "Invalid integer value in message");
|
|
566
|
+
done();
|
|
567
|
+
return;
|
|
568
|
+
}
|
|
569
|
+
done("Expecting a client error to be thrown")
|
|
570
|
+
});
|
|
571
|
+
it("must throw an error on invalid delays (MYFACES-4499, TCK_ISSUE320IT ) - 3", (done) => {
|
|
572
|
+
|
|
573
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
574
|
+
try {
|
|
575
|
+
faces.ajax.request(element, null, {
|
|
576
|
+
execute: "input_1",
|
|
577
|
+
render: "@form",
|
|
578
|
+
delay: "booga",
|
|
579
|
+
params: {
|
|
580
|
+
pass1: "pass1",
|
|
581
|
+
pass2: "pass2",
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
} catch (e) {
|
|
585
|
+
expect(e.message.indexOf("booga") > 0).to.be
|
|
586
|
+
.eq(true, "Invalid string value in message");
|
|
587
|
+
done();
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
done("Expecting a client error to be thrown")
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
it("must have a proper working myfaces.pps = true, partial page submit", function (done) {
|
|
594
|
+
/**
|
|
595
|
+
* derived from the passthrough test
|
|
596
|
+
*/
|
|
597
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
598
|
+
try {
|
|
599
|
+
//we only issue input 1
|
|
600
|
+
let element = DomQuery.byId("input_1").getAsElem(0).value;
|
|
601
|
+
issueStdPPSReq(element);
|
|
602
|
+
|
|
603
|
+
expect(send.called).to.be.true;
|
|
604
|
+
let argsVal: any = send.args[0][0];
|
|
605
|
+
let arsArr = argsVal.split("&");
|
|
606
|
+
let resultsMap = {};
|
|
607
|
+
for (let val of arsArr) {
|
|
608
|
+
let keyVal = val.split("=");
|
|
609
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
expect(resultsMap?.["input_2_text"] ?? false).to.eq(false);
|
|
613
|
+
expect(!!(resultsMap?.["input_1"] ?? false)).to.eq(true);
|
|
614
|
+
expect(resultsMap["pass1"]).to.eq("pass1");
|
|
615
|
+
expect(resultsMap["pass2"]).to.eq("pass2");
|
|
616
|
+
expect(!!resultsMap["render"]).to.be.false;
|
|
617
|
+
expect(!!resultsMap["execute"]).to.be.false;
|
|
618
|
+
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
619
|
+
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
620
|
+
expect(resultsMap[P_AJAX_SOURCE]).to.eq("input_1");
|
|
621
|
+
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
622
|
+
expect(resultsMap[P_RENDER]).to.eq("blarg");
|
|
623
|
+
expect(resultsMap[P_EXECUTE]).to.eq("input_1");
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
// TODO the request map only has the params and input1_ and input_2 passed no matter now many other values
|
|
627
|
+
// we might have to add some input elements into the form which are filetered out
|
|
628
|
+
} finally {
|
|
629
|
+
send.restore();
|
|
630
|
+
}
|
|
631
|
+
done();
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
|
|
330
635
|
});
|
|
331
636
|
|
|
@@ -24,7 +24,7 @@ import {expect} from "chai";
|
|
|
24
24
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
25
25
|
import {DomQuery} from "mona-dish";
|
|
26
26
|
import {
|
|
27
|
-
COMPLETE,
|
|
27
|
+
COMPLETE, EMPTY_STR,
|
|
28
28
|
SUCCESS
|
|
29
29
|
} from "../../impl/core/Const";
|
|
30
30
|
;
|
|
@@ -65,6 +65,7 @@ let {
|
|
|
65
65
|
|
|
66
66
|
import STD_XML = StandardInits.STD_XML;
|
|
67
67
|
import defaultMyFaces23 = StandardInits.defaultMyFaces23;
|
|
68
|
+
import HTML_PREFIX_EMBEDDED_BODY = StandardInits.HTML_PREFIX_EMBEDDED_BODY;
|
|
68
69
|
|
|
69
70
|
declare var jsf: any;
|
|
70
71
|
declare var Implementation: any;
|
|
@@ -323,7 +324,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
323
324
|
|
|
324
325
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
325
326
|
let xhrReq = null;
|
|
326
|
-
|
|
327
|
+
let oldErr = console.error;
|
|
327
328
|
try {
|
|
328
329
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
329
330
|
jsf.ajax.request(element, null, {
|
|
@@ -333,9 +334,9 @@ describe('Tests after core when it hits response', function () {
|
|
|
333
334
|
pass2: "pass2",
|
|
334
335
|
onerror: (error: any) => {
|
|
335
336
|
expect(error.type).to.eq("error");
|
|
336
|
-
expect(
|
|
337
|
+
expect(error.status).to.eq(EMPTY_STR);
|
|
337
338
|
expect(!!error.message).to.eq(true);
|
|
338
|
-
expect(!!error.source).to.eq(true);
|
|
339
|
+
expect(!!error.source.id).to.eq(true);
|
|
339
340
|
expect(!!error.responseCode).to.eq(true);
|
|
340
341
|
expect(!!error.responseText).to.eq(true);
|
|
341
342
|
expect(!error.responseXML).to.eq(true);
|
|
@@ -343,6 +344,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
343
344
|
},
|
|
344
345
|
onevent: (evt: any) => {
|
|
345
346
|
if (evt.status == COMPLETE) {
|
|
347
|
+
console.error = () => {};
|
|
346
348
|
throw Error("This error is wanted, ignore the log");
|
|
347
349
|
}
|
|
348
350
|
}
|
|
@@ -353,12 +355,51 @@ describe('Tests after core when it hits response', function () {
|
|
|
353
355
|
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
354
356
|
|
|
355
357
|
} catch (e) {
|
|
358
|
+
if(e.message.indexOf("This error is wanted") != -1) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
356
361
|
console.error(e);
|
|
357
362
|
|
|
358
363
|
} finally {
|
|
364
|
+
console.error = oldErr;
|
|
359
365
|
send.restore();
|
|
360
366
|
}
|
|
361
367
|
|
|
362
368
|
});
|
|
369
|
+
|
|
370
|
+
it("must handle prefixed inputs properly (prefixes must be present)", function (done) {
|
|
371
|
+
window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
|
|
372
|
+
|
|
373
|
+
//we now run the tests here
|
|
374
|
+
try {
|
|
375
|
+
|
|
376
|
+
let event = {
|
|
377
|
+
isTrusted: true,
|
|
378
|
+
type: 'change',
|
|
379
|
+
target: document.getElementById("page:input::field"),
|
|
380
|
+
currentTarget: document.getElementById("page:input::field")
|
|
381
|
+
};
|
|
382
|
+
jsf.ajax.request(document.getElementById("page:input"), event as any, {
|
|
383
|
+
render: "page:output",
|
|
384
|
+
execute: "page:input",
|
|
385
|
+
params: {
|
|
386
|
+
"booga2.xxx": "yyy",
|
|
387
|
+
"javax.faces.behavior.event": "change",
|
|
388
|
+
"booga": "bla"
|
|
389
|
+
},
|
|
390
|
+
});
|
|
391
|
+
} catch (err) {
|
|
392
|
+
console.error(err);
|
|
393
|
+
expect(false).to.eq(true);
|
|
394
|
+
}
|
|
395
|
+
const requestBody = this.requests[0].requestBody;
|
|
396
|
+
//We check if the base64 encoded string matches the original
|
|
397
|
+
expect(requestBody.indexOf("javax.faces.behavior.event")).to.not.eq(-1);
|
|
398
|
+
expect(requestBody.indexOf("javax.faces.behavior.event=change")).to.not.eq(-1);
|
|
399
|
+
expect(requestBody.indexOf("page%3Ainput=input_value")).to.not.eq(-1);
|
|
400
|
+
done();
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
|
|
363
404
|
});
|
|
364
405
|
|