jsf.js_next_gen 4.0.0-beta-4 → 4.0.0-beta-6

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 (134) hide show
  1. package/dist/window/faces-development.js +1952 -2468
  2. package/dist/window/faces-development.js.br +0 -0
  3. package/dist/window/faces-development.js.gz +0 -0
  4. package/dist/window/faces-development.js.map +1 -1
  5. package/dist/window/faces.js +1 -1
  6. package/dist/window/faces.js.br +0 -0
  7. package/dist/window/faces.js.gz +0 -0
  8. package/dist/window/faces.js.map +1 -1
  9. package/dist/window/jsf-development.js +1926 -2469
  10. package/dist/window/jsf-development.js.br +0 -0
  11. package/dist/window/jsf-development.js.gz +0 -0
  12. package/dist/window/jsf-development.js.map +1 -1
  13. package/dist/window/jsf.js +1 -1
  14. package/dist/window/jsf.js.br +0 -0
  15. package/dist/window/jsf.js.gz +0 -0
  16. package/dist/window/jsf.js.map +1 -1
  17. package/package.json +2 -2
  18. package/src/main/typescript/api/_api.ts +258 -0
  19. package/src/main/typescript/api/faces.ts +17 -245
  20. package/src/main/typescript/api/jsf.ts +24 -7
  21. package/src/main/typescript/impl/AjaxImpl.ts +1 -0
  22. package/src/main/typescript/impl/core/Const.ts +10 -29
  23. package/src/main/typescript/impl/util/ExtDomQuery.ts +89 -16
  24. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +4 -4
  25. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +5 -3
  26. package/src/main/typescript/impl/xhrCore/Response.ts +8 -6
  27. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +14 -13
  28. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +2 -1
  29. package/src/main/typescript/myfaces/OamSubmit.ts +6 -5
  30. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +6 -4
  31. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +14 -23
  32. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +362 -0
  33. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +372 -0
  34. package/src/main/typescript/tsconfig-typedoc.json +17 -1
  35. package/src/main/typescript/tsconfig.json +17 -2
  36. package/src/test/resources/jsf-development.js +1 -1
  37. package/target/api/Jsf.js +24 -10
  38. package/target/api/Jsf.js.map +1 -1
  39. package/target/api/_api.js +246 -0
  40. package/target/api/_api.js.map +1 -0
  41. package/target/api/_faces.js +251 -0
  42. package/target/api/_faces.js.map +1 -0
  43. package/target/api/faces.js +20 -247
  44. package/target/api/faces.js.map +1 -1
  45. package/target/impl/AjaxImpl.js +53 -61
  46. package/target/impl/AjaxImpl.js.map +1 -1
  47. package/target/impl/PushImpl.js +38 -41
  48. package/target/impl/PushImpl.js.map +1 -1
  49. package/target/impl/core/Const.js +10 -33
  50. package/target/impl/core/Const.js.map +1 -1
  51. package/target/impl/core/ImplTypes.js +9 -14
  52. package/target/impl/core/ImplTypes.js.map +1 -1
  53. package/target/impl/i18n/Messages.js +3 -4
  54. package/target/impl/i18n/Messages.js.map +1 -1
  55. package/target/impl/util/Assertions.js +9 -18
  56. package/target/impl/util/Assertions.js.map +1 -1
  57. package/target/impl/util/AsyncQueue.js +28 -36
  58. package/target/impl/util/AsyncQueue.js.map +1 -1
  59. package/target/impl/util/ExtDomQuery.js +153 -133
  60. package/target/impl/util/ExtDomQuery.js.map +1 -1
  61. package/target/impl/util/Lang.js +21 -28
  62. package/target/impl/util/Lang.js.map +1 -1
  63. package/target/impl/xhrCore/ErrorData.js +36 -61
  64. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  65. package/target/impl/xhrCore/EventData.js +10 -13
  66. package/target/impl/xhrCore/EventData.js.map +1 -1
  67. package/target/impl/xhrCore/RequestDataResolver.js +16 -19
  68. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  69. package/target/impl/xhrCore/ResonseDataResolver.js +17 -16
  70. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  71. package/target/impl/xhrCore/Response.js +21 -20
  72. package/target/impl/xhrCore/Response.js.map +1 -1
  73. package/target/impl/xhrCore/ResponseProcessor.js +126 -140
  74. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  75. package/target/impl/xhrCore/XhrFormData.js +68 -97
  76. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  77. package/target/impl/xhrCore/XhrRequest.js +81 -91
  78. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  79. package/target/myfaces/OamSubmit.js +20 -18
  80. package/target/myfaces/OamSubmit.js.map +1 -1
  81. package/target/test/frameworkBase/LangTest.spec.js +46 -32
  82. package/target/test/frameworkBase/LangTest.spec.js.map +1 -1
  83. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +160 -82
  84. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  85. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +45 -31
  86. package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +1 -1
  87. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +24 -33
  88. package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -1
  89. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +8 -8
  90. package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +1 -1
  91. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +31 -31
  92. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  93. package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +50 -48
  94. package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +1 -1
  95. package/target/test/frameworkBase/_ext/shared/StandardInits.js +235 -132
  96. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  97. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +162 -18
  98. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  99. package/target/test/impl/ImplTest.spec.js +34 -61
  100. package/target/test/impl/ImplTest.spec.js.map +1 -1
  101. package/target/test/impl/ImplTest_23.spec.js +35 -64
  102. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  103. package/target/test/impl/SeparatorCharsTest.spec.js +19 -19
  104. package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
  105. package/target/test/myfaces/OamSubmit.spec.js +34 -41
  106. package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
  107. package/target/test/queue/AsynchronousProbe.js +23 -29
  108. package/target/test/queue/AsynchronousProbe.js.map +1 -1
  109. package/target/test/queue/AsynchronousQueueTest.spec.js +39 -70
  110. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  111. package/target/test/xhrCore/EventTests.spec.js +47 -78
  112. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  113. package/target/test/xhrCore/FakeWebsocket.js +14 -16
  114. package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
  115. package/target/test/xhrCore/FileUploadTest.spec.js +49 -80
  116. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  117. package/target/test/xhrCore/RequestParamsTest.spec.js +39 -70
  118. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  119. package/target/test/xhrCore/RequestTest.spec.js +76 -113
  120. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  121. package/target/test/xhrCore/RequestTest_23.spec.js +332 -0
  122. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -0
  123. package/target/test/xhrCore/ResponseTest.spec.js +118 -87
  124. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  125. package/target/test/xhrCore/ResponseTest23.spec.js +314 -0
  126. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -0
  127. package/target/test/xhrCore/ShadowDomTest.spec.js +31 -62
  128. package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
  129. package/target/test/xhrCore/WebsocketTest.js +60 -93
  130. package/target/test/xhrCore/WebsocketTest.js.map +1 -1
  131. package/target/test/xhrCore/XhrFormDataTest.spec.js +41 -15
  132. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  133. package/webpack.config.js +71 -0
  134. package/webpack.config.js.map +1 -0
@@ -13,8 +13,8 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import {Config, IValueHolder, Optional, DomQuery, DQ} from "mona-dish";
17
- import {P_WINDOW_ID} from "../core/Const";
16
+ import {Config, IValueHolder, Optional, DomQuery, DQ, Stream, ArrayCollector} from "mona-dish";
17
+ import {$nsp, P_WINDOW_ID} from "../core/Const";
18
18
 
19
19
  declare let window: any;
20
20
 
@@ -28,17 +28,16 @@ declare let window: any;
28
28
  */
29
29
  const IS_FACES_SOURCE = (source?: string): boolean => {
30
30
  //spec version smaller 4 we have to deal with the jsf namespace
31
- if (window.jsf) {
32
- // fallback into 2.3 api level
33
- return source && !!(source?.search(/\/javax\.faces\.resource.*\/jsf\.js.*/) != -1 ||
34
- source?.search(/\/jsf-development\.js.*/) != -1 ||
35
- source?.search(/\/jsf-uncompressed\.js.*/) != -1 ||
36
- source?.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi) != -1);
37
- }
31
+
38
32
  return source && !!(source?.search(/\/jakarta\.faces\.resource.*\/faces\.js.*/) != -1 ||
39
33
  source?.search(/\/faces-development\.js.*/) != -1 ||
40
34
  source?.search(/\/faces-uncompressed\.js.*/) != -1 ||
41
- source?.search(/\/faces[^.]*\.js.*ln=jakarta.faces.*/gi) != -1);
35
+ source?.search(/\/faces[^.]*\.js.*ln=jakarta.faces.*/gi) != -1 ||
36
+ //fallback without check for jsf, that way we allow both bookmarks
37
+ source?.search(/\/javax\.faces\.resource.*\/jsf\.js.*/) != -1 ||
38
+ source?.search(/\/jsf-development\.js.*/) != -1 ||
39
+ source?.search(/\/jsf-uncompressed\.js.*/) != -1 ||
40
+ source?.search(/\/jsf[^.]*\.js.*ln=javax.faces.*/gi) != -1);
42
41
  }
43
42
 
44
43
  /**
@@ -50,10 +49,7 @@ const IS_FACES_SOURCE = (source?: string): boolean => {
50
49
  * @constructor
51
50
  */
52
51
  const IS_INTERNAL_SOURCE = (source: string): boolean => {
53
- if (window?.jsf) {
54
- return source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
55
- }
56
- return source.search(/\/faces[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
52
+ return source.search(/\/faces[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1 || source.search(/\/jsf[^.]*\.js.*ln=myfaces.testscripts.*/gi) != -1;
57
53
  }
58
54
 
59
55
 
@@ -109,7 +105,7 @@ export class ExtDomquery extends DQ {
109
105
  */
110
106
  get nonce(): string | null {
111
107
  //already processed
112
- let myfacesConfig = new Config(window.myfaces);
108
+ let myfacesConfig = new ExtConfig(window.myfaces);
113
109
  let nonce: IValueHolder<string> = myfacesConfig.getIf("config", "cspMeta", "nonce");
114
110
  if (nonce.value) {
115
111
  return <string>nonce.value;
@@ -185,4 +181,81 @@ export class ExtDomquery extends DQ {
185
181
  }
186
182
  }
187
183
 
188
- export const ExtDQ = DQ;
184
+ export const ExtDQ = ExtDomquery;
185
+
186
+ /**
187
+ * in order to reduce the number of interception points for the fallbacks we add
188
+ * the namespace remapping straight to our config accessors
189
+ */
190
+ export class ExtConfig extends Config {
191
+
192
+ constructor(root: any) {
193
+ super(root);
194
+ }
195
+
196
+ assignIf(condition: boolean, ...accessPath): IValueHolder<any> {
197
+ const acessPathMapped = this.remap(accessPath);
198
+ return super.assignIf(condition, ...acessPathMapped);
199
+ }
200
+
201
+ assign(...accessPath): IValueHolder<any> {
202
+ const acessPathMapped = this.remap(accessPath);
203
+ return super.assign(...acessPathMapped);
204
+ }
205
+
206
+ append(...accessPath): IValueHolder<any> {
207
+ return super.append(...accessPath);
208
+ }
209
+
210
+ appendIf(condition: boolean, ...accessPath): IValueHolder<any> {
211
+ const acessPathMapped = this.remap(accessPath);
212
+ return super.appendIf(condition, ...acessPathMapped);
213
+ }
214
+
215
+ getIf(...accessPath): Config {
216
+ const acessPathMapped = this.remap(accessPath);
217
+ return super.getIf(...acessPathMapped);
218
+ }
219
+
220
+ get(defaultVal: any): Config {
221
+ return super.get($nsp(defaultVal));
222
+ }
223
+
224
+ delete(key: string): Config {
225
+ return super.delete($nsp(key));
226
+ }
227
+
228
+ /**
229
+ * creates a config from an initial value or null
230
+ * @param value
231
+ */
232
+ static fromNullable<T>(value?: T | null): Config {
233
+ return new ExtConfig(value);
234
+ }
235
+
236
+ protected getClass(): any {
237
+ return ExtConfig;
238
+ }
239
+
240
+ /**
241
+ * shallow copy getter, copies only the first level, references the deeper nodes
242
+ * in a shared manner
243
+ */
244
+ protected shallowCopy$(): Config {
245
+ const ret = super.shallowCopy$();
246
+ return new ExtConfig(ret);
247
+ }
248
+
249
+ /**
250
+ * deep copy, copies all config nodes
251
+ */
252
+ get deepCopy(): Config {
253
+ return new ExtConfig(super.deepCopy$());
254
+ }
255
+
256
+
257
+ private remap(accessPath: any[]) {
258
+ return Stream.of(...accessPath).map(key => $nsp(key)).collect(new ArrayCollector());
259
+ }
260
+
261
+ }
@@ -27,7 +27,7 @@ import {
27
27
  } from "../core/Const";
28
28
  import {XhrFormData} from "./XhrFormData";
29
29
  import {ExtLang} from "../util/Lang";
30
- import {ExtDomquery} from "../util/ExtDomQuery";
30
+ import {ExtConfig, ExtDomquery} from "../util/ExtDomQuery";
31
31
 
32
32
  /**
33
33
  * Resolver functions for various aspects of the request data
@@ -140,10 +140,10 @@ export function getEventTarget(evt: Event): Element {
140
140
  export function resolveDefaults(event: Event, opts: any = {}, el: Element | string = null) {
141
141
  //deep copy the options, so that further transformations to not backfire into the callers
142
142
  const resolvedEvent = event,
143
- options = new Config(opts).deepCopy,
143
+ options = new ExtConfig(opts).deepCopy,
144
144
  elem = DQ.byId(el || <Element>resolvedEvent.target, true),
145
- elementId = elem.id.value, requestCtx = new Config({}),
146
- internalCtx = new Config({}), windowId = resolveWindowId(options),
145
+ elementId = elem.id.value, requestCtx = new ExtConfig({}),
146
+ internalCtx = new ExtConfig({}), windowId = resolveWindowId(options),
147
147
  isResetValues = true === options.value?.resetValues;
148
148
 
149
149
  return {resolvedEvent, options, elem, elementId, requestCtx, internalCtx, windowId, isResetValues};
@@ -19,6 +19,7 @@ import {Config, Optional, XMLQuery} from "mona-dish";
19
19
  import {Assertions} from "../util/Assertions";
20
20
  import {DQ} from "mona-dish";
21
21
  import {
22
+ $nsp,
22
23
  CTX_PARAM_MF_INTERNAL,
23
24
  CTX_PARAM_SRC_CTL_ID,
24
25
  CTX_PARAM_SRC_FRM_ID,
@@ -28,6 +29,7 @@ import {
28
29
  UPDATE_ELEMS,
29
30
  UPDATE_FORMS
30
31
  } from "../core/Const";
32
+ import {ExtConfig} from "../util/ExtDomQuery";
31
33
 
32
34
  /**
33
35
  * Resolver functions for various aspects of the response data
@@ -46,7 +48,7 @@ import {
46
48
  *
47
49
  */
48
50
  export function resolveResponseXML(request: Config): XMLQuery {
49
- let ret = new XMLQuery(request.getIf(SEL_RESPONSE_XML).value);
51
+ let ret = new XMLQuery($nsp(request.getIf(SEL_RESPONSE_XML).value));
50
52
  Assertions.assertValidXMLResponse(ret);
51
53
 
52
54
  return ret;
@@ -64,10 +66,10 @@ export function resolveContexts(context: { [p: string]: any }): any {
64
66
  * we split the context apart into the external one and
65
67
  * some internal values
66
68
  */
67
- let externalContext = Config.fromNullable(context);
69
+ let externalContext = ExtConfig.fromNullable(context);
68
70
  let internalContext = externalContext.getIf(CTX_PARAM_MF_INTERNAL);
69
71
  if (!internalContext.isPresent()) {
70
- internalContext = Config.fromNullable({});
72
+ internalContext = ExtConfig.fromNullable({});
71
73
  }
72
74
 
73
75
  /**
@@ -19,6 +19,7 @@ import {ResponseProcessor} from "./ResponseProcessor";
19
19
 
20
20
  import {IResponseProcessor} from "./IResponseProcessor";
21
21
  import {
22
+ $nsp,
22
23
  CMD_ATTRIBUTES,
23
24
  CMD_CHANGES,
24
25
  CMD_DELETE,
@@ -38,6 +39,7 @@ import {
38
39
  TAG_BEFORE
39
40
  } from "../core/Const";
40
41
  import {resolveContexts, resolveResponseXML} from "./ResonseDataResolver";
42
+ import {ExtConfig} from "../util/ExtDomQuery";
41
43
 
42
44
 
43
45
 
@@ -45,8 +47,8 @@ export module Response {
45
47
 
46
48
 
47
49
  /**
48
- * Standardized faces.js response
49
- * this one is called straight from faces.js.response
50
+ * Standardized faces.ts response
51
+ * this one is called straight from faces.ts.response
50
52
  *
51
53
  * The processing follows the spec by going for the responseXML
52
54
  * and processing its tags
@@ -57,7 +59,7 @@ export module Response {
57
59
  */
58
60
  export function processResponse(request: XMLHttpRequest, context: Context) {
59
61
 
60
- let req = Config.fromNullable(request);
62
+ let req = ExtConfig.fromNullable(request);
61
63
  let {externalContext, internalContext} = resolveContexts(context);
62
64
  let responseXML: XMLQuery = resolveResponseXML(req);
63
65
  let responseProcessor = new ResponseProcessor(req, externalContext, internalContext);
@@ -191,15 +193,15 @@ export module Response {
191
193
  function handleElementUpdate(node: XMLQuery, responseProcessor: IResponseProcessor) {
192
194
  let cdataBlock = node.cDATAAsString;
193
195
  switch (node.id.value) {
194
- case P_VIEWROOT :
196
+ case $nsp(P_VIEWROOT) :
195
197
  responseProcessor.replaceViewRoot(DQ.fromMarkup(cdataBlock.substring(cdataBlock.indexOf("<html"))));
196
198
  break;
197
199
 
198
- case P_VIEWHEAD:
200
+ case $nsp(P_VIEWHEAD):
199
201
  responseProcessor.replaceHead(DQ.fromMarkup(cdataBlock));
200
202
  break;
201
203
 
202
- case P_VIEWBODY:
204
+ case $nsp(P_VIEWBODY):
203
205
  responseProcessor.replaceBody(DQ.fromMarkup(cdataBlock));
204
206
  break;
205
207
 
@@ -23,6 +23,7 @@ import {StateHolder} from "../core/ImplTypes";
23
23
  import {EventData} from "./EventData";
24
24
 
25
25
  import {
26
+ $nsp,
26
27
  APPLIED_CLIENT_WINDOW,
27
28
  APPLIED_VST,
28
29
  ATTR_ID,
@@ -53,7 +54,7 @@ import {
53
54
  UPDATE_FORMS
54
55
  } from "../core/Const";
55
56
  import trim = Lang.trim;
56
- import {ExtDomquery} from "../util/ExtDomQuery";
57
+ import {ExtConfig, ExtDomquery} from "../util/ExtDomQuery";
57
58
 
58
59
  declare const window: any;
59
60
 
@@ -147,7 +148,7 @@ export class ResponseProcessor implements IResponseProcessor {
147
148
  * <error>
148
149
  */
149
150
 
150
- let mergedErrorData = new Config({});
151
+ let mergedErrorData = new ExtConfig({});
151
152
  mergedErrorData.assign(SOURCE).value = this.externalContext.getIf(P_PARTIAL_SOURCE).get(0).value;
152
153
  mergedErrorData.assign(ERROR_NAME).value = node.querySelectorAll(ERROR_NAME).textContent(EMPTY_STR);
153
154
  mergedErrorData.assign(ERROR_MESSAGE).value = node.querySelectorAll(ERROR_MESSAGE).cDATAAsString;
@@ -285,7 +286,7 @@ export class ResponseProcessor implements IResponseProcessor {
285
286
  processViewState(node: XMLQuery): boolean {
286
287
  if (ResponseProcessor.isViewStateNode(node)) {
287
288
  let state = node.cDATAAsString;
288
- this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder(node.id.value, state);
289
+ this.internalContext.assign(APPLIED_VST, node.id.value).value = new StateHolder($nsp(node.id.value), state);
289
290
  return true;
290
291
  }
291
292
  return false;
@@ -294,7 +295,7 @@ export class ResponseProcessor implements IResponseProcessor {
294
295
  processClientWindow(node: XMLQuery): boolean {
295
296
  if (ResponseProcessor.isClientWindowNode(node)) {
296
297
  let state = node.cDATAAsString;
297
- this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder(node.id.value, state);
298
+ this.internalContext.assign(APPLIED_CLIENT_WINDOW, node.id.value).value = new StateHolder($nsp(node.id.value), state);
298
299
  return true;
299
300
  }
300
301
  }
@@ -360,7 +361,7 @@ export class ResponseProcessor implements IResponseProcessor {
360
361
  * @param viewState the final viewstate
361
362
  */
362
363
  private appendViewStateToForms(forms: DQ, viewState: string) {
363
- this.assignState(forms, SEL_VIEWSTATE_ELEM, viewState);
364
+ this.assignState(forms, $nsp(SEL_VIEWSTATE_ELEM), viewState);
364
365
  }
365
366
 
366
367
 
@@ -371,7 +372,7 @@ export class ResponseProcessor implements IResponseProcessor {
371
372
  * @param clientWindow the final viewstate
372
373
  */
373
374
  private appendClientWindowToForms(forms: DQ, clientWindow: string) {
374
- this.assignState(forms, SEL_CLIENT_WINDOW_ELEM, clientWindow);
375
+ this.assignState(forms, $nsp(SEL_CLIENT_WINDOW_ELEM), clientWindow);
375
376
  }
376
377
 
377
378
  /**
@@ -399,7 +400,7 @@ export class ResponseProcessor implements IResponseProcessor {
399
400
  * (usually a form node)
400
401
  */
401
402
  private static newViewStateElement(parent: DQ): DQ {
402
- let newViewState = DQ.fromMarkup(HTML_VIEWSTATE);
403
+ let newViewState = DQ.fromMarkup($nsp(HTML_VIEWSTATE));
403
404
  newViewState.appendTo(parent);
404
405
  return newViewState;
405
406
  }
@@ -441,9 +442,9 @@ export class ResponseProcessor implements IResponseProcessor {
441
442
  */
442
443
  private static isViewStateNode(node: XMLQuery): boolean {
443
444
  let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
444
- return "undefined" != typeof node?.id?.value && (node?.id?.value == P_VIEWSTATE ||
445
- node?.id?.value?.indexOf([separatorChar, P_VIEWSTATE].join(EMPTY_STR)) != -1 ||
446
- node?.id?.value?.indexOf([P_VIEWSTATE, separatorChar].join(EMPTY_STR)) != -1);
445
+ return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_VIEWSTATE) ||
446
+ node?.id?.value?.indexOf([separatorChar, $nsp(P_VIEWSTATE)].join(EMPTY_STR)) != -1 ||
447
+ node?.id?.value?.indexOf([$nsp(P_VIEWSTATE), separatorChar].join(EMPTY_STR)) != -1);
447
448
  }
448
449
 
449
450
  /**
@@ -454,9 +455,9 @@ export class ResponseProcessor implements IResponseProcessor {
454
455
  */
455
456
  private static isClientWindowNode(node: XMLQuery): boolean {
456
457
  let separatorChar = (window?.faces ?? window?.jsf).separatorchar;
457
- return "undefined" != typeof node?.id?.value && (node?.id?.value == P_CLIENT_WINDOW ||
458
- node?.id?.value?.indexOf([separatorChar, P_CLIENT_WINDOW].join(EMPTY_STR)) != -1 ||
459
- node?.id?.value?.indexOf([P_CLIENT_WINDOW, separatorChar].join(EMPTY_STR)) != -1);
458
+ return "undefined" != typeof node?.id?.value && (node?.id?.value == $nsp(P_CLIENT_WINDOW) ||
459
+ node?.id?.value?.indexOf([separatorChar, $nsp(P_CLIENT_WINDOW)].join(EMPTY_STR)) != -1 ||
460
+ node?.id?.value?.indexOf([$nsp(P_CLIENT_WINDOW), separatorChar].join(EMPTY_STR)) != -1);
460
461
  }
461
462
 
462
463
  private triggerOnError(errorData: ErrorData) {
@@ -16,6 +16,7 @@
16
16
  import {ArrayCollector, Config, DQ, Lang, LazyStream, Stream} from "mona-dish";
17
17
  import {EMPTY_STR, IDENT_ALL, IDENT_FORM, P_VIEWSTATE} from "../core/Const";
18
18
  import isString = Lang.isString;
19
+ import {ExtConfig} from "../util/ExtDomQuery";
19
20
 
20
21
 
21
22
  /**
@@ -121,7 +122,7 @@ export class XhrFormData extends Config {
121
122
  * @param keyValueEntries
122
123
  */
123
124
  assignString(keyValueEntries: string[]) {
124
- let toMerge = new Config({});
125
+ let toMerge = new ExtConfig({});
125
126
 
126
127
  function splitToKeyVal(line: string) {
127
128
  return line.split(/=(.*)/gi);
@@ -105,13 +105,14 @@ export module oam {
105
105
  }
106
106
  } catch (e) {
107
107
  window?.console.error(e);
108
+ } finally {
109
+ form.attr(ATTR_TARGET).value = oldTarget;
110
+ Stream.ofAssoc(params).each((param: [string, any]) => {
111
+ myfaces.oam.clearHiddenInput(formName, param[0]);
112
+ });
113
+ myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
108
114
  }
109
115
 
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
116
  });
116
117
  return false;
117
118
  };
@@ -16,10 +16,11 @@
16
16
 
17
17
 
18
18
  import {DomQuery} from "mona-dish";
19
- import {remapNamespacesFor23, remapNamespacesFor40} from "../../../../impl/core/Const";
19
+
20
20
 
21
21
  declare let global;
22
22
  declare let faces: any;
23
+ declare let jsf: any;
23
24
  declare let myfaces: any;
24
25
 
25
26
  /**
@@ -216,7 +217,7 @@ export module StandardInits {
216
217
  onclick="emitPPR(this, ('undefined' == typeof event)? null: event, 'errors');"/>
217
218
 
218
219
  <input type="button" id="cmd_error_component" value="Error: no component given"
219
- onclick="faces.ajax.request(null, event, {}); return false"/>
220
+ onclick="(window.faces || window.jsf).ajax.request(null, event, {}); return false"/>
220
221
 
221
222
  </form>
222
223
 
@@ -228,7 +229,7 @@ export module StandardInits {
228
229
  function emitPPR(source, event, action, useIframe, formName) {
229
230
  document.getElementById(formName || "form1").action = target;
230
231
 
231
- faces.ajax.request(/*String|Dom Node*/ source, /*|EVENT|*/ (window.event) ? window.event : event, /*{|OPTIONS|}*/ {op: action});
232
+ (window?.faces ?? window.jsf).ajax.request(/*String|Dom Node*/ source, /*|EVENT|*/ (window.event) ? window.event : event, /*{|OPTIONS|}*/ {op: action});
232
233
  }
233
234
  </script>
234
235
  </div>
@@ -311,6 +312,7 @@ export module StandardInits {
311
312
  (<any>global).faces = data.faces;
312
313
  (<any>global).myfaces = data.myfaces;
313
314
  (<any>global).window.faces = data.faces;
315
+ debugger;
314
316
  (<any>global).window.myfaces = data.myfaces;
315
317
  (<any>global).Implementation = Implementation.Implementation;
316
318
  (<any>global).PushImpl = PushImpl.PushImpl;
@@ -323,6 +325,7 @@ export module StandardInits {
323
325
  (<any>global).jsf = data.jsf;
324
326
  (<any>global).myfaces = data.myfaces;
325
327
  (<any>global).window.jsf = data.jsf;
328
+ debugger;
326
329
  (<any>global).window.myfaces = data.myfaces;
327
330
  (<any>global).Implementation = Implementation.Implementation;
328
331
  (<any>global).window.Implementation = Implementation.Implementation;
@@ -379,7 +382,6 @@ export module StandardInits {
379
382
  delete (<any>global).myfaces;
380
383
  ((<any>global).Implementation) ? delete (<any>global).Implementation : null;
381
384
  delete (<any>global).PushImpl;
382
- remapNamespacesFor40();
383
385
  };
384
386
 
385
387
  /**
@@ -62,9 +62,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
62
62
  it('submit form must work', function() {
63
63
  let FORM_ID = "blarg";
64
64
  let form = DomQuery.byId(FORM_ID);
65
- let submitCalled;
66
- (form.value.value as any).submit = () => {
67
- submitCalled = true;
65
+ const submit_spy = Sinon.spy(() => {
68
66
  expect(form.querySelectorAll('input[name=\'booga1\']').isPresent()).to.eq(true);
69
67
  expect(form.querySelectorAll('input[name=\'booga1\']').length == 1).to.eq(true);
70
68
  expect(form.querySelectorAll('input[name=\'booga1\']').inputValue.value == 'val_booga1').to.eq(true);
@@ -75,7 +73,8 @@ describe('Tests on the xhr core when it starts to call the request', function ()
75
73
  expect(form.querySelectorAll(`input[name='${FORM_ID}:_idcl']`).length == 1).to.eq(true);
76
74
  expect(form.querySelectorAll(`input[name='${FORM_ID}:_idcl']`).inputValue.value == 'mylink').to.eq(true);
77
75
  expect(form.attr("target").value).to.eq('target1');
78
- }
76
+ });
77
+ (form.value.value as any).submit = submit_spy;
79
78
 
80
79
 
81
80
  submitForm(FORM_ID, 'mylink', 'target1', {
@@ -83,27 +82,18 @@ describe('Tests on the xhr core when it starts to call the request', function ()
83
82
  booga2: "val_booga2"
84
83
  });
85
84
 
86
- expect(submitCalled).to.eq(true);
85
+ expect(submit_spy.called).to.eq(true);
87
86
  form = DomQuery.byId(FORM_ID);
88
87
  expect(form.querySelectorAll('input[name=\'booga1\']').isAbsent()).to.eq(true);
89
88
  expect(form.querySelectorAll('input[name=\'booga2\']').isAbsent()).to.eq(true);
90
89
  expect(form.querySelectorAll(`input[name='${FORM_ID}:_idcl']`).isAbsent()).to.eq(true);
91
90
 
92
- //const os_spy = Sinon.spy(form.getAsElem(0).value, 'onsubmit' as keyof Element);
93
- const submit_spy = Sinon.spy(form.getAsElem(0).value, 'submit' as keyof Element);
94
- expect
95
-
96
- //we also have to interceot onsbumit
97
- // expect(os_spy.called).to.eq(true);
98
- // expect(submit_spy.called).to.eq(true);
99
91
  })
100
92
 
101
93
  it('onsubmit form must work', function() {
102
94
  let FORM_ID = "blarg";
103
95
  let form = DomQuery.byId(FORM_ID);
104
- let onSubmitCalled;
105
- (form.value.value as any).onsubmit = () => {
106
- onSubmitCalled = true;
96
+ const onsumbit = () => {
107
97
  expect(form.querySelectorAll('input[name=\'booga1\']').isPresent()).to.eq(true);
108
98
  expect(form.querySelectorAll('input[name=\'booga1\']').length == 1).to.eq(true);
109
99
  expect(form.querySelectorAll('input[name=\'booga1\']').inputValue.value == 'val_booga1').to.eq(true);
@@ -114,7 +104,12 @@ describe('Tests on the xhr core when it starts to call the request', function ()
114
104
  expect(form.querySelectorAll(`input[name='${FORM_ID}:_idcl']`).length == 1).to.eq(true);
115
105
  expect(form.querySelectorAll(`input[name='${FORM_ID}:_idcl']`).inputValue.value == 'mylink').to.eq(true);
116
106
  expect(form.attr("target").value).to.eq('target1');
107
+ return false;
117
108
  }
109
+ const os_spy = Sinon.spy(onsumbit);
110
+ const submit_spy = Sinon.spy(() => {});
111
+ (form.value.value as any).onsubmit = os_spy;
112
+ (form.value.value as any).submit = submit_spy;
118
113
 
119
114
 
120
115
  submitForm(FORM_ID, 'mylink', 'target1', {
@@ -122,18 +117,14 @@ describe('Tests on the xhr core when it starts to call the request', function ()
122
117
  booga2: "val_booga2"
123
118
  });
124
119
 
125
- expect(onSubmitCalled).to.eq(true);
120
+ //we also have to interceot onsbumit
121
+ expect(os_spy.called).to.eq(true);
122
+ expect(submit_spy.called).to.eq(false);
123
+
126
124
  form = DomQuery.byId(FORM_ID);
127
125
  expect(form.querySelectorAll('input[name=\'booga1\']').isAbsent()).to.eq(true);
128
126
  expect(form.querySelectorAll('input[name=\'booga2\']').isAbsent()).to.eq(true);
129
127
  expect(form.querySelectorAll(`input[name='${FORM_ID}:_idcl']`).isAbsent()).to.eq(true);
130
-
131
- //const os_spy = Sinon.spy(form.getAsElem(0).value, 'onsubmit' as keyof Element);
132
- const submit_spy = Sinon.spy(form.getAsElem(0).value, 'submit' as keyof Element);
133
- expect
134
-
135
- //we also have to interceot onsbumit
136
- // expect(os_spy.called).to.eq(true);
137
128
  // expect(submit_spy.called).to.eq(true);
138
129
  })
139
130