jsf.js_next_gen 1.0.0-beta-20 → 4.0.0-beta-2

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 (138) hide show
  1. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +1 -0
  2. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +1 -0
  3. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +1 -0
  4. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -0
  6. package/README.md +12 -0
  7. package/dist/docs/assets/search.js +1 -1
  8. package/dist/docs/functions/{jsf.ajax.addOnError.html → faces.ajax.addOnError.html} +11 -11
  9. package/dist/docs/functions/{jsf.ajax.addOnEvent.html → faces.ajax.addOnEvent.html} +11 -11
  10. package/dist/docs/functions/{jsf.ajax.request.html → faces.ajax.request.html} +11 -11
  11. package/dist/docs/functions/{jsf.ajax.response.html → faces.ajax.response.html} +11 -11
  12. package/dist/docs/functions/{jsf.getClientWindow.html → faces.getClientWindow.html} +12 -12
  13. package/dist/docs/functions/{jsf.getProjectStage.html → faces.getProjectStage.html} +13 -13
  14. package/dist/docs/functions/{jsf.getViewState.html → faces.getViewState.html} +13 -13
  15. package/dist/docs/functions/{jsf.push.close.html → faces.push.close.html} +10 -10
  16. package/dist/docs/functions/{jsf.push.init.html → faces.push.init.html} +10 -10
  17. package/dist/docs/functions/{jsf.push.open.html → faces.push.open.html} +10 -10
  18. package/dist/docs/functions/{jsf.util.chain.html → faces.util.chain.html} +8 -8
  19. package/dist/docs/functions/myfaces.ab.html +6 -6
  20. package/dist/docs/index.html +13 -4
  21. package/dist/docs/modules/{jsf.ajax.html → faces.ajax.html} +14 -14
  22. package/dist/docs/modules/{jsf.html → faces.html} +22 -22
  23. package/dist/docs/modules/{jsf.push.html → faces.push.html} +12 -12
  24. package/dist/docs/modules/{jsf.util.html → faces.util.html} +8 -8
  25. package/dist/docs/modules/myfaces.html +4 -4
  26. package/dist/docs/modules.html +5 -5
  27. package/dist/docs/variables/{jsf.implversion.html → faces.implversion.html} +12 -12
  28. package/dist/docs/variables/{jsf.separatorchar.html → faces.separatorchar.html} +12 -12
  29. package/dist/docs/variables/{jsf.specversion.html → faces.specversion.html} +13 -13
  30. package/dist/docs/variables/myfaces.oam.html +4 -4
  31. package/dist/window/faces-development.js +7695 -0
  32. package/dist/window/faces-development.js.br +0 -0
  33. package/dist/window/faces-development.js.gz +0 -0
  34. package/dist/window/faces-development.js.map +1 -0
  35. package/dist/window/faces.js +2 -0
  36. package/dist/window/faces.js.br +0 -0
  37. package/dist/window/faces.js.gz +0 -0
  38. package/dist/window/faces.js.map +1 -0
  39. package/dist/window/jsf-development.js +192 -102
  40. package/dist/window/jsf-development.js.br +0 -0
  41. package/dist/window/jsf-development.js.gz +0 -0
  42. package/dist/window/jsf-development.js.map +1 -1
  43. package/dist/window/jsf.js +1 -1
  44. package/dist/window/jsf.js.br +0 -0
  45. package/dist/window/jsf.js.gz +0 -0
  46. package/dist/window/jsf.js.map +1 -1
  47. package/package.json +2 -2
  48. package/src/main/types/typedefs.d.ts +2 -0
  49. package/src/main/typescript/api/{Jsf.ts → faces.ts} +14 -10
  50. package/src/main/typescript/api/jsf.ts +30 -0
  51. package/src/main/typescript/impl/AjaxImpl.ts +17 -15
  52. package/src/main/typescript/impl/PushImpl.ts +3 -3
  53. package/src/main/typescript/impl/core/Const.ts +52 -14
  54. package/src/main/typescript/impl/i18n/Messages.ts +1 -1
  55. package/src/main/typescript/impl/util/Assertions.ts +1 -1
  56. package/src/main/typescript/impl/util/ExtDomQuery.ts +32 -21
  57. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -1
  58. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +1 -1
  59. package/src/main/typescript/impl/xhrCore/Response.ts +2 -2
  60. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +4 -2
  61. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +2 -2
  62. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +4 -5
  63. package/src/main/typescript/myfaces/OamSubmit.ts +0 -1
  64. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +58 -27
  65. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +4 -4
  66. package/src/main/typescript/test/impl/ImplTest.spec.ts +12 -12
  67. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +134 -0
  68. package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +6 -3
  69. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +1 -1
  70. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +7 -7
  71. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -5
  72. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +22 -22
  73. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +11 -11
  74. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +26 -26
  75. package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +3 -5
  76. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +8 -8
  77. package/src/main/typescript/tsconfig-typedoc.json +1 -1
  78. package/src/test/resources/jsf-development.js +1 -1
  79. package/target/api/Jsf.js +16 -244
  80. package/target/api/Jsf.js.map +1 -1
  81. package/target/api/faces.js +265 -0
  82. package/target/api/faces.js.map +1 -0
  83. package/target/impl/AjaxImpl.js +14 -13
  84. package/target/impl/AjaxImpl.js.map +1 -1
  85. package/target/impl/PushImpl.js +3 -3
  86. package/target/impl/PushImpl.js.map +1 -1
  87. package/target/impl/core/Const.js +51 -14
  88. package/target/impl/core/Const.js.map +1 -1
  89. package/target/impl/i18n/Messages.js +1 -1
  90. package/target/impl/i18n/Messages.js.map +1 -1
  91. package/target/impl/util/Assertions.js +1 -1
  92. package/target/impl/util/Assertions.js.map +1 -1
  93. package/target/impl/util/ExtDomQuery.js +27 -16
  94. package/target/impl/util/ExtDomQuery.js.map +1 -1
  95. package/target/impl/xhrCore/EventData.js +2 -1
  96. package/target/impl/xhrCore/EventData.js.map +1 -1
  97. package/target/impl/xhrCore/RequestDataResolver.js +1 -1
  98. package/target/impl/xhrCore/Response.js +2 -2
  99. package/target/impl/xhrCore/ResponseProcessor.js +10 -10
  100. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  101. package/target/impl/xhrCore/XhrFormData.js +2 -2
  102. package/target/impl/xhrCore/XhrRequest.js +4 -3
  103. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  104. package/target/myfaces/OamSubmit.js +0 -1
  105. package/target/myfaces/OamSubmit.js.map +1 -1
  106. package/target/test/frameworkBase/_ext/shared/StandardInits.js +63 -25
  107. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  108. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +4 -4
  109. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  110. package/target/test/impl/ImplTest.spec.js +53 -12
  111. package/target/test/impl/ImplTest.spec.js.map +1 -1
  112. package/target/test/impl/ImplTest_23.spec.js +165 -0
  113. package/target/test/impl/ImplTest_23.spec.js.map +1 -0
  114. package/target/test/impl/ImplTest_23.spec_.js +165 -0
  115. package/target/test/impl/ImplTest_23.spec_.js.map +1 -0
  116. package/target/test/impl/SeparatorCharsTest.spec.js +6 -2
  117. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  118. package/target/test/queue/AsynchronousQueueTest.spec.js +1 -1
  119. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  120. package/target/test/xhrCore/EventTests.spec.js +6 -6
  121. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  122. package/target/test/xhrCore/FileUploadTest.spec.js +4 -4
  123. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  124. package/target/test/xhrCore/RequestParamsTest.spec.js +22 -22
  125. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  126. package/target/test/xhrCore/RequestTest.spec.js +10 -10
  127. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  128. package/target/test/xhrCore/ResponseTest.spec.js +21 -21
  129. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  130. package/target/test/xhrCore/ShadowDomTest.spec.js +2 -3
  131. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  132. package/target/test/xhrCore/WebsocketTest.js +7 -7
  133. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  134. package/webpack.config.js +7 -4
  135. package/webpack.config.js.map +1 -1
  136. package/webpack.config.ts +7 -4
  137. package/integrationdeploy.cmd +0 -4
  138. package/integrationsdeploy.sh +0 -5
@@ -16,9 +16,10 @@
16
16
 
17
17
 
18
18
  import {DomQuery} from "mona-dish";
19
+ import {remapNamespacesFor23, remapNamespacesFor40} from "../../../../impl/core/Const";
19
20
 
20
21
  declare let global;
21
- declare let jsf: any;
22
+ declare let faces: any;
22
23
  declare let myfaces: any;
23
24
 
24
25
  /**
@@ -60,7 +61,7 @@ export module StandardInits {
60
61
  <body>
61
62
  <form id="blarg">
62
63
  <input type="text" id="blarg:input_1" name="blarg:input_1" value="input_1_val"></input>
63
- <input type="hidden" id="javax.faces.ViewState" name="javax.faces.ViewState" value="blubbblubblubb"></input>
64
+ <input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
64
65
  <input type="button" id="blarg:input_2" name="blarg:input_2" value="input_1_val"></input>
65
66
  <div id="shadowDomArea">
66
67
  <input type="button" id="blarg:input_3" name="blarg:input_3" value="input_3_val"></input>
@@ -70,7 +71,7 @@ export module StandardInits {
70
71
  </html>`;
71
72
 
72
73
  /**
73
- * a page simulating basically a simple jsf form
74
+ * a page simulating basically a simple faces form
74
75
  */
75
76
  const HTML_FORM_DEFAULT = `<!DOCTYPE html>
76
77
  <html lang="en">
@@ -81,14 +82,16 @@ export module StandardInits {
81
82
  <body>
82
83
  <form id="blarg">
83
84
  <input type="text" id="input_1" name="input_1" value="input_1_val"></input>
84
- <input type="hidden" id="javax.faces.ViewState" name="javax.faces.ViewState" value="blubbblubblubb"></input>
85
+ <input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
85
86
  <input type="button" id="input_2" name="input_2" value="input_1_val"></input>
86
87
  </form>
87
88
  </body>
88
89
  </html>`;
89
90
 
91
+
92
+
90
93
  /**
91
- * a page simulating basically a simple jsf form
94
+ * a page simulating basically a simple faces form
92
95
  */
93
96
  const HTML_FILE_FORM_DEFAULT = `<!DOCTYPE html>
94
97
  <html lang="en">
@@ -100,7 +103,7 @@ export module StandardInits {
100
103
  <form id="blarg" enctype="multipart/form-data">
101
104
  <input type="file" id="fíleupload"></input>
102
105
  <input type="text" id="input_1" name="input_1" value="input_1_val"></input>
103
- <input type="hidden" id="javax.faces.ViewState" name="javax.faces.ViewState" value="blubbblubblubb"></input>
106
+ <input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
104
107
  <input type="button" id="input_2" name="input_2" value="input_1_val"></input>
105
108
  </form>
106
109
  </body>
@@ -108,21 +111,21 @@ export module StandardInits {
108
111
 
109
112
 
110
113
 
111
- export const STD_XML = `<?xml version="1.0" encoding="utf-8"?><partial-response><changes><update id="value_1"><![CDATA[<span id="out1">2</span>]]></update><update id="javax.faces.ViewState"><![CDATA[j_id1:j_id3]]></update></changes></partial-response>`;
114
+ export const STD_XML = `<?xml version="1.0" encoding="utf-8"?><partial-response><changes><update id="value_1"><![CDATA[<span id="out1">2</span>]]></update><update id="jakarta.faces.ViewState"><![CDATA[j_id1:j_id3]]></update></changes></partial-response>`;
112
115
 
113
116
  /**
114
- * a page containing a jsf.js input with a new separator char
117
+ * a page containing a faces.js input with a new separator char
115
118
  * @param separatorChar
116
119
  * @constructor
117
120
  */
118
- function HTML_DEFAULT_SEPARATOR_CHAR(separatorChar: string) {
121
+ function HTML_DEFAULT_SEPARATOR_CHAR(separatorChar: string, IS_40=true) {
119
122
  return `<!DOCTYPE html>
120
123
  <html lang="en">
121
124
  <head>
122
125
  <meta charset="UTF-8">
123
126
  <title>Title</title>
124
127
  <script type="text/javascript"
125
- src="/wfmportal/javax.faces.resource/jsf.js.jsf?ln=javax.faces&separator=${separatorChar}"></script>
128
+ src="/wfmportal/${IS_40 ? 'jakarta' : 'javax'}.faces.resource/${IS_40 ? 'faces': 'jsf'}.js.jsf?ln=jakarta.faces&separator=${separatorChar}"></script>
126
129
  </head>
127
130
  <body>
128
131
  <form id="blarg">
@@ -140,7 +143,7 @@ export module StandardInits {
140
143
  * testing the various aspects of the protocol
141
144
  * under pure html conditions
142
145
  *
143
- * We get the jsf out of the way and bascially simulate what the browser sees
146
+ * We get the jsf out of the way and basically simulate what the browser sees
144
147
  */
145
148
  export const PROTOCOL_PAGE = `<!DOCTYPE html>
146
149
  <html lang="en">
@@ -183,7 +186,7 @@ export module StandardInits {
183
186
 
184
187
  <form id="form1" action="boog.html">
185
188
 
186
- <input type="hidden" id="javax.faces.ViewState" name="javax.faces.ViewState" value="blubbblubblubb"></input>
189
+ <input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
187
190
 
188
191
  <input type="button" id="cmd_eval" value="eval"
189
192
  onclick="emitPPR(this, ('undefined' == typeof event)? null: event, 'eval1');"/>
@@ -213,7 +216,7 @@ export module StandardInits {
213
216
  onclick="emitPPR(this, ('undefined' == typeof event)? null: event, 'errors');"/>
214
217
 
215
218
  <input type="button" id="cmd_error_component" value="Error: no component given"
216
- onclick="jsf.ajax.request(null, event, {}); return false"/>
219
+ onclick="faces.ajax.request(null, event, {}); return false"/>
217
220
 
218
221
  </form>
219
222
 
@@ -225,7 +228,7 @@ export module StandardInits {
225
228
  function emitPPR(source, event, action, useIframe, formName) {
226
229
  document.getElementById(formName || "form1").action = target;
227
230
 
228
- jsf.ajax.request(/*String|Dom Node*/ source, /*|EVENT|*/ (window.event) ? window.event : event, /*{|OPTIONS|}*/ {op: action});
231
+ faces.ajax.request(/*String|Dom Node*/ source, /*|EVENT|*/ (window.event) ? window.event : event, /*{|OPTIONS|}*/ {op: action});
229
232
  }
230
233
  </script>
231
234
  </div>
@@ -254,13 +257,22 @@ export module StandardInits {
254
257
  export function defaultHtml(withJsf = true): Promise<() => void> {
255
258
  return init(HTML_DEFAULT, withJsf);
256
259
  }
260
+ export function defaultHtml_23(withJsf = true): Promise<() => void> {
261
+ return init(HTML_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
262
+ }
257
263
 
258
264
  export function defaultMyFaces(withJsf = true): Promise<() => void> {
259
265
  return init(HTML_FORM_DEFAULT, withJsf);
260
266
  }
267
+ export function defaultMyFaces23(withJsf = true): Promise<() => void> {
268
+ return init(HTML_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
269
+ }
261
270
  export function defaultFileForm(withJsf = true): Promise<() => void> {
262
271
  return init(HTML_FILE_FORM_DEFAULT, withJsf);
263
272
  }
273
+ export function defaultFileForm_23(withJsf = true): Promise<() => void> {
274
+ return init(HTML_FILE_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
275
+ }
264
276
 
265
277
  export function shadowDomMyFaces(withJsf = true): Promise<() => void> {
266
278
  return <Promise<() => void>>init(HTML_SHADOW, withJsf).then((close) => {
@@ -273,12 +285,12 @@ export module StandardInits {
273
285
  });
274
286
  }
275
287
 
276
- export function protocolPage(withJsf = true): Promise<() => void> {
277
- return <any>init(PROTOCOL_PAGE, withJsf);
288
+ export function protocolPage(withJsf = true, IS_40 = true): Promise<() => void> {
289
+ return <any>init((IS_40) ? PROTOCOL_PAGE : PROTOCOL_PAGE.replace(/jakarta/gi,"javax"), withJsf, IS_40);
278
290
  }
279
291
 
280
- export function defaultSeparatorChar(separatorChar: string, withJsf = true): Promise<() => void> {
281
- let template = HTML_DEFAULT_SEPARATOR_CHAR(separatorChar);
292
+ export function defaultSeparatorChar(separatorChar: string, withJsf = true, IS_40 = true): Promise<() => void> {
293
+ let template = HTML_DEFAULT_SEPARATOR_CHAR(separatorChar, IS_40);
282
294
  return init(template, withJsf);
283
295
  }
284
296
 
@@ -296,17 +308,31 @@ export module StandardInits {
296
308
  * @param Implementation
297
309
  */
298
310
  let applyJsfToGlobals = function (data, Implementation, PushImpl) {
311
+ (<any>global).faces = data.faces;
312
+ (<any>global).myfaces = data.myfaces;
313
+ (<any>global).window.faces = data.faces;
314
+ (<any>global).window.myfaces = data.myfaces;
315
+ (<any>global).Implementation = Implementation.Implementation;
316
+ (<any>global).PushImpl = PushImpl.PushImpl;
317
+ //bypass a bug on windows jsdom, domparser not an auto global but on window only
318
+ (<any>global).DOMParser = (<any>global)?.DOMParser ?? window.DOMParser;
319
+ (<any>global).document = (<any>global)?.document ?? window.document;
320
+ };
321
+
322
+ let applyJsfToGlobals23 = function (data, Implementation, PushImpl) {
299
323
  (<any>global).jsf = data.jsf;
300
324
  (<any>global).myfaces = data.myfaces;
301
325
  (<any>global).window.jsf = data.jsf;
302
326
  (<any>global).window.myfaces = data.myfaces;
303
327
  (<any>global).Implementation = Implementation.Implementation;
328
+ (<any>global).window.Implementation = Implementation.Implementation;
304
329
  (<any>global).PushImpl = PushImpl.PushImpl;
305
330
  //bypass a bug on windows jsdom, domparser not an auto global but on window only
306
331
  (<any>global).DOMParser = (<any>global)?.DOMParser ?? window.DOMParser;
307
332
  (<any>global).document = (<any>global)?.document ?? window.document;
308
333
  };
309
334
 
335
+
310
336
  /**
311
337
  * init the jsdom global
312
338
  * @param clean
@@ -320,19 +346,22 @@ export module StandardInits {
320
346
  runScripts: "dangerously"
321
347
  };
322
348
  //we have two different apis depending whether we allow module interop with sinon or not
323
- return domIt?.default?.(template, params) ?? domIt?.(template, params);
349
+ return (domIt?.default ?? domIt)?.(template, params) ;
324
350
  });
325
351
  };
326
352
 
327
353
  /**
328
354
  * init the jsf subsystem
329
355
  */
330
- let initJSF = async function () {
356
+ let initJSF = async function (IS_40: boolean = true) {
331
357
  // @ts-ignore
332
- return import("../../../../api/Jsf").then((data) => {
358
+
359
+ const facesImport = IS_40 ? import("../../../../api/faces") : import("../../../../api/jsf");
360
+
361
+ return facesImport.then((data) => {
333
362
  let Implementation = require("../../../../impl/AjaxImpl");
334
363
  let PushImpl = require("../../../../impl/PushImpl");
335
- applyJsfToGlobals(data, Implementation, PushImpl);
364
+ IS_40 ? applyJsfToGlobals(data, Implementation, PushImpl): applyJsfToGlobals23(data, Implementation, PushImpl);
336
365
  }).catch(err => {
337
366
  console.error(err);
338
367
  });
@@ -345,10 +374,12 @@ export module StandardInits {
345
374
  (<any>global)?.Implementation?.reset();
346
375
  (<any>global)?.PushImpl?.reset();
347
376
 
348
- delete (<any>global).jsf;
377
+ ((<any>global).faces) ? delete (<any>global).faces : null;
378
+ ((<any>global).jsf) ? delete (<any>global).jsf : null;
349
379
  delete (<any>global).myfaces;
350
- delete (<any>global).Implementation;
380
+ ((<any>global).Implementation) ? delete (<any>global).Implementation : null;
351
381
  delete (<any>global).PushImpl;
382
+ remapNamespacesFor40();
352
383
  };
353
384
 
354
385
  /**
@@ -357,7 +388,7 @@ export module StandardInits {
357
388
  * @param template
358
389
  * @param withJsf
359
390
  */
360
- async function init(template: string, withJsf = true): Promise<() => void> {
391
+ async function init(template: string, withJsf = true, IS_JSF_40 = true): Promise<() => void> {
361
392
  //let dom2 = new JSDOM(template)
362
393
  //return initMyFacesFromDom(dom2);
363
394
  let clean = null;
@@ -368,11 +399,11 @@ export module StandardInits {
368
399
  resetGlobals();
369
400
  // @ts-ignore
370
401
  await initJSDOM(template).then(data => clean = data);
371
- await initJSF();
402
+ await initJSF(IS_JSF_40);
372
403
  } else {
373
404
  // @ts-ignore
374
405
  await import('jsdom-global').then((domIt) => {
375
- clean = domIt(template);
406
+ clean = (domIt?.default ?? domIt)?.(template);
376
407
  });
377
408
  }
378
409
  //the async is returning a promise on the caller level
@@ -59,7 +59,7 @@ export class XmlResponses {
59
59
  static VIEWSTATE_1 = `
60
60
  <partial-response>
61
61
  <changes>
62
- <update id="javax.faces.ViewState"><![CDATA[hello world]]></update>
62
+ <update id="jakarta.faces.ViewState"><![CDATA[hello world]]></update>
63
63
  </changes>
64
64
  </partial-response>
65
65
  `;
@@ -94,7 +94,7 @@ export class XmlResponses {
94
94
 
95
95
  static BODY_REPLACEMENT = `<partial-response>
96
96
  <changes>
97
- <update id="javax.faces.ViewBody"><![CDATA[
97
+ <update id="jakarta.faces.ViewBody"><![CDATA[
98
98
  <body id="the_id" class="tundra">
99
99
  <div id='centerDiv'>
100
100
  <h1>Test for body change done</h1>
@@ -121,7 +121,7 @@ export class XmlResponses {
121
121
 
122
122
  static HEAD_REPLACEMENT = `<partial-response>
123
123
  <changes>
124
- <update id="javax.faces.ViewHead"><![CDATA[
124
+ <update id="jakarta.faces.ViewHead"><![CDATA[
125
125
  <head>
126
126
  <meta blarg="blarg2"></meta>
127
127
  <script type='text/javascript'>
@@ -137,7 +137,7 @@ export class XmlResponses {
137
137
 
138
138
  static VIEW_ROOT_REPLACEMENT = `<partial-response>
139
139
  <changes>
140
- <update id="javax.faces.ViewRoot"><![CDATA[
140
+ <update id="jakarta.faces.ViewRoot"><![CDATA[
141
141
  <html>
142
142
  <head>
143
143
  <meta blarg="blarg2"></meta>
@@ -27,35 +27,35 @@ import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
27
27
 
28
28
  sinon.reset();
29
29
 
30
- declare var jsf: any;
30
+ declare var faces: any;
31
31
  declare var Implementation: any;
32
32
 
33
33
  /**
34
- * testing the jsf.ajax.request api without triggering any
34
+ * testing the faces.ajax.request api without triggering any
35
35
  * xhr request...
36
36
  * the idea is to shim the code which triggers the request out and check what is going in
37
37
  * and what is coming out
38
38
  */
39
39
 
40
- describe('jsf.ajax.request test suite', () => {
40
+ describe('faces.ajax.request test suite', () => {
41
41
 
42
- beforeEach(() => {
43
- return defaultMyFaces();
42
+ beforeEach(async () => {
43
+ return await defaultMyFaces();
44
44
  });
45
45
 
46
- it("jsf.ajax.request can be called", () => {
46
+ it("faces.ajax.request can be called", () => {
47
47
  //we stub the addRequestToQueue, to enable the request check only
48
48
  //without any xhr and response, both will be tested separately for
49
49
  //proper behavior
50
50
  const Impl = Implementation;
51
51
  const addRequestToQueue = sinon.stub(Impl.queueHandler, "addRequestToQueue");
52
- //now the jsf.ajax.request should trigger but should not go into
52
+ //now the faces.ajax.request should trigger but should not go into
53
53
  //the asynchronous event loop.
54
54
  //lets check it out
55
55
 
56
56
  try {
57
57
  DomQuery.byId("input_2").addEventListener("click", (event: Event) => {
58
- jsf.ajax.request(null, event, {render: '@all', execute: '@form'})
58
+ faces.ajax.request(null, event, {render: '@all', execute: '@form'})
59
59
  }).click();
60
60
 
61
61
  expect(addRequestToQueue.called).to.be.true;
@@ -74,12 +74,12 @@ describe('jsf.ajax.request test suite', () => {
74
74
 
75
75
  });
76
76
 
77
- it("jsf.ajax.request passthroughs must end up in passthrough", (done) => {
77
+ it("faces.ajax.request passthroughs must end up in passthrough", (done) => {
78
78
  //TODO implementation
79
79
  done();
80
80
  });
81
81
 
82
- it("jsf.util.chain must work", () => {
82
+ it("faces.util.chain must work", () => {
83
83
  let called = {};
84
84
  (<any>window).called = called;
85
85
 
@@ -108,7 +108,7 @@ describe('jsf.ajax.request test suite', () => {
108
108
  return false;
109
109
  };
110
110
 
111
- jsf.util.chain(this, called, func1, func2, func3, func4, func5);
111
+ faces.util.chain(this, called, func1, func2, func3, func4, func5);
112
112
 
113
113
  expect(called["func1"]).to.be.true;
114
114
  expect(called["func2"]).to.be.true;
@@ -117,7 +117,7 @@ describe('jsf.ajax.request test suite', () => {
117
117
  expect(!!called["func5"]).to.be.false;
118
118
 
119
119
  called = {};
120
- jsf.util.chain(this, called, func1, func2, func4, func5);
120
+ faces.util.chain(this, called, func1, func2, func4, func5);
121
121
  expect(called["func1"]).to.be.true;
122
122
  expect(called["func2"]).to.be.true;
123
123
  expect(!!called["func4"]).to.be.true;
@@ -0,0 +1,134 @@
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 {Config} from "mona-dish";
18
+ import {describe, it} from 'mocha';
19
+ import {expect} from 'chai';
20
+ import * as sinon from 'sinon';
21
+
22
+ import {DomQuery} from "mona-dish";
23
+
24
+ import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
25
+ import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
26
+ import defaultMyFaces23 = StandardInits.defaultMyFaces23;
27
+
28
+ sinon.reset();
29
+
30
+ declare var jsf: any;
31
+ declare var Implementation: any;
32
+
33
+ /**
34
+ * testing the javax.ajax.request api without triggering any
35
+ * xhr request...
36
+ * the idea is to shim the code which triggers the request out and check what is going in
37
+ * and what is coming out
38
+ */
39
+
40
+ describe('javax.ajax.request test suite', () => {
41
+
42
+ beforeEach(async () => {
43
+ let ret = await defaultMyFaces23();
44
+ return ret;
45
+ });
46
+
47
+ it("jsf.ajax.request can be called", () => {
48
+ //we stub the addRequestToQueue, to enable the request check only
49
+ //without any xhr and response, both will be tested separately for
50
+ //proper behavior
51
+ const Impl = Implementation;
52
+ const addRequestToQueue = sinon.stub(Impl.queueHandler, "addRequestToQueue");
53
+ //now the javax.ajax.request should trigger but should not go into
54
+ //the asynchronous event loop.
55
+ //lets check it out
56
+
57
+ try {
58
+ DomQuery.byId("input_2").addEventListener("click", (event: Event) => {
59
+ jsf.ajax.request(null, event, {render: '@all', execute: '@form'})
60
+ }).click();
61
+
62
+ expect(addRequestToQueue.called).to.be.true;
63
+ expect(addRequestToQueue.callCount).to.eq(1);
64
+
65
+ const argElement = <Config>addRequestToQueue.args[0][2];
66
+ const context = (<Config>addRequestToQueue.args[0][2]);
67
+
68
+ expect(context.getIf("passThrgh", P_RENDER).value).eq("@all");
69
+ //Execute issuing form due to @form and always the issuing element
70
+ expect(context.getIf("passThrgh", P_EXECUTE).value).eq("blarg input_2");
71
+ } finally {
72
+ //once done we restore the proper state
73
+ addRequestToQueue.restore();
74
+ }
75
+
76
+ });
77
+
78
+ it("javax.ajax.request passthroughs must end up in passthrough", (done) => {
79
+ //TODO implementation
80
+ done();
81
+ });
82
+
83
+ it("javax.util.chain must work", () => {
84
+ let called = {};
85
+ (<any>window).called = called;
86
+
87
+ let func1 = () => {
88
+ called["func1"] = true;
89
+ return true;
90
+ }
91
+
92
+ let func2 = `function func2(called) {
93
+ called["func2"] = true;
94
+ return true;
95
+ }`;
96
+
97
+ let func3 = () => {
98
+ called["func3"] = true;
99
+ return false;
100
+ }
101
+
102
+ let func4 = `return (function func4(called) {
103
+ called["func4"] = true;
104
+ return false;
105
+ })(event)`;
106
+
107
+ let func5 = () => {
108
+ called["func5"] = true;
109
+ return false;
110
+ };
111
+
112
+ (window as any).jsf.util.chain(this, called, func1, func2, func3, func4, func5);
113
+
114
+ expect(called["func1"]).to.be.true;
115
+ expect(called["func2"]).to.be.true;
116
+ expect(!!called["func3"]).to.be.true;
117
+ expect(!!called["func4"]).to.be.false;
118
+ expect(!!called["func5"]).to.be.false;
119
+
120
+ called = {};
121
+ (window as any).jsf.util.chain(this, called, func1, func2, func4, func5);
122
+ expect(called["func1"]).to.be.true;
123
+ expect(called["func2"]).to.be.true;
124
+ expect(!!called["func4"]).to.be.true;
125
+ expect(!!called["func5"]).to.be.false;
126
+
127
+ });
128
+
129
+
130
+
131
+
132
+ });
133
+
134
+
@@ -25,7 +25,7 @@ const jsdom = require("jsdom");
25
25
  const {JSDOM} = jsdom;
26
26
  sinon.reset();
27
27
 
28
- declare var jsf: any;
28
+ declare var faces: any;
29
29
  declare var Implementation: any;
30
30
 
31
31
  describe('various tests for get separator char', () => {
@@ -35,7 +35,7 @@ describe('various tests for get separator char', () => {
35
35
  let waitForResult = defaultMyFaces();
36
36
  waitForResult.then((close) => {
37
37
  try {
38
- let separator = jsf.separatorchar;
38
+ let separator = faces.separatorchar;
39
39
  expect(separator).to.eq(":");
40
40
  } finally {
41
41
  Implementation.reset();
@@ -47,12 +47,15 @@ describe('various tests for get separator char', () => {
47
47
 
48
48
  it("should have a custom separator char", (done) => {
49
49
 
50
- let waitForResult = defaultSeparatorChar("$");
50
+ let waitForResult = defaultSeparatorChar("$", false);
51
51
  waitForResult.then((close) => {
52
52
  try {
53
53
  let separator = Implementation.getSeparatorChar();
54
54
  expect(separator).to.eq("$");
55
55
  done();
56
+ } catch(ex) {
57
+ console.error(ex);
58
+ expect(false).to.eq(true);
56
59
  } finally {
57
60
  Implementation.reset();
58
61
  close();
@@ -40,7 +40,7 @@ describe('Asynchronous Queue tests', () => {
40
40
  (<any>global).XMLHttpRequest = this.xhr;
41
41
  (<any>window).XMLHttpRequest = this.xhr;
42
42
 
43
- this.jsfAjaxResponse = sinon.stub((<any>global).jsf.ajax, "response");
43
+ this.jsfAjaxResponse = sinon.stub((<any>global).faces.ajax, "response");
44
44
 
45
45
  this.closeIt = () => {
46
46
  (<any>global).XMLHttpRequest = (<any>window).XMLHttpRequest = this.xhr.restore();
@@ -24,7 +24,7 @@ import protocolPage = StandardInits.protocolPage;
24
24
  import {DQ} from "mona-dish";
25
25
  import {XmlResponses} from "../frameworkBase/_ext/shared/XmlResponses";
26
26
 
27
- declare var jsf: any;
27
+ declare var faces: any;
28
28
 
29
29
  describe('tests the addOnEvent and addOnError handling', function () {
30
30
 
@@ -70,7 +70,7 @@ describe('tests the addOnEvent and addOnError handling', function () {
70
70
  let onEventCalled1 = 0;
71
71
  let onEventCalled2 = 0;
72
72
 
73
- jsf.ajax.addOnEvent((data: any) => {
73
+ faces.ajax.addOnEvent((data: any) => {
74
74
  onEventCalled1++;
75
75
  if (onEventCalled1 == 1 && data.status != "begin") {
76
76
  throw ("Wrong status")
@@ -82,7 +82,7 @@ describe('tests the addOnEvent and addOnError handling', function () {
82
82
  throw ("Wrong status")
83
83
  }
84
84
  });
85
- jsf.ajax.addOnEvent((data: any) => {
85
+ faces.ajax.addOnEvent((data: any) => {
86
86
  onEventCalled2++;
87
87
 
88
88
  });
@@ -99,12 +99,12 @@ describe('tests the addOnEvent and addOnError handling', function () {
99
99
 
100
100
  let errorTitle = '';
101
101
  let errorMessage = '';
102
- jsf.ajax.addOnError((data: any) => {
102
+ faces.ajax.addOnError((data: any) => {
103
103
  errorTitle = data.errorName;
104
104
  errorMessage = data.errorMessage;
105
105
  onErrorCalled1++
106
106
  });
107
- jsf.ajax.addOnError((data: any) => {
107
+ faces.ajax.addOnError((data: any) => {
108
108
  onErrorCalled2++;
109
109
  });
110
110
 
@@ -126,10 +126,10 @@ describe('tests the addOnEvent and addOnError handling', function () {
126
126
  expect(!!data?.source?.id).to.be.true;
127
127
  }
128
128
 
129
- jsf.ajax.addOnEvent((data: any) => {
129
+ faces.ajax.addOnEvent((data: any) => {
130
130
  assertSourceExists(data);
131
131
  });
132
- jsf.ajax.addOnEvent((data: any) => {
132
+ faces.ajax.addOnEvent((data: any) => {
133
133
  onEventCalled2++;
134
134
 
135
135
  });
@@ -33,12 +33,12 @@ import STD_XML = StandardInits.STD_XML;
33
33
  import defaultFileForm = StandardInits.defaultFileForm;
34
34
  import {Implementation} from "../../impl/AjaxImpl";
35
35
 
36
- declare var jsf: any;
36
+ declare var faces: any;
37
37
  declare var Impl
38
38
 
39
39
 
40
40
  let issueStdReq = function (element) {
41
- jsf.ajax.request(element, null, {
41
+ faces.ajax.request(element, null, {
42
42
  execute: "input_1",
43
43
  render: "@form",
44
44
  pass1: "pass1",
@@ -95,7 +95,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
95
95
  let button = DomQuery.byId("input_1");
96
96
 
97
97
  button.addEventListener("click", (event: Event) => {
98
- jsf.ajax.request(event.target, event, {render: '@all', execute: '@form'})
98
+ faces.ajax.request(event.target, event, {render: '@all', execute: '@form'})
99
99
  }).click();
100
100
  //this.resonse("ok");
101
101
 
@@ -126,7 +126,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
126
126
  let button = DomQuery.byId("input_1");
127
127
 
128
128
  button.addEventListener("click", (event: Event) => {
129
- jsf.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fíleupload'})
129
+ faces.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fíleupload'})
130
130
  }).click();
131
131
  //this.resonse("ok");
132
132
 
@@ -157,7 +157,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
157
157
  let button = DomQuery.byId("input_1");
158
158
 
159
159
  button.addEventListener("click", (event: Event) => {
160
- jsf.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fileupload'});
160
+ faces.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fileupload'});
161
161
  }).click();
162
162
 
163
163
  expect(this.requests.length).to.eq(1);