jsf.js_next_gen 1.0.0-beta-19 → 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 (149) 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 +17 -2
  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 +18 -6
  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 +242 -175
  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 +48 -81
  64. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +0 -5
  65. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +61 -30
  66. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +4 -4
  67. package/src/main/typescript/test/impl/ImplTest.spec.ts +12 -12
  68. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +134 -0
  69. package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +6 -4
  70. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +107 -16
  71. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +1 -1
  72. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +7 -7
  73. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -5
  74. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +22 -22
  75. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +11 -11
  76. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +26 -26
  77. package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +3 -5
  78. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +8 -8
  79. package/src/main/typescript/tsconfig-typedoc.json +1 -1
  80. package/src/main/typescript/tsconfig.json +1 -0
  81. package/src/test/resources/jsf-development.js +1 -1
  82. package/target/api/Jsf.js +16 -244
  83. package/target/api/Jsf.js.map +1 -1
  84. package/target/api/faces.js +265 -0
  85. package/target/api/faces.js.map +1 -0
  86. package/target/impl/AjaxImpl.js +14 -13
  87. package/target/impl/AjaxImpl.js.map +1 -1
  88. package/target/impl/PushImpl.js +3 -3
  89. package/target/impl/PushImpl.js.map +1 -1
  90. package/target/impl/core/Const.js +51 -14
  91. package/target/impl/core/Const.js.map +1 -1
  92. package/target/impl/i18n/Messages.js +1 -1
  93. package/target/impl/i18n/Messages.js.map +1 -1
  94. package/target/impl/util/Assertions.js +1 -1
  95. package/target/impl/util/Assertions.js.map +1 -1
  96. package/target/impl/util/ExtDomQuery.js +27 -16
  97. package/target/impl/util/ExtDomQuery.js.map +1 -1
  98. package/target/impl/xhrCore/EventData.js +2 -1
  99. package/target/impl/xhrCore/EventData.js.map +1 -1
  100. package/target/impl/xhrCore/RequestDataResolver.js +1 -1
  101. package/target/impl/xhrCore/Response.js +2 -2
  102. package/target/impl/xhrCore/ResponseProcessor.js +10 -10
  103. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  104. package/target/impl/xhrCore/XhrFormData.js +2 -2
  105. package/target/impl/xhrCore/XhrRequest.js +4 -3
  106. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  107. package/target/myfaces/OamSubmit.js +49 -73
  108. package/target/myfaces/OamSubmit.js.map +1 -1
  109. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +24 -1
  110. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  111. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +0 -5
  112. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  113. package/target/test/frameworkBase/_ext/shared/StandardInits.js +92 -28
  114. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  115. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +4 -4
  116. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  117. package/target/test/impl/ImplTest.spec.js +77 -13
  118. package/target/test/impl/ImplTest.spec.js.map +1 -1
  119. package/target/test/impl/ImplTest_23.spec.js +165 -0
  120. package/target/test/impl/ImplTest_23.spec.js.map +1 -0
  121. package/target/test/impl/ImplTest_23.spec_.js +165 -0
  122. package/target/test/impl/ImplTest_23.spec_.js.map +1 -0
  123. package/target/test/impl/SeparatorCharsTest.spec.js +30 -4
  124. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  125. package/target/test/myfaces/OamSubmit.spec.js +92 -13
  126. package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
  127. package/target/test/queue/AsynchronousQueueTest.spec.js +25 -2
  128. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  129. package/target/test/xhrCore/EventTests.spec.js +30 -7
  130. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  131. package/target/test/xhrCore/FileUploadTest.spec.js +28 -5
  132. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  133. package/target/test/xhrCore/RequestParamsTest.spec.js +46 -23
  134. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  135. package/target/test/xhrCore/RequestTest.spec.js +34 -11
  136. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  137. package/target/test/xhrCore/ResponseTest.spec.js +45 -22
  138. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  139. package/target/test/xhrCore/ShadowDomTest.spec.js +26 -4
  140. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  141. package/target/test/xhrCore/WebsocketTest.js +31 -8
  142. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  143. package/target/test/xhrCore/XhrFormDataTest.spec.js +24 -1
  144. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  145. package/webpack.config.js +7 -4
  146. package/webpack.config.js.map +1 -1
  147. package/webpack.config.ts +7 -4
  148. package/integrationdeploy.cmd +0 -4
  149. package/integrationsdeploy.sh +0 -5
@@ -14,10 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
+ import {DQ, Stream} from "mona-dish";
18
+
17
19
  /**
18
20
  * legacy code to enable various aspects
19
21
  * of myfaces, used to be rendered inline
20
- * for jsf 2.0 we can externalized it into its own custom resource
22
+ * for jsf 2.0 we can externalize it into its own custom resource
21
23
  *
22
24
  * note this is a straight 1:1 port from the existing codebase
23
25
  * (not too much work has been spent here, the important thing is, that
@@ -29,123 +31,88 @@ declare const window: any;
29
31
  declare const myfaces: any;
30
32
 
31
33
  export module oam {
32
-
33
34
  /**
34
35
  * sets a hidden input field
35
- * @param formname the formName
36
+ * @param formName the formName
36
37
  * @param name the hidden field
37
38
  * @param value the value to be rendered
38
39
  */
39
- export const setHiddenInput = function (formname, name, value) {
40
- let form: HTMLFormElement = document.forms[formname];
41
- if (typeof form == 'undefined') {
42
- form = document.getElementById(formname) as HTMLFormElement;
43
- }
44
-
45
- if (typeof form.elements[name] != 'undefined' && (form.elements[name].nodeName == 'INPUT' || form.elements[name].nodeName == 'input')) {
46
- (form.elements[name] as HTMLInputElement).value = value;
47
- } else {
48
- let newInput = document.createElement('input');
49
- newInput.setAttribute('type', 'hidden');
50
- newInput.setAttribute('id', name);
51
- newInput.setAttribute('name', name);
52
- newInput.setAttribute('value', value);
53
- form.appendChild(newInput);
54
- }
40
+ export const setHiddenInput = function (formName: string, name: string, value: string) {
41
+ DQ.byId(document.forms[formName])
42
+ .each(form => {
43
+ const input = form.querySelectorAll(`input[type='hidden'][name='${name}']`);
44
+ if (input.isPresent()) {
45
+ input.inputValue.value = value;
46
+ } else {
47
+ const newInput = DQ.fromMarkup(`<input type='hidden' id='${name}' name='${name}'>`);
48
+ newInput.inputValue.value = value;
49
+ newInput.appendTo(form);
50
+ }
51
+ });
55
52
  };
56
53
 
57
54
  /**
58
55
  * clears a hidden input field
59
56
  *
60
- * @param formname formName for the input
57
+ * @param formName formName for the input
61
58
  * @param name the name of the input field
62
59
  */
63
- export const clearHiddenInput = function (formname: string, name: string) {
64
- let form: HTMLFormElement = document.forms[formname];
65
-
66
- if (typeof form == 'undefined') {
67
- form = document.getElementById(formname) as HTMLFormElement;
68
- }
69
-
70
- let hInput = form.elements[name];
71
- if (typeof hInput != 'undefined') {
72
- form.removeChild(hInput);
60
+ export const clearHiddenInput = function (formName: string, name: string) {
61
+ let element = document.forms?.[formName]?.elements?.[name];
62
+ if(!element) {
63
+ return;
73
64
  }
65
+ DQ.byId(element).delete();
74
66
  };
75
67
 
76
68
  // noinspection JSUnusedGlobalSymbols
77
69
  /**
78
70
  * does special form submit remapping
79
- * remaps the issuing command link into something
80
- * the decode of the command link on the server can understand
71
+ * re-maps the issuing command link into something,
72
+ * a decode of the command link on the server can understand
81
73
  *
82
74
  * @param formName
83
75
  * @param linkId
84
76
  * @param target
85
77
  * @param params
86
78
  */
87
- export const submitForm = function (formName: string, linkId: string, target: HTMLElement, params: { [key: string]: any }) {
88
-
79
+ export const submitForm = function (formName: string, linkId: string, target: string, params: { [key: string]: any }) {
89
80
  let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\$:').replace(/:/g, '_');
90
- if (typeof window[clearFn] == 'function') {
91
- window[clearFn](formName);
92
- }
93
-
94
- let form = document.forms[formName];
95
- if (typeof form == 'undefined') {
96
- form = document.getElementById(formName);
97
- }
81
+ window?.[clearFn]?.(formName);
98
82
 
99
83
  //autoscroll code
100
- if ((window as any)?.myfaces?.core?.config.autoScroll && typeof (window as any)?.getScrolling != 'undefined') {
84
+ if (window?.myfaces?.core?.config?.autoScroll && window?.getScrolling) {
101
85
  myfaces.oam.setHiddenInput(formName, 'autoScroll', window?.getScrolling());
102
86
  }
87
+ Stream.ofAssoc(params).each((param: [string, any]) => {
88
+ myfaces.oam.setHiddenInput(formName, param[0], param[1]);
89
+ });
103
90
 
104
- let oldTarget = form.target;
105
- if (target != null) {
106
- form.target = target;
107
- }
108
- if ((typeof params != 'undefined') && params != null) {
109
- for (let i = 0, param; (param = params[i]); i++) {
110
- myfaces.oam.setHiddenInput(formName, param[0], param[1]);
111
- }
91
+ //we call the namespaced function, to allow decoration, via a direct call we would
92
+ myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId);
112
93
 
113
- }
94
+ DQ.byId(document.forms[formName]).each(form => {
95
+ const ATTR_TARGET = "target";
96
+ const formElement = form.getAsElem(0).value as HTMLFormElement;
97
+ const oldTarget = form.attr(ATTR_TARGET).value;
98
+ form.attr(ATTR_TARGET).value = target;
114
99
 
115
- myfaces.oam.setHiddenInput(formName, formName + ':' + '_idcl', linkId);
100
+ const result = formElement?.onsubmit?.(null);
116
101
 
117
- if (form.onsubmit) {
118
- let result = form.onsubmit();
119
- if ((typeof result == 'undefined') || result) {
120
- try {
121
- form.submit();
122
- } catch (e) {
123
- if (window.console) {
124
- console.error(e);
125
- }
126
- }
127
- }
128
-
129
- } else {
130
102
  try {
131
- form.submit();
132
- } catch (e) {
133
- if (window.console) {
134
- console.error(e);
103
+ if ((!!result) || 'undefined' == typeof result) {
104
+ formElement.submit();
135
105
  }
106
+ } catch (e) {
107
+ window?.console.error(e);
136
108
  }
137
- }
138
-
139
- form.target = oldTarget;
140
- if ((typeof params != 'undefined') && params != null) {
141
-
142
- for (let i = 0, param; (param = params[i]); i++) {
143
- myfaces.oam.clearHiddenInput(formName, param[0], param[1]);
144
- }
145
-
146
- }
147
109
 
148
- myfaces.oam.clearHiddenInput(formName, formName + ':' + '_idcl', linkId);
110
+ form.attr(ATTR_TARGET).value = oldTarget;
111
+ Stream.ofAssoc(params).each((param: [string, any]) => {
112
+ myfaces.oam.clearHiddenInput(formName, param[0]);
113
+ });
114
+ myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
115
+ });
149
116
  return false;
150
117
  };
151
118
  }
@@ -119,7 +119,6 @@ describe('Config tests', () => {
119
119
  it('array config', () => {
120
120
  let config = setup();
121
121
  config.assign("hello[5]", "world[3]", "from[5]").value = "me";
122
- console.debug(JSON.stringify(config.toJson()));
123
122
  expect(config.getIf("hello[5]", "world[3]", "from[5]").value).to.be.eq("me");
124
123
  expect(config.value.hello[5].world[3].from[5]).to.be.eq("me");
125
124
  structure(config.value);
@@ -129,7 +128,6 @@ describe('Config tests', () => {
129
128
  let config = setup();
130
129
  config.assign("[5]", "world[3]", "from").value = "me";
131
130
  expect(config.getIf("[5]", "world[3]", "from").value).to.be.eq("me");
132
- console.debug(JSON.stringify(config.toJson()));
133
131
  expect(config.value[5].world[3].from).to.be.eq("me");
134
132
  structureBroken(config.value);
135
133
  });
@@ -138,7 +136,6 @@ describe('Config tests', () => {
138
136
  let config = setup();
139
137
  config.assign("[5]", "[3]", "from").value = "me";
140
138
  expect(config.getIf("[5]", "[3]", "from").value).to.be.eq("me");
141
- console.debug(JSON.stringify(config.toJson()));
142
139
  expect(config.value[5][3].from).to.be.eq("me");
143
140
  structureBroken(config.value);
144
141
  });
@@ -147,7 +144,6 @@ describe('Config tests', () => {
147
144
  let config = setup();
148
145
  config.assign("[5]", "[3]", "[2]").value = "me";
149
146
  expect(config.getIf("[5]", "[3]", "[2]").value).to.be.eq("me");
150
- console.debug(JSON.stringify(config.toJson()));
151
147
  expect(config.value[5][3][2]).to.be.eq("me");
152
148
  structureBroken(config.value);
153
149
  });
@@ -156,7 +152,6 @@ describe('Config tests', () => {
156
152
  let config = setup();
157
153
  config.assign("[5]", "world[3]", "from[2]").value = "me";
158
154
  expect(config.getIf("[5]", "world[3]", "from[2]").value).to.be.eq("me");
159
- console.debug(JSON.stringify(config.toJson()));
160
155
  expect(config.value[5].world[3].from[2]).to.be.eq("me");
161
156
  structureBroken(config.value);
162
157
  });
@@ -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
 
@@ -223,11 +226,9 @@ export module StandardInits {
223
226
  var target = "./test.mockup";
224
227
 
225
228
  function emitPPR(source, event, action, useIframe, formName) {
226
- debugger;
227
- console.debug("emitting;");
228
229
  document.getElementById(formName || "form1").action = target;
229
230
 
230
- 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});
231
232
  }
232
233
  </script>
233
234
  </div>
@@ -256,13 +257,22 @@ export module StandardInits {
256
257
  export function defaultHtml(withJsf = true): Promise<() => void> {
257
258
  return init(HTML_DEFAULT, withJsf);
258
259
  }
260
+ export function defaultHtml_23(withJsf = true): Promise<() => void> {
261
+ return init(HTML_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
262
+ }
259
263
 
260
264
  export function defaultMyFaces(withJsf = true): Promise<() => void> {
261
265
  return init(HTML_FORM_DEFAULT, withJsf);
262
266
  }
267
+ export function defaultMyFaces23(withJsf = true): Promise<() => void> {
268
+ return init(HTML_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
269
+ }
263
270
  export function defaultFileForm(withJsf = true): Promise<() => void> {
264
271
  return init(HTML_FILE_FORM_DEFAULT, withJsf);
265
272
  }
273
+ export function defaultFileForm_23(withJsf = true): Promise<() => void> {
274
+ return init(HTML_FILE_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
275
+ }
266
276
 
267
277
  export function shadowDomMyFaces(withJsf = true): Promise<() => void> {
268
278
  return <Promise<() => void>>init(HTML_SHADOW, withJsf).then((close) => {
@@ -275,12 +285,12 @@ export module StandardInits {
275
285
  });
276
286
  }
277
287
 
278
- export function protocolPage(withJsf = true): Promise<() => void> {
279
- 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);
280
290
  }
281
291
 
282
- export function defaultSeparatorChar(separatorChar: string, withJsf = true): Promise<() => void> {
283
- 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);
284
294
  return init(template, withJsf);
285
295
  }
286
296
 
@@ -298,17 +308,31 @@ export module StandardInits {
298
308
  * @param Implementation
299
309
  */
300
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) {
301
323
  (<any>global).jsf = data.jsf;
302
324
  (<any>global).myfaces = data.myfaces;
303
325
  (<any>global).window.jsf = data.jsf;
304
326
  (<any>global).window.myfaces = data.myfaces;
305
327
  (<any>global).Implementation = Implementation.Implementation;
328
+ (<any>global).window.Implementation = Implementation.Implementation;
306
329
  (<any>global).PushImpl = PushImpl.PushImpl;
307
330
  //bypass a bug on windows jsdom, domparser not an auto global but on window only
308
331
  (<any>global).DOMParser = (<any>global)?.DOMParser ?? window.DOMParser;
309
332
  (<any>global).document = (<any>global)?.document ?? window.document;
310
333
  };
311
334
 
335
+
312
336
  /**
313
337
  * init the jsdom global
314
338
  * @param clean
@@ -317,22 +341,27 @@ export module StandardInits {
317
341
  let initJSDOM = async function (template: string) {
318
342
  // @ts-ignore
319
343
  return import('jsdom-global').then((domIt) => {
320
- return domIt(template, {
344
+ let params = {
321
345
  contentType: "text/html",
322
346
  runScripts: "dangerously"
323
- });
347
+ };
348
+ //we have two different apis depending whether we allow module interop with sinon or not
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;