jsf.js_next_gen 4.0.0-beta-23 → 4.0.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.
Files changed (200) hide show
  1. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  2. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  3. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  4. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +7 -22
  7. package/dist/docs/assets/main.js +56 -52
  8. package/dist/docs/assets/search.js +1 -1
  9. package/dist/docs/assets/style.css +23 -0
  10. package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
  11. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
  12. package/dist/docs/functions/faces.ajax.request.html +7 -7
  13. package/dist/docs/functions/faces.ajax.response.html +0 -1
  14. package/dist/docs/functions/faces.push.close.html +4 -2
  15. package/dist/docs/functions/faces.push.init.html +19 -7
  16. package/dist/docs/functions/faces.push.open.html +4 -2
  17. package/dist/docs/functions/faces.util.chain.html +3 -3
  18. package/dist/docs/functions/myfaces.ab.html +9 -4
  19. package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
  20. package/dist/docs/index.html +7 -18
  21. package/dist/docs/modules/myfaces.html +3 -1
  22. package/dist/docs/variables/myfaces.oam.html +2 -1
  23. package/dist/window/faces-development.js +2147 -1779
  24. package/dist/window/faces-development.js.br +0 -0
  25. package/dist/window/faces-development.js.gz +0 -0
  26. package/dist/window/faces-development.js.map +1 -1
  27. package/dist/window/faces.js +1 -1
  28. package/dist/window/faces.js.LICENSE.txt +17 -2
  29. package/dist/window/faces.js.br +0 -0
  30. package/dist/window/faces.js.gz +0 -0
  31. package/dist/window/faces.js.map +1 -1
  32. package/dist/window/jsf-development.js +2156 -1777
  33. package/dist/window/jsf-development.js.br +0 -0
  34. package/dist/window/jsf-development.js.gz +0 -0
  35. package/dist/window/jsf-development.js.map +1 -1
  36. package/dist/window/jsf.js +1 -1
  37. package/dist/window/jsf.js.LICENSE.txt +17 -2
  38. package/dist/window/jsf.js.br +0 -0
  39. package/dist/window/jsf.js.gz +0 -0
  40. package/dist/window/jsf.js.map +1 -1
  41. package/package.json +19 -18
  42. package/pom.xml +1 -1
  43. package/src/main/test.xml +23 -0
  44. package/src/main/typescript/@types/definitions/index.d.ts +24 -7
  45. package/src/main/typescript/api/_api.ts +79 -37
  46. package/src/main/typescript/api/jsf.ts +18 -0
  47. package/src/main/typescript/impl/AjaxImpl.ts +168 -78
  48. package/src/main/typescript/impl/PushImpl.ts +63 -38
  49. package/src/main/typescript/impl/core/Const.ts +52 -39
  50. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  51. package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
  52. package/src/main/typescript/impl/util/AsyncRunnable.ts +4 -4
  53. package/src/main/typescript/impl/util/ExtDomQuery.ts +58 -45
  54. package/src/main/typescript/impl/util/FileUtils.ts +104 -0
  55. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
  56. package/src/main/typescript/impl/util/Lang.ts +30 -31
  57. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  58. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
  59. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
  60. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
  61. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
  62. package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
  63. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +202 -131
  64. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +79 -166
  65. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -68
  66. package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
  67. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +19 -22
  68. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +108 -1
  69. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  70. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  71. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
  72. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
  73. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
  74. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  75. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  76. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
  77. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +242 -11
  78. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
  79. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +373 -35
  80. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  81. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
  82. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  83. package/src/main/typescript/test.xml +6 -0
  84. package/src/main/typescript/tsconfig.json +1 -1
  85. package/src/test/resources/jsf-development.js +1 -1
  86. package/src/tmp/test.html +12 -88
  87. package/target/api/_api.js +72 -31
  88. package/target/api/_api.js.map +1 -1
  89. package/target/api/jsf.js +11 -0
  90. package/target/api/jsf.js.map +1 -1
  91. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  92. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  93. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  94. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  95. package/target/impl/AjaxImpl.js +144 -59
  96. package/target/impl/AjaxImpl.js.map +1 -1
  97. package/target/impl/PushImpl.js +66 -35
  98. package/target/impl/PushImpl.js.map +1 -1
  99. package/target/impl/core/Const.js +51 -38
  100. package/target/impl/core/Const.js.map +1 -1
  101. package/target/impl/core/Context.js +10 -0
  102. package/target/impl/core/Context.js.map +1 -0
  103. package/target/impl/util/Assertions.js +12 -7
  104. package/target/impl/util/Assertions.js.map +1 -1
  105. package/target/impl/util/AsyncQueue.js.map +1 -1
  106. package/target/impl/util/ExtDomQuery.js +58 -40
  107. package/target/impl/util/ExtDomQuery.js.map +1 -1
  108. package/target/impl/util/FileUtils.js +96 -0
  109. package/target/impl/util/FileUtils.js.map +1 -0
  110. package/target/impl/util/HiddenElementBuilder.js +7 -0
  111. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  112. package/target/impl/util/HiddenInputBuilder.js +79 -0
  113. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  114. package/target/impl/util/Lang.js +29 -30
  115. package/target/impl/util/Lang.js.map +1 -1
  116. package/target/impl/util/URLCodec.js +77 -0
  117. package/target/impl/util/URLCodec.js.map +1 -0
  118. package/target/impl/util/XhrQueueController.js +82 -0
  119. package/target/impl/util/XhrQueueController.js.map +1 -0
  120. package/target/impl/xhrCore/ErrorData.js +10 -8
  121. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  122. package/target/impl/xhrCore/EventData.js +1 -1
  123. package/target/impl/xhrCore/EventData.js.map +1 -1
  124. package/target/impl/xhrCore/RequestContext.js +11 -0
  125. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  126. package/target/impl/xhrCore/RequestDataResolver.js +70 -23
  127. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  128. package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
  129. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  130. package/target/impl/xhrCore/Response.js +44 -29
  131. package/target/impl/xhrCore/Response.js.map +1 -1
  132. package/target/impl/xhrCore/ResponseProcessor.js +182 -116
  133. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  134. package/target/impl/xhrCore/XhrFormData.js +68 -156
  135. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  136. package/target/impl/xhrCore/XhrQueHandler.js +11 -0
  137. package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
  138. package/target/impl/xhrCore/XhrQueueController.js +62 -0
  139. package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
  140. package/target/impl/xhrCore/XhrRequest.js +68 -59
  141. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  142. package/target/myfaces/OamSubmit.js +23 -14
  143. package/target/myfaces/OamSubmit.js.map +1 -1
  144. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +16 -16
  145. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  146. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
  147. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
  148. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
  149. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
  150. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
  151. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
  152. package/target/test/frameworkBase/_ext/shared/StandardInits.js +100 -1
  153. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  154. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  155. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  156. package/target/test/impl/ImplTest.spec.js +2 -2
  157. package/target/test/impl/ImplTest.spec.js.map +1 -1
  158. package/target/test/impl/ImplTest_23.spec.js +2 -2
  159. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  160. package/target/test/myfaces/OnLoadSpec.js +57 -0
  161. package/target/test/myfaces/OnLoadSpec.js.map +1 -0
  162. package/target/test/xhrCore/EventTests.spec.js +1 -1
  163. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  164. package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
  165. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  166. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  167. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  168. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  169. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  170. package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
  171. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  172. package/target/test/xhrCore/RequestTest.spec.js +217 -9
  173. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  174. package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
  175. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  176. package/target/test/xhrCore/ResponseTest.spec.js +308 -24
  177. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  178. package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
  179. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  180. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
  181. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
  182. package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
  183. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  184. package/target/test-classes/.gz +0 -0
  185. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  186. package/target/test-classes/fileuploadtest.html +24 -0
  187. package/target/test-classes/jsf-development.js +3559 -0
  188. package/target/test-classes/jsf-development.js.br +0 -0
  189. package/target/test-classes/jsf-development.js.gz +0 -0
  190. package/target/test-classes/jsf-development.js.map +1 -0
  191. package/target/test-classes/jsf.js +3 -0
  192. package/target/test-classes/jsf.js.br +0 -0
  193. package/target/test-classes/jsf.js.gz +0 -0
  194. package/tmp.xml +36 -0
  195. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  196. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  197. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  198. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  199. package/target/types/index.js +0 -18
  200. package/target/types/index.js.map +0 -1
@@ -20,7 +20,7 @@ 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_PARTIAL_SOURCE,
@@ -39,8 +39,10 @@ let issueStdReq = function (element) {
39
39
  faces.ajax.request(element, null, {
40
40
  execute: "input_1",
41
41
  render: "@form",
42
- pass1: "pass1",
43
- pass2: "pass2"
42
+ params: {
43
+ pass1: "pass1",
44
+ pass2: "pass2"
45
+ }
44
46
  });
45
47
  };
46
48
  /**
@@ -103,7 +105,6 @@ describe('Tests on the xhr core when it starts to call the request', function ()
103
105
  });
104
106
 
105
107
  it('it must have the pass through values properly passed', function (done) {
106
-
107
108
  let send = sinon.spy(XMLHttpRequest.prototype, "send");
108
109
  try {
109
110
  let element = DomQuery.byId("input_2").getAsElem(0).value;
@@ -135,6 +136,35 @@ describe('Tests on the xhr core when it starts to call the request', function ()
135
136
  done();
136
137
  });
137
138
 
139
+ it('it must handle resetValues properly', function (done) {
140
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
141
+ try {
142
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
143
+ faces.ajax.request(element, null, {
144
+ execute: "input_1",
145
+ resetValues: true,
146
+ render: "@form",
147
+ params: {
148
+ pass1: "pass1",
149
+ pass2: "pass2"
150
+ }
151
+ });
152
+
153
+ expect(send.called).to.be.true;
154
+ let argsVal: any = send.args[0][0];
155
+ let arsArr = argsVal.split("&");
156
+ let resultsMap = {};
157
+ for (let val of arsArr) {
158
+ let keyVal = val.split("=");
159
+ resultsMap[keyVal[0]] = keyVal[1];
160
+ }
161
+ expect(resultsMap["jakarta.faces.partial.resetValues"]).to.eq("true");
162
+ } finally {
163
+ send.restore();
164
+ }
165
+ done();
166
+ });
167
+
138
168
  it('it must have the proper target type', function (done) {
139
169
  let send = sinon.spy(XMLHttpRequest.prototype, "send");
140
170
  try {
@@ -196,16 +226,24 @@ describe('Tests after core when it hits response', function () {
196
226
  faces.ajax.request(element, null, {
197
227
  execute: "input_1",
198
228
  render: "@form",
199
- pass1: "pass1",
200
- pass2: "pass2",
229
+ params: {
230
+ pass1: "pass1",
231
+ pass2: "pass2"
232
+ },
233
+ message: "Hello World",
201
234
  onevent: (evt: any) => {
202
235
  localCnt++;
203
236
  }
204
237
  });
205
238
 
206
239
  let xhrReq = this.requests[0];
240
+ let requestBody = xhrReq.requestBody.split("&");
207
241
 
208
242
  xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
243
+ expect(requestBody.indexOf("pass1=pass1")).not.to.eq(-1);
244
+ expect(requestBody.indexOf("pass2=pass2")).not.to.eq(-1);
245
+ expect(requestBody.indexOf("message=Hello%20World")).not.to.eq(-1);
246
+
209
247
  expect(this.jsfAjaxResponse.callCount).to.eq(1);
210
248
  //success ommitted due to fake response
211
249
  expect(globalCnt == 3).to.eq(true);
@@ -220,7 +258,8 @@ describe('Tests after core when it hits response', function () {
220
258
 
221
259
  });
222
260
 
223
- it('it must have called request and the pass through values must be properly transferred into the context', function (done) {
261
+ it('it must have called request and the pass through values must be properly transferred ' +
262
+ 'into the context, via the old non spec conform behavior', function (done) {
224
263
  let send = sinon.spy(XMLHttpRequest.prototype, "send");
225
264
  let globalCnt = 0;
226
265
  let localCnt = 0;
@@ -273,6 +312,67 @@ describe('Tests after core when it hits response', function () {
273
312
  xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
274
313
 
275
314
 
315
+ } catch (e) {
316
+ console.error(e);
317
+
318
+ } finally {
319
+ send.restore();
320
+ }
321
+ });
322
+
323
+ it('it must have allow array key value pairs as passthroughs', function (done) {
324
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
325
+ let globalCnt = 0;
326
+ let localCnt = 0;
327
+ let xhrReq = null;
328
+
329
+ try {
330
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
331
+ faces.ajax.addOnEvent(() => {
332
+ globalCnt++;
333
+ });
334
+
335
+
336
+ faces.ajax.request(element, null, {
337
+ execute: "input_1",
338
+ render: "@form",
339
+ params: [["pass1", "pass1"],
340
+ ["pass2", "pass2"]],
341
+
342
+ onevent: (evt: any) => {
343
+ localCnt++;
344
+ if (evt.status == COMPLETE) {
345
+ expect(!!xhrReq.responseXML).to.be.true;
346
+ }
347
+ if (evt.status == SUCCESS) {
348
+ expect(this.jsfAjaxResponse.callCount).to.eq(1);
349
+
350
+ expect(this.jsfAjaxResponse.firstCall.args[0] instanceof XMLHttpRequest).to.be.true;
351
+ let lastArg = this.jsfAjaxResponse.firstCall.args[1];
352
+ expect(lastArg.onevent != null).to.be.true;
353
+ expect(lastArg.onevent instanceof Function).to.be.true;
354
+ expect(!!lastArg.onError).to.be.false;
355
+ expect(lastArg.pass1 == "pass1").to.be.true;
356
+ expect(lastArg.pass2 == "pass2").to.be.true;
357
+ expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
358
+ expect(!!lastArg[P_AJAX]).to.be.true;
359
+ expect(!!lastArg[P_EXECUTE]).to.be.true;
360
+ expect(!!lastArg[P_RENDER]).to.be.true;
361
+
362
+ expect(this.jsfAjaxResponse.firstCall.args.length).to.eq(2);
363
+
364
+ expect(globalCnt == 2).to.eq(true); //local before global
365
+ expect(localCnt == 3).to.eq(true);
366
+
367
+ done();
368
+ }
369
+ }
370
+ });
371
+
372
+ xhrReq = this.requests[0];
373
+ xhrReq.responsetype = "text/xml";
374
+ xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
375
+
276
376
 
277
377
  } catch (e) {
278
378
  console.error(e);
@@ -282,6 +382,68 @@ describe('Tests after core when it hits response', function () {
282
382
  }
283
383
  });
284
384
 
385
+ it('it must have called request and the pass through values must be properly transferred into the context', function (done) {
386
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
387
+ let globalCnt = 0;
388
+ let localCnt = 0;
389
+ let xhrReq = null;
390
+
391
+ try {
392
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
393
+ faces.ajax.addOnEvent(() => {
394
+ globalCnt++;
395
+ });
396
+
397
+
398
+ faces.ajax.request(element, null, {
399
+ execute: "input_1",
400
+ render: "@form",
401
+ params: {
402
+ pass1: "pass1",
403
+ pass2: "pass2",
404
+ },
405
+ onevent: (evt: any) => {
406
+ localCnt++;
407
+ if (evt.status == COMPLETE) {
408
+ expect(!!xhrReq.responseXML).to.be.true;
409
+ }
410
+ if (evt.status == SUCCESS) {
411
+ expect(this.jsfAjaxResponse.callCount).to.eq(1);
412
+
413
+ expect(this.jsfAjaxResponse.firstCall.args[0] instanceof XMLHttpRequest).to.be.true;
414
+ let lastArg = this.jsfAjaxResponse.firstCall.args[1];
415
+ expect(lastArg.onevent != null).to.be.true;
416
+ expect(lastArg.onevent instanceof Function).to.be.true;
417
+ expect(!!lastArg.onError).to.be.false;
418
+ expect(lastArg.pass1 == "pass1").to.be.true;
419
+ expect(lastArg.pass2 == "pass2").to.be.true;
420
+ expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
421
+ expect(!!lastArg[P_AJAX]).to.be.true;
422
+ expect(!!lastArg[P_EXECUTE]).to.be.true;
423
+ expect(!!lastArg[P_RENDER]).to.be.true;
424
+
425
+ expect(this.jsfAjaxResponse.firstCall.args.length).to.eq(2);
426
+
427
+ expect(globalCnt == 2).to.eq(true); //local before global
428
+ expect(localCnt == 3).to.eq(true);
429
+
430
+ done();
431
+ }
432
+ }
433
+ });
434
+
435
+ xhrReq = this.requests[0];
436
+ xhrReq.responsetype = "text/xml";
437
+ xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
438
+
439
+
440
+ } catch (e) {
441
+ console.error(e);
442
+
443
+ } finally {
444
+ send.restore();
445
+ }
446
+ });
285
447
 
286
448
 
287
449
  it('it must have called onError in the error case', function (done) {
@@ -296,13 +458,15 @@ describe('Tests after core when it hits response', function () {
296
458
  faces.ajax.request(element, null, {
297
459
  execute: "input_1",
298
460
  render: "@form",
299
- pass1: "pass1",
300
- pass2: "pass2",
461
+ params: {
462
+ pass1: "pass1",
463
+ pass2: "pass2",
464
+ },
301
465
  onerror: (error: any) => {
302
466
  expect(error.type).to.eq("error");
303
- expect(!!error.status).to.eq(true);
467
+ expect(error.status).to.eq(EMPTY_STR);
304
468
  expect(!!error.message).to.eq(true);
305
- expect(!!error.source).to.eq(true);
469
+ expect(!!error.source?.id).to.eq(true);
306
470
  expect(!!error.responseCode).to.eq(true);
307
471
  expect(!!error.responseText).to.eq(true);
308
472
  expect(!error.responseXML).to.eq(true);
@@ -327,5 +491,72 @@ describe('Tests after core when it hits response', function () {
327
491
  }
328
492
 
329
493
  });
494
+
495
+ // We can cover this TCK issue in a simple code unit test, the case is simple enough
496
+ it("must throw an error on invalid delays (MYFACES-4499, TCK_ISSUE320IT )", (done) => {
497
+
498
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
499
+ try {
500
+ faces.ajax.request(element, null, {
501
+ execute: "input_1",
502
+ render: "@form",
503
+ delay: NaN,
504
+ params: {
505
+ pass1: "pass1",
506
+ pass2: "pass2",
507
+ }
508
+ });
509
+ } catch (e) {
510
+ expect(e.message.indexOf("NaN") > 0).to.eq(true, "Invalid NaN in message");
511
+ done();
512
+ return;
513
+ }
514
+ done("Expecting a client error to be thrown")
515
+ });
516
+
517
+ it("must throw an error on invalid delays (MYFACES-4499, TCK_ISSUE320IT ) - 2", (done) => {
518
+
519
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
520
+ try {
521
+ faces.ajax.request(element, null, {
522
+ execute: "input_1",
523
+ render: "@form",
524
+ delay: -1,
525
+ params: {
526
+ pass1: "pass1",
527
+ pass2: "pass2",
528
+ }
529
+ });
530
+ } catch (e) {
531
+ expect(e.message.indexOf("-1") > 0).to
532
+ .eq(true, "Invalid integer value in message");
533
+ done();
534
+ return;
535
+ }
536
+ done("Expecting a client error to be thrown")
537
+ });
538
+ it("must throw an error on invalid delays (MYFACES-4499, TCK_ISSUE320IT ) - 3", (done) => {
539
+
540
+ let element = DomQuery.byId("input_2").getAsElem(0).value;
541
+ try {
542
+ faces.ajax.request(element, null, {
543
+ execute: "input_1",
544
+ render: "@form",
545
+ delay: "booga",
546
+ params: {
547
+ pass1: "pass1",
548
+ pass2: "pass2",
549
+ }
550
+ });
551
+ } catch (e) {
552
+ expect(e.message.indexOf("booga") > 0).to.be
553
+ .eq(true, "Invalid string value in message");
554
+ done();
555
+ return;
556
+ }
557
+ done("Expecting a client error to be thrown")
558
+ });
559
+
560
+
330
561
  });
331
562
 
@@ -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;
@@ -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(!!error.status).to.eq(true);
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);
@@ -360,5 +361,40 @@ describe('Tests after core when it hits response', function () {
360
361
  }
361
362
 
362
363
  });
364
+
365
+ it("must handle prefixed inputs properly (prefixes must be present)", function (done) {
366
+ window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
367
+
368
+ //we now run the tests here
369
+ try {
370
+
371
+ let event = {
372
+ isTrusted: true,
373
+ type: 'change',
374
+ target: document.getElementById("page:input::field"),
375
+ currentTarget: document.getElementById("page:input::field")
376
+ };
377
+ jsf.ajax.request(document.getElementById("page:input"), event as any, {
378
+ render: "page:output",
379
+ execute: "page:input",
380
+ params: {
381
+ "booga2.xxx": "yyy",
382
+ "javax.faces.behavior.event": "change",
383
+ "booga": "bla"
384
+ },
385
+ });
386
+ } catch (err) {
387
+ console.error(err);
388
+ expect(false).to.eq(true);
389
+ }
390
+ const requestBody = this.requests[0].requestBody;
391
+ //We check if the base64 encoded string matches the original
392
+ expect(requestBody.indexOf("javax.faces.behavior.event")).to.not.eq(-1);
393
+ expect(requestBody.indexOf("javax.faces.behavior.event=change")).to.not.eq(-1);
394
+ expect(requestBody.indexOf("page%3Ainput=input_value")).to.not.eq(-1);
395
+ done();
396
+ });
397
+
398
+
363
399
  });
364
400