jsf.js_next_gen 4.0.0-beta-23 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (200) hide show
  1. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  2. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  3. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  4. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +7 -22
  7. package/dist/docs/assets/main.js +56 -52
  8. package/dist/docs/assets/search.js +1 -1
  9. package/dist/docs/assets/style.css +23 -0
  10. package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
  11. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
  12. package/dist/docs/functions/faces.ajax.request.html +7 -7
  13. package/dist/docs/functions/faces.ajax.response.html +0 -1
  14. package/dist/docs/functions/faces.push.close.html +4 -2
  15. package/dist/docs/functions/faces.push.init.html +19 -7
  16. package/dist/docs/functions/faces.push.open.html +4 -2
  17. package/dist/docs/functions/faces.util.chain.html +3 -3
  18. package/dist/docs/functions/myfaces.ab.html +9 -4
  19. package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
  20. package/dist/docs/index.html +7 -18
  21. package/dist/docs/modules/myfaces.html +3 -1
  22. package/dist/docs/variables/myfaces.oam.html +2 -1
  23. package/dist/window/faces-development.js +2147 -1779
  24. package/dist/window/faces-development.js.br +0 -0
  25. package/dist/window/faces-development.js.gz +0 -0
  26. package/dist/window/faces-development.js.map +1 -1
  27. package/dist/window/faces.js +1 -1
  28. package/dist/window/faces.js.LICENSE.txt +17 -2
  29. package/dist/window/faces.js.br +0 -0
  30. package/dist/window/faces.js.gz +0 -0
  31. package/dist/window/faces.js.map +1 -1
  32. package/dist/window/jsf-development.js +2156 -1777
  33. package/dist/window/jsf-development.js.br +0 -0
  34. package/dist/window/jsf-development.js.gz +0 -0
  35. package/dist/window/jsf-development.js.map +1 -1
  36. package/dist/window/jsf.js +1 -1
  37. package/dist/window/jsf.js.LICENSE.txt +17 -2
  38. package/dist/window/jsf.js.br +0 -0
  39. package/dist/window/jsf.js.gz +0 -0
  40. package/dist/window/jsf.js.map +1 -1
  41. package/package.json +19 -18
  42. package/pom.xml +1 -1
  43. package/src/main/test.xml +23 -0
  44. package/src/main/typescript/@types/definitions/index.d.ts +24 -7
  45. package/src/main/typescript/api/_api.ts +79 -37
  46. package/src/main/typescript/api/jsf.ts +18 -0
  47. package/src/main/typescript/impl/AjaxImpl.ts +168 -78
  48. package/src/main/typescript/impl/PushImpl.ts +63 -38
  49. package/src/main/typescript/impl/core/Const.ts +52 -39
  50. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  51. package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
  52. package/src/main/typescript/impl/util/AsyncRunnable.ts +4 -4
  53. package/src/main/typescript/impl/util/ExtDomQuery.ts +58 -45
  54. package/src/main/typescript/impl/util/FileUtils.ts +104 -0
  55. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
  56. package/src/main/typescript/impl/util/Lang.ts +30 -31
  57. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  58. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
  59. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
  60. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
  61. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
  62. package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
  63. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +202 -131
  64. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +79 -166
  65. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -68
  66. package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
  67. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +19 -22
  68. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +108 -1
  69. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  70. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  71. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
  72. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
  73. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
  74. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  75. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  76. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
  77. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +242 -11
  78. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
  79. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +373 -35
  80. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  81. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
  82. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  83. package/src/main/typescript/test.xml +6 -0
  84. package/src/main/typescript/tsconfig.json +1 -1
  85. package/src/test/resources/jsf-development.js +1 -1
  86. package/src/tmp/test.html +12 -88
  87. package/target/api/_api.js +72 -31
  88. package/target/api/_api.js.map +1 -1
  89. package/target/api/jsf.js +11 -0
  90. package/target/api/jsf.js.map +1 -1
  91. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  92. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  93. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  94. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  95. package/target/impl/AjaxImpl.js +144 -59
  96. package/target/impl/AjaxImpl.js.map +1 -1
  97. package/target/impl/PushImpl.js +66 -35
  98. package/target/impl/PushImpl.js.map +1 -1
  99. package/target/impl/core/Const.js +51 -38
  100. package/target/impl/core/Const.js.map +1 -1
  101. package/target/impl/core/Context.js +10 -0
  102. package/target/impl/core/Context.js.map +1 -0
  103. package/target/impl/util/Assertions.js +12 -7
  104. package/target/impl/util/Assertions.js.map +1 -1
  105. package/target/impl/util/AsyncQueue.js.map +1 -1
  106. package/target/impl/util/ExtDomQuery.js +58 -40
  107. package/target/impl/util/ExtDomQuery.js.map +1 -1
  108. package/target/impl/util/FileUtils.js +96 -0
  109. package/target/impl/util/FileUtils.js.map +1 -0
  110. package/target/impl/util/HiddenElementBuilder.js +7 -0
  111. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  112. package/target/impl/util/HiddenInputBuilder.js +79 -0
  113. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  114. package/target/impl/util/Lang.js +29 -30
  115. package/target/impl/util/Lang.js.map +1 -1
  116. package/target/impl/util/URLCodec.js +77 -0
  117. package/target/impl/util/URLCodec.js.map +1 -0
  118. package/target/impl/util/XhrQueueController.js +82 -0
  119. package/target/impl/util/XhrQueueController.js.map +1 -0
  120. package/target/impl/xhrCore/ErrorData.js +10 -8
  121. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  122. package/target/impl/xhrCore/EventData.js +1 -1
  123. package/target/impl/xhrCore/EventData.js.map +1 -1
  124. package/target/impl/xhrCore/RequestContext.js +11 -0
  125. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  126. package/target/impl/xhrCore/RequestDataResolver.js +70 -23
  127. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  128. package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
  129. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  130. package/target/impl/xhrCore/Response.js +44 -29
  131. package/target/impl/xhrCore/Response.js.map +1 -1
  132. package/target/impl/xhrCore/ResponseProcessor.js +182 -116
  133. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  134. package/target/impl/xhrCore/XhrFormData.js +68 -156
  135. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  136. package/target/impl/xhrCore/XhrQueHandler.js +11 -0
  137. package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
  138. package/target/impl/xhrCore/XhrQueueController.js +62 -0
  139. package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
  140. package/target/impl/xhrCore/XhrRequest.js +68 -59
  141. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  142. package/target/myfaces/OamSubmit.js +23 -14
  143. package/target/myfaces/OamSubmit.js.map +1 -1
  144. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +16 -16
  145. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  146. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
  147. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
  148. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
  149. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
  150. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
  151. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
  152. package/target/test/frameworkBase/_ext/shared/StandardInits.js +100 -1
  153. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  154. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  155. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  156. package/target/test/impl/ImplTest.spec.js +2 -2
  157. package/target/test/impl/ImplTest.spec.js.map +1 -1
  158. package/target/test/impl/ImplTest_23.spec.js +2 -2
  159. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  160. package/target/test/myfaces/OnLoadSpec.js +57 -0
  161. package/target/test/myfaces/OnLoadSpec.js.map +1 -0
  162. package/target/test/xhrCore/EventTests.spec.js +1 -1
  163. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  164. package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
  165. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  166. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  167. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  168. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  169. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  170. package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
  171. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  172. package/target/test/xhrCore/RequestTest.spec.js +217 -9
  173. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  174. package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
  175. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  176. package/target/test/xhrCore/ResponseTest.spec.js +308 -24
  177. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  178. package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
  179. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  180. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
  181. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
  182. package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
  183. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  184. package/target/test-classes/.gz +0 -0
  185. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  186. package/target/test-classes/fileuploadtest.html +24 -0
  187. package/target/test-classes/jsf-development.js +3559 -0
  188. package/target/test-classes/jsf-development.js.br +0 -0
  189. package/target/test-classes/jsf-development.js.gz +0 -0
  190. package/target/test-classes/jsf-development.js.map +1 -0
  191. package/target/test-classes/jsf.js +3 -0
  192. package/target/test-classes/jsf.js.br +0 -0
  193. package/target/test-classes/jsf.js.gz +0 -0
  194. package/tmp.xml +36 -0
  195. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  196. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  197. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  198. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  199. package/target/types/index.js +0 -18
  200. package/target/types/index.js.map +0 -1
@@ -62,18 +62,23 @@ export module oam {
62
62
  DQ.byId(element).delete();
63
63
  };
64
64
 
65
- // noinspection JSUnusedGlobalSymbols
65
+ // noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
66
66
  /**
67
67
  * does special form submit remapping
68
68
  * re-maps the issuing command link into something,
69
- * a decode of the command link on the server can understand
69
+ * the "decode" of the command link on the server can understand
70
70
  *
71
71
  * @param formName
72
72
  * @param linkId
73
73
  * @param target
74
74
  * @param params
75
75
  */
76
- export const submitForm = function (formName: string, linkId: string, target: string, params: { [key: string]: any }): boolean {
76
+ export const submitForm = function (formName: string, linkId: string | null = null, target: string |null = null, params: AssocArr<any> | Tuples<string, any> | null = {} ): boolean {
77
+
78
+
79
+ //handle a possible incoming null, not sure if this is used that way anywhere, but we allow it
80
+ params = (!params) ? {} : params;
81
+
77
82
  let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\$:').replace(/:/g, '_');
78
83
  window?.[clearFn]?.(formName);
79
84
 
@@ -81,18 +86,23 @@ export module oam {
81
86
  if (window?.myfaces?.core?.config?.autoScroll && (window as any)?.getScrolling) {
82
87
  myfaces.oam.setHiddenInput(formName, 'autoScroll', (window as any)?.getScrolling());
83
88
  }
84
- Stream.ofAssoc(params).each((param: [string, any]) => {
85
- myfaces.oam.setHiddenInput(formName, param[0], param[1]);
86
- });
89
+ let paramsStream: Stream<[string, any]> = Array.isArray(params) ? Stream.of(...params) : Stream.ofAssoc(params);
90
+ paramsStream.each(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
87
91
 
88
92
  //we call the namespaced function, to allow decoration, via a direct call we would
89
- myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId);
93
+ myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');
94
+
90
95
 
91
- DQ.byId(document.forms[formName]).each(form => {
96
+ DQ.byId(document.forms?.[formName] ?? document.getElementById(formName)).each(form => {
92
97
  const ATTR_TARGET = "target";
93
98
  const formElement = form.getAsElem(0).value as HTMLFormElement;
94
- const oldTarget = form.attr(ATTR_TARGET).value;
95
- form.attr(ATTR_TARGET).value = target;
99
+ const oldTarget = (form.getAsElem(0).value as HTMLFormElement).getAttribute("target");
100
+
101
+ if(target != "null" && target) {
102
+ (form.getAsElem(0).value as HTMLFormElement).setAttribute("target", target);
103
+ }
104
+
105
+
96
106
 
97
107
  const result = formElement?.onsubmit?.(null);
98
108
 
@@ -103,9 +113,15 @@ export module oam {
103
113
  } catch (e) {
104
114
  window?.console.error(e);
105
115
  } finally {
106
- form.attr(ATTR_TARGET).value = oldTarget;
107
- Stream.ofAssoc(params).each((param: [string, any]) => {
108
- myfaces.oam.clearHiddenInput(formName, param[0]);
116
+ if(oldTarget == null || oldTarget == "null") {
117
+ (form.getAsElem(0).value as HTMLFormElement).removeAttribute("target");
118
+ } else {
119
+ (form.getAsElem(0).value as HTMLFormElement).setAttribute("target", oldTarget);
120
+ }
121
+
122
+ // noinspection JSUnusedLocalSymbols
123
+ paramsStream.each(([key, data]) => {
124
+ myfaces.oam.clearHiddenInput(formName, key);
109
125
  });
110
126
  myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
111
127
  }
@@ -18,7 +18,6 @@ import {expect} from 'chai';
18
18
  import {describe, it} from 'mocha';
19
19
  import {ArrayCollector, DomQuery, DomQueryCollector, Lang, LazyStream} from "mona-dish";
20
20
  import trim = Lang.trim;
21
- import {ExtDomquery} from "../../../../impl/util/ExtDomQuery";
22
21
  import {from} from "rxjs";
23
22
 
24
23
 
@@ -30,6 +29,7 @@ describe('DOMQuery tests', function () {
30
29
 
31
30
  beforeEach(function () {
32
31
 
32
+ // language=HTML
33
33
  dom = new JSDOM(`
34
34
  <!DOCTYPE html>
35
35
  <html lang="en">
@@ -93,7 +93,7 @@ describe('DOMQuery tests', function () {
93
93
  let isDQuery = false;
94
94
  let cnt2 = 0;
95
95
 
96
- o1.subscribe((item: any) => {
96
+ o1.subscribe(() => {
97
97
  cnt1++;
98
98
  });
99
99
 
@@ -119,7 +119,7 @@ describe('DOMQuery tests', function () {
119
119
  let isDQuery = false;
120
120
  let cnt2 = 0;
121
121
 
122
- o1.subscribe((item: any) => {
122
+ o1.subscribe(() => {
123
123
  cnt1++;
124
124
  });
125
125
 
@@ -183,7 +183,7 @@ describe('DOMQuery tests', function () {
183
183
  it('domquery ops test2 eachNode', function () {
184
184
  let probe2 = DomQuery.querySelectorAll("div");
185
185
  let noIter = 0;
186
- probe2 = probe2.each((item, cnt) => {
186
+ probe2.each((item, cnt) => {
187
187
  expect(item instanceof DomQuery).to.be.true;
188
188
  expect(noIter == cnt).to.be.true;
189
189
  noIter++;
@@ -319,7 +319,7 @@ describe('DOMQuery tests', function () {
319
319
 
320
320
  it('it must have parents', function () {
321
321
  let probe1 = new DomQuery(document).querySelectorAll("div");
322
- let coll: Array<any> = probe1.parents("body").stream.collect(new ArrayCollector());
322
+ let coll: Array<any> = probe1.firstParent("body").stream.collect(new ArrayCollector());
323
323
  expect(coll.length == 1).to.be.true;
324
324
 
325
325
  });
@@ -345,19 +345,19 @@ describe('DOMQuery tests', function () {
345
345
  it("must have a working input handling", function () {
346
346
  DomQuery.querySelectorAll("body").innerHTML = `<form id="blarg">
347
347
  <div id="embed1">
348
- <input type="text" id="id_1" name="id_1" value="id_1_val"></input>
349
- <input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled"> </input>
350
- <textarea type="text" id="id_3" name="id_3">textareaVal</textarea>
348
+ <input type="text" id="id_1" name="id_1" value="id_1_val">
349
+ <input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled">
350
+ <textarea id="id_3" name="id_3">textareaVal</textarea>
351
351
 
352
352
  <fieldset>
353
- <input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked"></input>
353
+ <input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked">
354
354
  <label for="mc"> Mastercard</label>
355
- <input type="radio" id="vi" name="cc_1" value="Visa"></input>
355
+ <input type="radio" id="vi" name="cc_1" value="Visa">
356
356
  <label for="vi"> Visa</label>
357
- <input type="radio" id="ae" name="cc_1" value="AmericanExpress"></input>
357
+ <input type="radio" id="ae" name="cc_1" value="AmericanExpress">
358
358
  <label for="ae"> American Express</label>
359
359
  </fieldset>
360
- <select id="val_5" name="val_5" name="top5" size="5">
360
+ <select id="val_5" name="val_5" size="5">
361
361
  <option>barg</option>
362
362
  <option>jjj</option>
363
363
  <option selected>akaka</option>
@@ -376,7 +376,7 @@ describe('DOMQuery tests', function () {
376
376
  expect(length2 == 8).to.be.true;
377
377
 
378
378
  let count = DomQuery.byId("embed1").elements
379
- .stream.map<number>(item => item.disabled ? 1 : 0)
379
+ .stream.map(item => item.disabled ? 1 : 0)
380
380
  .reduce((val1, val2) => val1 + val2, 0);
381
381
  expect(count.value).to.eq(1);
382
382
 
@@ -385,12 +385,12 @@ describe('DOMQuery tests', function () {
385
385
  .each(item => item.disabled = false);
386
386
 
387
387
  count = DomQuery.byId("embed1").elements
388
- .stream.map<number>(item => item.disabled ? 1 : 0)
388
+ .stream.map(item => item.disabled ? 1 : 0)
389
389
  .reduce((val1, val2) => val1 + val2, 0);
390
390
  expect(count.value).to.eq(0);
391
391
 
392
392
  count = DomQuery.byId("embed1").elements
393
- .stream.map<number>(item => item.attr("checked").isPresent() ? 1 : 0)
393
+ .stream.map(item => item.attr("checked").isPresent() ? 1 : 0)
394
394
  .reduce((val1, val2) => val1 + val2, 0);
395
395
  expect(count.value).to.eq(1);
396
396
 
@@ -451,7 +451,7 @@ describe('DOMQuery tests', function () {
451
451
  //-->
452
452
  </script>
453
453
 
454
- <style type="text/css">
454
+ <style>
455
455
  #first {
456
456
  border: 1px solid black;
457
457
  }
@@ -482,7 +482,7 @@ describe('DOMQuery tests', function () {
482
482
 
483
483
  it("it must handle events properly", function () {
484
484
  let clicked = 0;
485
- let listener = (evt: any) => {
485
+ let listener = () => {
486
486
  clicked++;
487
487
  };
488
488
  let eventReceiver = DomQuery.byId("id_1");
@@ -629,14 +629,11 @@ describe('DOMQuery tests', function () {
629
629
 
630
630
  it('must by recycleable', function () {
631
631
  let probe = DomQuery.querySelectorAll("div");
632
- let probe2 = DomQuery.querySelectorAll("body");
633
632
 
634
633
  let res1 = probe.filter(item => item.matchesSelector("div"));
635
634
  expect(res1.length).to.eq(4);
636
635
  let res2 = probe.filter(item => item.matchesSelector("div"));
637
636
  expect(res2.length).to.eq(4);
638
-
639
-
640
637
  })
641
638
 
642
639
  it('delete must work', function () {
@@ -654,8 +651,8 @@ describe('DOMQuery tests', function () {
654
651
  let probe2 = DomQuery.querySelectorAll("div");
655
652
  let probeCnt = 0;
656
653
  let probe2Cnt = 0;
657
- from(probe).subscribe(el => probeCnt++);
658
- from(probe2.stream).subscribe(el => probe2Cnt++);
654
+ from(probe).subscribe(() => probeCnt++);
655
+ from(probe2.stream).subscribe(() => probe2Cnt++);
659
656
  expect(probeCnt).to.be.above(0);
660
657
  expect(probeCnt).to.eq(probe2Cnt);
661
658
  })
@@ -91,6 +91,102 @@ export module StandardInits {
91
91
 
92
92
 
93
93
 
94
+ /**
95
+ * a page simulating basically a simple faces form
96
+ */
97
+ const HTML_FORM_PREFIXED = `<!DOCTYPE html>
98
+ <html lang="en">
99
+ <head>
100
+ <meta charset="UTF-8">
101
+ <title>Title</title>
102
+ </head>
103
+ <body>
104
+ <form id="form1">
105
+ <input type="text" id="form1:input_1::field" name="form1:input_1" value="form1:input_1_val"></input>
106
+ <input type="hidden" id="form1:jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
107
+ <input type="button" id="form1:input_2::field" name="form1:input_2" value="form1:input_1_val"></input>
108
+ <input type="text" id="form1:input_3::field" name="form1:input_23 value="form1:input_1_val"></input>
109
+ </form>
110
+ </body>
111
+ </html>`;
112
+
113
+
114
+ /**
115
+ * a page based on Tobago for a file upload
116
+ */
117
+ const HTML_TOBAGO_FILE_FORM = `<!DOCTYPE html>
118
+ <html lang='de'>
119
+ <head>
120
+ <meta charset='UTF-8'>
121
+ <meta name='viewport' content='width=device-width, initial-scale=1.0'>
122
+ <title>Test</title>
123
+ </head>
124
+ <body>
125
+ <tobago-page locale='de' class='container-fluid' id='page' focus-on-error='true' wait-overlay-delay-full='1000' wait-overlay-delay-ajax='1000'>
126
+ <form action='/content/100-upload/File_Upload.xhtml' id='page::form' method='post' enctype='multipart/form-data' accept-charset='UTF-8' data-tobago-context-path=''>
127
+ <input type='hidden' name='javax.faces.source' id='javax.faces.source' disabled='disabled'>
128
+ <tobago-focus id='page::lastFocusId'>
129
+ <input type='hidden' name='page::lastFocusId' id='page::lastFocusId::field'>
130
+ </tobago-focus>
131
+ <input type='hidden' name='org.apache.myfaces.tobago.webapp.Secret' id='org.apache.myfaces.tobago.webapp.Secret' value='secretValue'>
132
+ <tobago-file id='page:fileAjax' class='tobago-auto-spacing'>
133
+ <div class='input-group'>
134
+ <input type='file' tabindex='-1' id='page:fileAjax::field' class='form-control' name='page:fileAjax'>
135
+ <tobago-behavior event='change' client-id='page:fileAjax' field-id='page:fileAjax::field' execute='page:fileAjax'></tobago-behavior>
136
+ <label class='input-group-text' for='page:fileAjax::field'><span><i class='bi-folder2-open'></i></span></label>
137
+ </div>
138
+ </tobago-file>
139
+ <div class='tobago-page-menuStore'>
140
+ </div>
141
+ <span id='page::jsf-state-container'><input type='hidden' name='javax.faces.ViewState' id='j_id__v_0:javax.faces.ViewState:1' value='viewStateValue' autocomplete='off'><input type='hidden' name='javax.faces.RenderKitId' value='tobago'><input type='hidden' id='j_id__v_0:javax.faces.ClientWindow:1' name='javax.faces.ClientWindow' value='clientWindowValue'></span>
142
+ </form>
143
+ </tobago-page>
144
+ </body>
145
+ </html>`;
146
+
147
+ /**
148
+ * a page simulating basically a simple faces form
149
+ */
150
+ export const HTML_PREFIX_EMBEDDED_BODY = `<form id="form1">
151
+ <tobago-in id="page:input" class="tobago-auto-spacing">
152
+ <input type="text" name="page:input" id="page:input::field" class="form-control" value="input_value">
153
+ <tobago-behavior event="change" client-id="page:input" field-id="page:input::field" execute="page:input" render="page:output"></tobago-behavior>
154
+ </tobago-in>
155
+
156
+ <tobago-out id="page:output" class="tobago-auto-spacing">
157
+ <input type="text" name="page:output" id="page:output::field" class="form-control">
158
+ </tobago-out>
159
+ </form>`;
160
+
161
+ const HTML_FORM_PREFIXED_EMBEDDED = `<!DOCTYPE html>
162
+ <html lang="en">
163
+ <head>
164
+ <meta charset="UTF-8">
165
+ <title>Title</title>
166
+ </head>
167
+ <body>
168
+ ${HTML_PREFIX_EMBEDDED_BODY}
169
+ </body>
170
+ </html>`;
171
+
172
+
173
+ const HTML_FORM_NAMESPACED = `<!DOCTYPE html>
174
+ <html lang="en">
175
+ <head>
176
+ <meta charset="UTF-8">
177
+ <title>Title</title>
178
+ </head>
179
+ <body>
180
+ <form id="jd_0:blarg">
181
+ <input type="text" id="jd_0:input_1" name="jd_0:input_1" value="input_1_val"></input>
182
+ <input type="hidden" id="jd_0:jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
183
+ <input type="button" id="jd_0:input_2" name="input_2" value="input_1_val"></input>
184
+ </form>
185
+ </body>
186
+ </html>`;
187
+
188
+
189
+
94
190
  /**
95
191
  * a page simulating basically a simple faces form
96
192
  */
@@ -102,7 +198,7 @@ export module StandardInits {
102
198
  </head>
103
199
  <body>
104
200
  <form id="blarg" enctype="multipart/form-data">
105
- <input type="file" id="fíleupload"></input>
201
+ <input type="file" id="fíleupload" name="fíleupload"></input>
106
202
  <input type="text" id="input_1" name="input_1" value="input_1_val"></input>
107
203
  <input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
108
204
  <input type="button" id="input_2" name="input_2" value="input_1_val"></input>
@@ -277,12 +373,18 @@ export module StandardInits {
277
373
  export function defaultMyFaces(withJsf = true): Promise<() => void> {
278
374
  return init(HTML_FORM_DEFAULT, withJsf);
279
375
  }
376
+ export function defaultMyFacesNamespaces(withJsf = true): Promise<() => void> {
377
+ return init(HTML_FORM_NAMESPACED, withJsf);
378
+ }
280
379
  export function defaultMyFaces23(withJsf = true): Promise<() => void> {
281
380
  return init(HTML_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
282
381
  }
283
382
  export function defaultFileForm(withJsf = true): Promise<() => void> {
284
383
  return init(HTML_FILE_FORM_DEFAULT, withJsf);
285
384
  }
385
+ export function tobagoFileForm(withJsf = true): Promise<() => void> {
386
+ return init(HTML_TOBAGO_FILE_FORM, withJsf);
387
+ }
286
388
  export function defaultFileForm_23(withJsf = true): Promise<() => void> {
287
389
  return init(HTML_FILE_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
288
390
  }
@@ -302,6 +404,11 @@ export module StandardInits {
302
404
  return <any>init((IS_40) ? PROTOCOL_PAGE : PROTOCOL_PAGE.replace(/jakarta/gi,"javax"), withJsf, IS_40);
303
405
  }
304
406
 
407
+ export function prefixEmbeddedPage(withJsf = true, IS_40 = true): Promise<() => void> {
408
+ return <any>init((IS_40) ? HTML_FORM_PREFIXED_EMBEDDED : HTML_FORM_PREFIXED_EMBEDDED.replace(/jakarta/gi,"javax"), withJsf, IS_40);
409
+ }
410
+
411
+
305
412
  export function defaultSeparatorChar(separatorChar: string, withJsf = true, IS_40 = true): Promise<() => void> {
306
413
  let template = HTML_DEFAULT_SEPARATOR_CHAR(separatorChar, IS_40);
307
414
  return init(template, withJsf);
@@ -194,7 +194,7 @@ export class XmlResponses {
194
194
  <partial-response id="j_id__v_0"><changes><update id="jakarta.faces.Resource">
195
195
  <![CDATA[
196
196
  <script src="../../../xhrCore/fixtures/addedViewHead3.js"></script>
197
- <style type="text/css" rel="../../../xhrCore/fixtures/addedViewHead2.css"></style>
197
+ <link rel="stylesheet" href="../../../xhrCore/fixtures/addedViewHead2.css"></link>
198
198
  <script type="text/javascript">
199
199
  document.getElementById('resource_area_1').innerHTML = 'booga';
200
200
  </script>
@@ -204,6 +204,45 @@ export class XmlResponses {
204
204
  </partial-response>
205
205
  `
206
206
 
207
+ static HEAD_REPLACE = `
208
+ <partial-response id="j_id__v_0"><changes><update id="jakarta.faces.ViewHead">
209
+ <![CDATA[
210
+ <head>
211
+ <script type="text/javascript" src="../../../xhrCore/fixtures/addedViewHead3.js"></script>
212
+ <link rel="stylesheet" href="../../../xhrCore/fixtures/addedViewHead2.css"></link>
213
+ <script type="text/javascript">
214
+ setTimeout(() => document.getElementById('resource_area_1').innerHTML = 'booga', 100);
215
+ </script>
216
+ </head>
217
+ ]]>
218
+ </update>
219
+ </changes>
220
+ </partial-response>
221
+ `
222
+
223
+ static HEAD_REPLACE2 = `
224
+ <partial-response id="j_id__v_0"><changes><update id="jakarta.faces.ViewHead">
225
+ <![CDATA[
226
+ <head>
227
+ <title>After Update</title>
228
+ <meta charset="UTF-8">
229
+ <meta name="description" content="Free Web tutorials">
230
+ <meta name="keywords" content="HTML, CSS, JavaScript, JSF">
231
+ <meta name="viewport" content="width=device-width, initial-scale=0.8">
232
+ <meta name="author" content="Whoever">
233
+ <script type="text/javascript" src="../../../xhrCore/fixtures/addedViewHead3.js"></script>
234
+ <link rel="stylesheet" href="../../../xhrCore/fixtures/addedViewHead2.css"></link>
235
+ <script type="text/javascript">
236
+ setTimeout(() => document.getElementById('resource_area_1').innerHTML = 'booga', 100);
237
+ </script>
238
+ </head>
239
+ ]]>
240
+ </update>
241
+ </changes>
242
+ </partial-response>
243
+ `
244
+
245
+
207
246
  static NONCE_REPLY = `
208
247
  <partial-response><changes><update id='nonce_result'>
209
248
  <![CDATA[<script nonce='test12d3' type='text/javascript' src='http://foobaz/nonce_script.js'></script>]]>
@@ -20,7 +20,7 @@ import {expect} from 'chai';
20
20
  import * as sinon from 'sinon';
21
21
 
22
22
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
23
- import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
23
+ import {CTX_PARAM_REQ_PASS_THR, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
24
24
  import defaultMyFaces = StandardInits.defaultMyFaces;
25
25
 
26
26
 
@@ -60,9 +60,9 @@ describe('faces.ajax.request test suite', () => {
60
60
  expect(addRequestToQueue.callCount).to.eq(1);
61
61
  const context = (<Config>addRequestToQueue.args[0][2]);
62
62
 
63
- expect(context.getIf("passThrgh", P_RENDER).value).eq("@all");
63
+ expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_RENDER).value).eq("@all");
64
64
  //Execute issuing form due to @form and always the issuing element
65
- expect(context.getIf("passThrgh", P_EXECUTE).value).eq("blarg input_2");
65
+ expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value).eq("blarg input_2");
66
66
  } finally {
67
67
  //once done we restore the proper state
68
68
  addRequestToQueue.restore();
@@ -20,7 +20,7 @@ import {expect} from 'chai';
20
20
  import * as sinon from 'sinon';
21
21
 
22
22
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
23
- import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
23
+ import {CTX_PARAM_REQ_PASS_THR, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
24
24
  import defaultMyFaces23 = StandardInits.defaultMyFaces23;
25
25
 
26
26
 
@@ -60,9 +60,9 @@ describe('javax.ajax.request test suite', () => {
60
60
  expect(addRequestToQueue.callCount).to.eq(1);
61
61
  const context = (<Config>addRequestToQueue.args[0][2]);
62
62
 
63
- expect(context.getIf("passThrgh", P_RENDER).value).eq("@all");
63
+ expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_RENDER).value).eq("@all");
64
64
  //Execute issuing form due to @form and always the issuing element
65
- expect(context.getIf("passThrgh", P_EXECUTE).value).eq("blarg input_2");
65
+ expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value).eq("blarg input_2");
66
66
  } finally {
67
67
  //once done we restore the proper state
68
68
  addRequestToQueue.restore();
@@ -120,10 +120,6 @@ describe('javax.ajax.request test suite', () => {
120
120
  expect(!!called["func5"]).to.be.false;
121
121
 
122
122
  });
123
-
124
-
125
-
126
-
127
123
  });
128
124
 
129
125
 
@@ -108,7 +108,7 @@ describe('tests the addOnEvent and addOnError handling', function () {
108
108
  expect(onErrorCalled1).to.eq(1);
109
109
  expect(onErrorCalled2).to.eq(1);
110
110
  expect(errorTitle).to.eq('Erro21');
111
- expect(errorMessage).to.eq('Error2 Text');
111
+ expect(errorMessage).to.eq('serverError: Error2 Text');
112
112
  });
113
113
 
114
114
  it("must have an id set if there is an emitting element", function () {
@@ -17,7 +17,7 @@ import {describe, it} from "mocha";
17
17
  import * as sinon from "sinon";
18
18
  import {expect} from "chai";
19
19
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
20
- import {DomQuery} from "mona-dish";
20
+ import {DomQuery, DQ} from "mona-dish";
21
21
  import defaultFileForm = StandardInits.defaultFileForm;
22
22
  import {Implementation} from "../../impl/AjaxImpl";
23
23
 
@@ -66,6 +66,8 @@ describe('Tests on the xhr core when it starts to call the request', function ()
66
66
  const CONTENT_TYPE = "Content-Type";
67
67
  const POST = "POST";
68
68
 
69
+ global["debug_f"] = true;
70
+
69
71
  try {
70
72
 
71
73
  let button = DomQuery.byId("input_1");
@@ -128,11 +130,12 @@ describe('Tests on the xhr core when it starts to call the request', function ()
128
130
  const MULTIPART_FORM = "multipart/form-data";
129
131
  const POST = "POST";
130
132
 
133
+
131
134
  try {
132
135
  let button = DomQuery.byId("input_1");
133
136
 
134
137
  button.addEventListener("click", (event: Event) => {
135
- faces.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fileupload'});
138
+ faces.ajax.request(event.target, event, {render: '@all', execute: '@none'});
136
139
  }).click();
137
140
 
138
141
  expect(this.requests.length).to.eq(1);