jsf.js_next_gen 4.0.1-beta.1 → 4.0.1-beta.3

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 (103) hide show
  1. package/README.md +6 -0
  2. package/dist/docs/assets/search.js +1 -1
  3. package/dist/docs/functions/myfaces.ab.html +1 -1
  4. package/dist/docs/functions/{myfaces.onOnDomReady.html → myfaces.onDomReady.html} +5 -5
  5. package/dist/docs/index.html +9 -0
  6. package/dist/docs/modules/myfaces.html +2 -2
  7. package/dist/docs/variables/myfaces.oam.html +1 -1
  8. package/dist/window/faces-development.js +1285 -1295
  9. package/dist/window/faces-development.js.br +0 -0
  10. package/dist/window/faces-development.js.gz +0 -0
  11. package/dist/window/faces-development.js.map +1 -1
  12. package/dist/window/faces.js +1 -1
  13. package/dist/window/faces.js.br +0 -0
  14. package/dist/window/faces.js.gz +0 -0
  15. package/dist/window/faces.js.map +1 -1
  16. package/dist/window/jsf-development.js +1285 -1295
  17. package/dist/window/jsf-development.js.br +0 -0
  18. package/dist/window/jsf-development.js.gz +0 -0
  19. package/dist/window/jsf-development.js.map +1 -1
  20. package/dist/window/jsf.js +1 -1
  21. package/dist/window/jsf.js.br +0 -0
  22. package/dist/window/jsf.js.gz +0 -0
  23. package/dist/window/jsf.js.map +1 -1
  24. package/package.json +5 -5
  25. package/plans for 4.0.1.txt +8 -0
  26. package/src/main/typescript/api/_api.ts +1 -1
  27. package/src/main/typescript/impl/AjaxImpl.ts +60 -44
  28. package/src/main/typescript/impl/core/Const.ts +5 -2
  29. package/src/main/typescript/impl/util/AsyncRunnable.ts +81 -6
  30. package/src/main/typescript/impl/util/ExtDomQuery.ts +7 -9
  31. package/src/main/typescript/impl/util/FileUtils.ts +26 -22
  32. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +7 -3
  33. package/src/main/typescript/impl/util/Lang.ts +61 -4
  34. package/src/main/typescript/impl/util/XhrQueueController.ts +112 -0
  35. package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
  36. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +12 -10
  37. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +32 -19
  38. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +51 -72
  39. package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
  40. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +179 -40
  41. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
  42. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
  43. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
  44. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
  45. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +3 -2
  46. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
  47. package/src/main/typescript/test/myfaces/OnLoadSpec.ts +52 -0
  48. package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
  49. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +4 -3
  50. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +28 -22
  51. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +4 -4
  52. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
  53. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +80 -6
  54. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +6 -1
  55. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +23 -22
  56. package/target/api/_api.js +2 -2
  57. package/target/api/_api.js.map +1 -1
  58. package/target/impl/AjaxImpl.js +48 -38
  59. package/target/impl/AjaxImpl.js.map +1 -1
  60. package/target/impl/core/Const.js +7 -5
  61. package/target/impl/core/Const.js.map +1 -1
  62. package/target/impl/util/AsyncRunnable.js +60 -0
  63. package/target/impl/util/AsyncRunnable.js.map +1 -1
  64. package/target/impl/util/ExtDomQuery.js +8 -8
  65. package/target/impl/util/ExtDomQuery.js.map +1 -1
  66. package/target/impl/util/FileUtils.js +21 -20
  67. package/target/impl/util/FileUtils.js.map +1 -1
  68. package/target/impl/util/HiddenInputBuilder.js +7 -3
  69. package/target/impl/util/HiddenInputBuilder.js.map +1 -1
  70. package/target/impl/util/Lang.js +52 -1
  71. package/target/impl/util/Lang.js.map +1 -1
  72. package/target/impl/xhrCore/EventData.js +2 -2
  73. package/target/impl/xhrCore/EventData.js.map +1 -1
  74. package/target/impl/xhrCore/ResponseProcessor.js +9 -7
  75. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  76. package/target/impl/xhrCore/XhrFormData.js +29 -15
  77. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  78. package/target/impl/xhrCore/XhrRequest.js +43 -64
  79. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  80. package/target/myfaces/OamSubmit.js +5 -3
  81. package/target/myfaces/OamSubmit.js.map +1 -1
  82. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +138 -37
  83. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  84. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
  85. package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
  86. package/target/test/frameworkBase/_ext/shared/StandardInits.js +3 -2
  87. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  88. package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
  89. package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
  90. package/target/test/xhrCore/EventTests.spec.js +26 -19
  91. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  92. package/target/test/xhrCore/NamespacesRequestTest.spec.js +3 -3
  93. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
  94. package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
  95. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  96. package/target/test/xhrCore/RequestTest.spec.js +73 -4
  97. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  98. package/target/test/xhrCore/RequestTest_23.spec.js +6 -0
  99. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  100. package/target/test/xhrCore/ResponseTest.spec.js +22 -15
  101. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  102. package/src/main/typescript/impl/util/AsyncQueue.ts +0 -133
  103. package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +0 -231
@@ -0,0 +1,108 @@
1
+ export const tobagoSheetWithoutHeader = `<tobago-sheet id="page:mainForm:s1" data-tobago-selection-mode="multi" data-tobago-first="0" rows="0" row-count="88" data-tobago-layout="{&quot;columns&quot;:[1.0]}">
2
+ <style nonce="" id="page:mainForm:s1:j_id_2n">#page\\:mainForm\\:s1{max-height:486px;}
3
+ </style>
4
+ <input id="page:mainForm:s1::widths" name="page:mainForm:s1::widths" type="hidden" value="[]">
5
+ <input id="page:mainForm:s1::rendered" name="page:mainForm:s1::rendered" type="hidden" value="[true]">
6
+ <input id="page:mainForm:s1::scrollPosition" name="page:mainForm:s1::scrollPosition" type="hidden" value="[0,0]">
7
+ <input id="page:mainForm:s1::selected" name="page:mainForm:s1::selected" type="hidden" value="[]">
8
+ <div class="tobago-body">
9
+ <table cellspacing="0" cellpadding="0" summary="" class="table table-sm tobago-tableLayout-fixed">
10
+ <colgroup>
11
+ <col>
12
+ <col>
13
+ </colgroup>
14
+ <tbody>
15
+ <tr row-index="0" id="page:mainForm:s1:0:sample0">
16
+ <td>
17
+ <tobago-out id="page:mainForm:s1:0:t_name"><span class="form-control-plaintext">Sun</span></tobago-out>
18
+ </td>
19
+ <td>
20
+ <div>
21
+ </div>
22
+ <tobago-behavior event="click" client-id="page:mainForm:s1:0:sample0" execute="page:mainForm:s1:0:sample0"></tobago-behavior>
23
+ </td>
24
+ </tr>
25
+ <tr row-index="1" id="page:mainForm:s1:1:sample0">
26
+ <td>
27
+ <tobago-out id="page:mainForm:s1:1:t_name"><span class="form-control-plaintext">Mercury</span></tobago-out>
28
+ </td>
29
+ <td>
30
+ <div>
31
+ </div>
32
+ <tobago-behavior event="click" client-id="page:mainForm:s1:1:sample0" execute="page:mainForm:s1:1:sample0"></tobago-behavior>
33
+ </td>
34
+ </tr>
35
+ <tr row-index="2" id="page:mainForm:s1:2:sample0">
36
+ <td>
37
+ <tobago-out id="page:mainForm:s1:2:t_name"><span class="form-control-plaintext">Venus</span></tobago-out>
38
+ </td>
39
+ <td>
40
+ <div>
41
+ </div>
42
+ <tobago-behavior event="click" client-id="page:mainForm:s1:2:sample0" execute="page:mainForm:s1:2:sample0"></tobago-behavior>
43
+ </td>
44
+ </tr>
45
+ <tr row-index="3" id="page:mainForm:s1:3:sample0">
46
+ <td>
47
+ <tobago-out id="page:mainForm:s1:3:t_name"><span class="form-control-plaintext">Earth</span></tobago-out>
48
+ </td>
49
+ <td>
50
+ <div>
51
+ </div>
52
+ <tobago-behavior event="click" client-id="page:mainForm:s1:3:sample0" execute="page:mainForm:s1:3:sample0"></tobago-behavior>
53
+ </td>
54
+ </tr>
55
+ <tr row-index="4" id="page:mainForm:s1:4:sample0">
56
+ <td>
57
+ <tobago-out id="page:mainForm:s1:4:t_name"><span class="form-control-plaintext">Mars</span></tobago-out>
58
+ </td>
59
+ <td>
60
+ <div>
61
+ </div>
62
+ <tobago-behavior event="click" client-id="page:mainForm:s1:4:sample0" execute="page:mainForm:s1:4:sample0"></tobago-behavior>
63
+ </td>
64
+ </tr>
65
+ <tr row-index="5" id="page:mainForm:s1:5:sample0">
66
+ <td>
67
+ <tobago-out id="page:mainForm:s1:5:t_name"><span class="form-control-plaintext">Jupiter</span></tobago-out>
68
+ </td>
69
+ <td>
70
+ <div>
71
+ </div>
72
+ <tobago-behavior event="click" client-id="page:mainForm:s1:5:sample0" execute="page:mainForm:s1:5:sample0"></tobago-behavior>
73
+ </td>
74
+ </tr>
75
+ <tr row-index="6" id="page:mainForm:s1:6:sample0">
76
+ <td>
77
+ <tobago-out id="page:mainForm:s1:6:t_name"><span class="form-control-plaintext">Saturn</span></tobago-out>
78
+ </td>
79
+ <td>
80
+ <div>
81
+ </div>
82
+ <tobago-behavior event="click" client-id="page:mainForm:s1:6:sample0" execute="page:mainForm:s1:6:sample0"></tobago-behavior>
83
+ </td>
84
+ </tr>
85
+ <tr row-index="7" id="page:mainForm:s1:7:sample0">
86
+ <td>
87
+ <tobago-out id="page:mainForm:s1:7:t_name"><span class="form-control-plaintext">Uranus</span></tobago-out>
88
+ </td>
89
+ <td>
90
+ <div>
91
+ </div>
92
+ <tobago-behavior event="click" client-id="page:mainForm:s1:7:sample0" execute="page:mainForm:s1:7:sample0"></tobago-behavior>
93
+ </td>
94
+ </tr>
95
+ <tr row-index="8" id="page:mainForm:s1:8:sample0">
96
+ <td>
97
+ <tobago-out id="page:mainForm:s1:8:t_name"><span class="form-control-plaintext">Neptune</span></tobago-out>
98
+ </td>
99
+ <td>
100
+ <div>
101
+ </div>
102
+ <tobago-behavior event="click" client-id="page:mainForm:s1:8:sample0" execute="page:mainForm:s1:8:sample0"></tobago-behavior>
103
+ </td>
104
+ </tr>
105
+ </tbody>
106
+ </table>
107
+ </div>
108
+ </tobago-sheet>`;
@@ -83,6 +83,7 @@ export module StandardInits {
83
83
  <body>
84
84
  <form id="blarg">
85
85
  <input type="text" id="input_1" name="input_1" value="input_1_val"></input>
86
+ <input type="text" id="input_2_text" name="input_2_text" value="input_2_text_val"></input>
86
87
  <input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
87
88
  <input type="button" id="input_2" name="input_2" value="input_1_val"></input>
88
89
  </form>
@@ -222,7 +223,7 @@ export module StandardInits {
222
223
  <meta charset="UTF-8">
223
224
  <title>Title</title>
224
225
  <script type="text/javascript"
225
- src="/wfmportal/${IS_40 ? 'jakarta' : 'javax'}.faces.resource/${IS_40 ? 'faces': 'jsf'}.js.jsf?ln=jakarta.faces&separator=${separatorChar}"></script>
226
+ src="./fixtures/${IS_40 ? 'jakarta' : 'javax'}.faces.resource/${IS_40 ? 'faces': 'jsf'}.js.jsf?ln=jakarta.faces&separator=${separatorChar}"></script>
226
227
  </head>
227
228
  <body>
228
229
  <form id="blarg">
@@ -513,7 +514,7 @@ export module StandardInits {
513
514
  //let dom2 = new JSDOM(template)
514
515
  //return initMyFacesFromDom(dom2);
515
516
  let clean = null;
516
- //we use jsdom global to fullfill our requirements
517
+ //we use jsdom global to fulfill our requirements
517
518
  //we need to import dynamically and use awaits
518
519
  if (withJsf) {
519
520
 
@@ -0,0 +1,52 @@
1
+ /*! Licensed to the Apache Software Foundation (ASF) under one or more
2
+ * contributor license agreements. See the NOTICE file distributed with
3
+ * this work for additional information regarding copyright ownership.
4
+ * The ASF licenses this file to you under the Apache License, Version 2.0
5
+ * (the "License"); you may not use this file except in compliance with
6
+ * the License. You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import {describe, it} from "mocha";
18
+
19
+ import {expect} from "chai";
20
+ import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
21
+ import defaultMyFaces = StandardInits.defaultMyFaces;
22
+
23
+
24
+
25
+ declare var myfaces: any;
26
+
27
+ /**
28
+ * Adds test s for the newly introduced onload handling
29
+ */
30
+ describe('Tests on the xhr core when it starts to call the request', function () {
31
+
32
+ beforeEach(async () => {
33
+ return
34
+ });
35
+
36
+ it("must be present", async function(done) {
37
+ await defaultMyFaces();
38
+ expect(myfaces?.onDomReady).to.exist;
39
+ done();
40
+ });
41
+
42
+ it("must be called on onDocumentReady", async function(done) {
43
+ let called: boolean = false;
44
+ const onDomCalled = () => {
45
+ expect(true).to.true;
46
+ done();
47
+ }
48
+ myfaces?.onDomReady(onDomCalled);
49
+ await defaultMyFaces();
50
+ });
51
+
52
+ });
@@ -18,10 +18,10 @@
18
18
  * we need a probe to test our asynchronous behavior
19
19
  * the asynchronous behavior needs to be in an asynchronous runnable
20
20
  */
21
- import {AsyncRunnable} from "../../impl/util/AsyncRunnable";
21
+ import {IAsyncRunnable} from "../../impl/util/AsyncRunnable";
22
22
  import {IValueHolder} from "mona-dish";
23
23
 
24
- export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Promise<any>> {
24
+ export class ProbeClass implements IAsyncRunnable<Promise<any>>, IValueHolder<Promise<any>> {
25
25
 
26
26
  value: Promise<any>;
27
27
  fCatch: (data: any) => any;
@@ -44,7 +44,7 @@ export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Pro
44
44
  });
45
45
  }
46
46
 
47
- catch(func: (data: any) => any): AsyncRunnable<boolean> {
47
+ catch(func: (data: any) => any): IAsyncRunnable<boolean> {
48
48
  let catchFunc = (data: any) => {
49
49
  this.catchPerformed = true;
50
50
  return func(data);
@@ -57,7 +57,7 @@ export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Pro
57
57
  return this;
58
58
  }
59
59
 
60
- finally(func: () => void): AsyncRunnable<boolean> {
60
+ finally(func: () => void): IAsyncRunnable<boolean> {
61
61
  let finallyFunc = () => {
62
62
  this.finallyPerformed = true;
63
63
  func();
@@ -88,7 +88,7 @@ export class ProbeClass implements AsyncRunnable<Promise<any>>, IValueHolder<Pro
88
88
  //TODO do something with it
89
89
  }
90
90
 
91
- then(func: (data: any) => any): AsyncRunnable<boolean> {
91
+ then(func: (data: any) => any): IAsyncRunnable<boolean> {
92
92
 
93
93
  let thenFunc = (data: any) => {
94
94
  this.thenPerformed = true;
@@ -18,10 +18,11 @@ import {describe, it} from 'mocha';
18
18
  import {expect} from 'chai';
19
19
  import * as sinon from 'sinon';
20
20
  import {ProbeClass} from "./AsynchronousProbe";
21
- import {AsynchronousQueue} from "../../impl/util/AsyncQueue";
21
+
22
22
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
23
23
  import {Implementation} from "../../impl/AjaxImpl";
24
24
  import defaultMyFaces = StandardInits.defaultMyFaces;
25
+ import {XhrQueueController} from "../../impl/util/XhrQueueController";
25
26
 
26
27
  describe('Asynchronous Queue tests', () => {
27
28
 
@@ -60,7 +61,7 @@ describe('Asynchronous Queue tests', () => {
60
61
 
61
62
  const probe1 = new ProbeClass(setTimeout);
62
63
 
63
- const queue = new AsynchronousQueue();
64
+ const queue = new XhrQueueController();
64
65
  probe1.then(() => {
65
66
  expect(probe1.thenPerformed, "called").to.be.true;
66
67
  done();
@@ -69,7 +70,7 @@ describe('Asynchronous Queue tests', () => {
69
70
  });
70
71
 
71
72
  it('multiple entries', (done) => {
72
- const queue = new AsynchronousQueue();
73
+ const queue = new XhrQueueController();
73
74
  const probe1 = new ProbeClass(setTimeout);
74
75
  const probe2 = new ProbeClass(setTimeout);
75
76
  const probe3 = new ProbeClass(setTimeout);
@@ -87,28 +87,34 @@ describe('tests the addOnEvent and addOnError handling', function () {
87
87
  });
88
88
 
89
89
  it("must have onError called in case of error", function () {
90
- let onErrorCalled1 = 0;
91
- let onErrorCalled2 = 0;
92
-
93
- let errorTitle = '';
94
- let errorMessage = '';
95
- faces.ajax.addOnError((data: any) => {
96
- errorTitle = data.errorName;
97
- errorMessage = data.errorMessage;
98
- onErrorCalled1++
99
- });
100
- faces.ajax.addOnError(() => {
101
- onErrorCalled2++;
102
- });
103
-
104
- //cmd_error_component
105
- DQ.byId("cmd_error_component").click();
106
- this.respond(XmlResponses.ERROR_2);
107
-
108
- expect(onErrorCalled1).to.eq(1);
109
- expect(onErrorCalled2).to.eq(1);
110
- expect(errorTitle).to.eq('Erro21');
111
- expect(errorMessage).to.eq('serverError: Error2 Text');
90
+ const oldErr = console.error;
91
+ console.error = () => {}
92
+ try {
93
+ let onErrorCalled1 = 0;
94
+ let onErrorCalled2 = 0;
95
+
96
+ let errorTitle = '';
97
+ let errorMessage = '';
98
+ faces.ajax.addOnError((data: any) => {
99
+ errorTitle = data.errorName;
100
+ errorMessage = data.errorMessage;
101
+ onErrorCalled1++
102
+ });
103
+ faces.ajax.addOnError(() => {
104
+ onErrorCalled2++;
105
+ });
106
+
107
+ //cmd_error_component
108
+ DQ.byId("cmd_error_component").click();
109
+ this.respond(XmlResponses.ERROR_2);
110
+
111
+ expect(onErrorCalled1).to.eq(1);
112
+ expect(onErrorCalled2).to.eq(1);
113
+ expect(errorTitle).to.eq('Erro21');
114
+ expect(errorMessage).to.eq('serverError: Error2 Text');
115
+ } finally {
116
+ console.error = oldErr;
117
+ }
112
118
  });
113
119
 
114
120
  it("must have an id set if there is an emitting element", function () {
@@ -24,7 +24,7 @@ import {
24
24
  COMPLETE,
25
25
  P_AJAX,
26
26
  P_EXECUTE,
27
- P_PARTIAL_SOURCE,
27
+ P_AJAX_SOURCE,
28
28
  P_RENDER,
29
29
  P_VIEWSTATE,
30
30
  P_WINDOW_ID,
@@ -107,7 +107,7 @@ describe('Namespacing tests', function () {
107
107
  expect(!!resultsMap["execute"]).to.be.false;
108
108
  expect(P_WINDOW_ID in resultsMap).to.be.false;
109
109
  expect(P_VIEWSTATE in resultsMap).to.be.true;
110
- expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
110
+ expect(resultsMap[P_AJAX_SOURCE]).to.eq(escape("jd_0:input_2"));
111
111
  expect(resultsMap[P_AJAX]).to.eq("true");
112
112
  expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
113
113
  expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
@@ -143,7 +143,7 @@ describe('Namespacing tests', function () {
143
143
  expect(!!resultsMap["execute"]).to.be.false;
144
144
  expect(P_WINDOW_ID in resultsMap).to.be.false;
145
145
  expect(P_VIEWSTATE in resultsMap).to.be.true;
146
- expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
146
+ expect(resultsMap[P_AJAX_SOURCE]).to.eq(escape("jd_0:input_2"));
147
147
  expect(resultsMap[P_AJAX]).to.eq("true");
148
148
  expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
149
149
  expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
@@ -191,7 +191,7 @@ describe('Namespacing tests', function () {
191
191
  let viewState = Stream.ofAssoc(resultsMap).filter(data => data[0].indexOf(P_VIEWSTATE) != -1).map(item => item[1]).first().value;
192
192
 
193
193
  expect(viewState).to.eq("booga");
194
- expect(resultsMap[NAMING_CONTAINER_PREF + P_PARTIAL_SOURCE]).to.eq("jd_0:input_2");
194
+ expect(resultsMap[NAMING_CONTAINER_PREF + P_AJAX_SOURCE]).to.eq("jd_0:input_2");
195
195
  expect(resultsMap[NAMING_CONTAINER_PREF + P_AJAX]).to.eq("true");
196
196
  expect(resultsMap[NAMING_CONTAINER_PREF + P_RENDER]).to.eq("jd_0:blarg jd_0:input_2");
197
197
  expect(resultsMap[NAMING_CONTAINER_PREF + P_EXECUTE]).to.eq("jd_0:input_1 jd_0:input_2");
@@ -31,7 +31,7 @@ import {ExtConfig} from "../../impl/util/ExtDomQuery";
31
31
  * @param keyValueEntries a list of key value entries divided by =
32
32
  * @param paramsMapper a key value remapper
33
33
  */
34
- function mergeKeyValueEntries(target: Config, keyValueEntries: Stream<string[]>, paramsMapper = (key, value) => [key, value]) {
34
+ function mergeKeyValueEntries(target: Config, keyValueEntries: string[][], paramsMapper = (key, value) => [key, value]) {
35
35
 
36
36
  function fixKeyWithoutVal(keyVal: string[]) {
37
37
  return keyVal.length < 3 ? [keyVal?.[0] ?? [], keyVal?.[1] ?? []] : keyVal;
@@ -42,7 +42,7 @@ function mergeKeyValueEntries(target: Config, keyValueEntries: Stream<string[]>,
42
42
  //special case of having keys without values
43
43
  .map(keyVal => fixKeyWithoutVal(keyVal))
44
44
  .map(keyVal => paramsMapper(keyVal[0] as string, keyVal[1]))
45
- .each(keyVal => {
45
+ .forEach(keyVal => {
46
46
  let value = keyVal?.splice(1)?.join("") ?? "";
47
47
  if(toMerge.getIfPresent(keyVal[0]).isPresent()) {
48
48
  toMerge.append(keyVal[0] as string).value = value;
@@ -23,7 +23,7 @@ import {
23
23
  COMPLETE, EMPTY_STR,
24
24
  P_AJAX,
25
25
  P_EXECUTE,
26
- P_PARTIAL_SOURCE,
26
+ P_AJAX_SOURCE,
27
27
  P_RENDER,
28
28
  P_VIEWSTATE,
29
29
  P_WINDOW_ID,
@@ -45,6 +45,29 @@ let issueStdReq = function (element) {
45
45
  }
46
46
  });
47
47
  };
48
+
49
+
50
+ let issueStdPPSReq = function (element) {
51
+ faces.ajax.request(element, null, {
52
+ execute: "input_1",
53
+ render: "@form",
54
+ /*
55
+ * myfaces is the extension placeholder, atm only pps is used
56
+ * which was the most useful extension in our legacy codebase
57
+ */
58
+ myfaces: {
59
+ pps: true
60
+ },
61
+ /*
62
+ * params is the spec conform way to pass additional request paramerters
63
+ */
64
+ params: {
65
+ pass1: "pass1",
66
+ pass2: "pass2"
67
+ }
68
+ });
69
+ };
70
+
48
71
  /**
49
72
  * specialized tests testing the xhr core behavior when it hits the xmlHttpRequest object
50
73
  */
@@ -119,13 +142,16 @@ describe('Tests on the xhr core when it starts to call the request', function ()
119
142
  resultsMap[keyVal[0]] = keyVal[1];
120
143
  }
121
144
 
145
+ // normal request, all issuing form must be encoded!
146
+ expect(!!(resultsMap?.["input_2_text"] ?? false)).to.eq(true);
147
+ expect(!!(resultsMap?.["input_1"] ?? false)).to.eq(true);
122
148
  expect(resultsMap["pass1"]).to.eq("pass1");
123
149
  expect(resultsMap["pass2"]).to.eq("pass2");
124
150
  expect(!!resultsMap["render"]).to.be.false;
125
151
  expect(!!resultsMap["execute"]).to.be.false;
126
152
  expect(P_WINDOW_ID in resultsMap).to.be.false;
127
153
  expect(P_VIEWSTATE in resultsMap).to.be.true;
128
- expect(resultsMap[P_PARTIAL_SOURCE]).to.eq("input_2");
154
+ expect(resultsMap[P_AJAX_SOURCE]).to.eq("input_2");
129
155
  expect(resultsMap[P_AJAX]).to.eq("true");
130
156
  expect(resultsMap[P_RENDER]).to.eq("blarg");
131
157
  expect(resultsMap[P_EXECUTE]).to.eq("input_1%20input_2");
@@ -292,7 +318,7 @@ describe('Tests after core when it hits response', function () {
292
318
  expect(!!lastArg.onError).to.be.false;
293
319
  expect(lastArg.pass1 == "pass1").to.be.true;
294
320
  expect(lastArg.pass2 == "pass2").to.be.true;
295
- expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
321
+ expect(!!lastArg[P_AJAX_SOURCE]).to.be.true;
296
322
  expect(!!lastArg[P_AJAX]).to.be.true;
297
323
  expect(!!lastArg[P_EXECUTE]).to.be.true;
298
324
  expect(!!lastArg[P_RENDER]).to.be.true;
@@ -354,7 +380,7 @@ describe('Tests after core when it hits response', function () {
354
380
  expect(!!lastArg.onError).to.be.false;
355
381
  expect(lastArg.pass1 == "pass1").to.be.true;
356
382
  expect(lastArg.pass2 == "pass2").to.be.true;
357
- expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
383
+ expect(!!lastArg[P_AJAX_SOURCE]).to.be.true;
358
384
  expect(!!lastArg[P_AJAX]).to.be.true;
359
385
  expect(!!lastArg[P_EXECUTE]).to.be.true;
360
386
  expect(!!lastArg[P_RENDER]).to.be.true;
@@ -417,7 +443,7 @@ describe('Tests after core when it hits response', function () {
417
443
  expect(!!lastArg.onError).to.be.false;
418
444
  expect(lastArg.pass1 == "pass1").to.be.true;
419
445
  expect(lastArg.pass2 == "pass2").to.be.true;
420
- expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
446
+ expect(!!lastArg[P_AJAX_SOURCE]).to.be.true;
421
447
  expect(!!lastArg[P_AJAX]).to.be.true;
422
448
  expect(!!lastArg[P_EXECUTE]).to.be.true;
423
449
  expect(!!lastArg[P_RENDER]).to.be.true;
@@ -451,9 +477,10 @@ describe('Tests after core when it hits response', function () {
451
477
 
452
478
  let send = sinon.spy(XMLHttpRequest.prototype, "send");
453
479
  let xhrReq = null;
454
-
480
+ const oldErr = console.error;
455
481
  try {
456
482
  let errorCnt = 0;
483
+
457
484
  let element = DomQuery.byId("input_2").getAsElem(0).value;
458
485
  faces.ajax.request(element, null, {
459
486
  execute: "input_1",
@@ -474,6 +501,8 @@ describe('Tests after core when it hits response', function () {
474
501
  },
475
502
  onevent: (evt: any) => {
476
503
  if (evt.status == COMPLETE) {
504
+ console.error = () => {
505
+ };
477
506
  throw Error("This error is wanted, ignore the log");
478
507
  }
479
508
  }
@@ -484,9 +513,13 @@ describe('Tests after core when it hits response', function () {
484
513
  xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
485
514
 
486
515
  } catch (e) {
516
+ if (e.message.indexOf("This error is wanted") != -1) {
517
+ return;
518
+ }
487
519
  console.error(e);
488
520
 
489
521
  } finally {
522
+ console.error = oldErr;
490
523
  send.restore();
491
524
  }
492
525
 
@@ -557,6 +590,47 @@ describe('Tests after core when it hits response', function () {
557
590
  done("Expecting a client error to be thrown")
558
591
  });
559
592
 
593
+ it("must have a proper working myfaces.pps = true, partial page submit", function (done) {
594
+ /**
595
+ * derived from the passthrough test
596
+ */
597
+ let send = sinon.spy(XMLHttpRequest.prototype, "send");
598
+ try {
599
+ //we only issue input 1
600
+ let element = DomQuery.byId("input_1").getAsElem(0).value;
601
+ issueStdPPSReq(element);
602
+
603
+ expect(send.called).to.be.true;
604
+ let argsVal: any = send.args[0][0];
605
+ let arsArr = argsVal.split("&");
606
+ let resultsMap = {};
607
+ for (let val of arsArr) {
608
+ let keyVal = val.split("=");
609
+ resultsMap[keyVal[0]] = keyVal[1];
610
+ }
611
+
612
+ expect(resultsMap?.["input_2_text"] ?? false).to.eq(false);
613
+ expect(!!(resultsMap?.["input_1"] ?? false)).to.eq(true);
614
+ expect(resultsMap["pass1"]).to.eq("pass1");
615
+ expect(resultsMap["pass2"]).to.eq("pass2");
616
+ expect(!!resultsMap["render"]).to.be.false;
617
+ expect(!!resultsMap["execute"]).to.be.false;
618
+ expect(P_WINDOW_ID in resultsMap).to.be.false;
619
+ expect(P_VIEWSTATE in resultsMap).to.be.true;
620
+ expect(resultsMap[P_AJAX_SOURCE]).to.eq("input_1");
621
+ expect(resultsMap[P_AJAX]).to.eq("true");
622
+ expect(resultsMap[P_RENDER]).to.eq("blarg");
623
+ expect(resultsMap[P_EXECUTE]).to.eq("input_1");
624
+
625
+
626
+ // TODO the request map only has the params and input1_ and input_2 passed no matter now many other values
627
+ // we might have to add some input elements into the form which are filetered out
628
+ } finally {
629
+ send.restore();
630
+ }
631
+ done();
632
+ });
633
+
560
634
 
561
635
  });
562
636
 
@@ -324,7 +324,7 @@ describe('Tests after core when it hits response', function () {
324
324
 
325
325
  let send = sinon.spy(XMLHttpRequest.prototype, "send");
326
326
  let xhrReq = null;
327
-
327
+ let oldErr = console.error;
328
328
  try {
329
329
  let element = DomQuery.byId("input_2").getAsElem(0).value;
330
330
  jsf.ajax.request(element, null, {
@@ -344,6 +344,7 @@ describe('Tests after core when it hits response', function () {
344
344
  },
345
345
  onevent: (evt: any) => {
346
346
  if (evt.status == COMPLETE) {
347
+ console.error = () => {};
347
348
  throw Error("This error is wanted, ignore the log");
348
349
  }
349
350
  }
@@ -354,9 +355,13 @@ describe('Tests after core when it hits response', function () {
354
355
  xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
355
356
 
356
357
  } catch (e) {
358
+ if(e.message.indexOf("This error is wanted") != -1) {
359
+ return;
360
+ }
357
361
  console.error(e);
358
362
 
359
363
  } finally {
364
+ console.error = oldErr;
360
365
  send.restore();
361
366
  }
362
367
 
@@ -517,7 +517,6 @@ describe('Tests of the various aspects of the response protocol functionality',
517
517
  </partial-response>`
518
518
 
519
519
  window.document.body.innerHTML = INNER_HTML_MULIT_VIEW;
520
- global["debug4"] = true;
521
520
  faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
522
521
  "javax.faces.behavior.event": "change",
523
522
  execute: "submit_1",
@@ -675,7 +674,7 @@ describe('Tests of the various aspects of the response protocol functionality',
675
674
  });
676
675
 
677
676
  //TODO xhr stubbing, to check if the viewId is prepended in render!
678
-
677
+ global["state_1"] = true;
679
678
  this.respond(`<?xml version="1.0" encoding="UTF-8"?>
680
679
  <partial-response id="viewroot_1">
681
680
  <changes>
@@ -727,35 +726,37 @@ describe('Tests of the various aspects of the response protocol functionality',
727
726
  it('must handle a ViewExpired Error correctly, and only once in a listener', function (done) {
728
727
 
729
728
  document.body.innerHTML = TCK_790_NAV_MARKUP;
730
-
731
- let errorCalled = 0;
732
- faces.ajax.addOnError((error)=> {
733
- expect(error.errorName).to.eq("jakarta.faces.application.ViewExpiredException");
734
- expect(error.errorMessage).to.eq("serverError: View \"/testhmtl.xhtml\" could not be restored.");
735
- expect(error.source.id).to.eq("form1x:button");
736
- errorCalled++;
737
- });
738
-
739
- faces.ajax.request(window.document.getElementById("form1x:button"), null, {
740
- "javax.faces.behavior.event": "click",
741
- execute: "@form",
742
- render: ":form1x:button"
743
- });
744
-
745
- this.respond(`<?xml version="1.0" encoding="UTF-8"?>
729
+ const oldErr = console.error;
730
+ console.error = () => {};
731
+ try {
732
+ let errorCalled = 0;
733
+ faces.ajax.addOnError((error) => {
734
+ expect(error.errorName).to.eq("jakarta.faces.application.ViewExpiredException");
735
+ expect(error.errorMessage).to.eq("serverError: View \"/testhmtl.xhtml\" could not be restored.");
736
+ expect(error.source.id).to.eq("form1x:button");
737
+ errorCalled++;
738
+ });
739
+
740
+ faces.ajax.request(window.document.getElementById("form1x:button"), null, {
741
+ "javax.faces.behavior.event": "click",
742
+ execute: "@form",
743
+ render: ":form1x:button"
744
+ });
745
+
746
+ this.respond(`<?xml version="1.0" encoding="UTF-8"?>
746
747
  <partial-response><error>
747
748
  <error-name>jakarta.faces.application.ViewExpiredException</error-name>
748
749
  <error-message><![CDATA[View "/testhmtl.xhtml" could not be restored.]]></error-message>
749
750
  </error>
750
751
  </partial-response>`)
751
752
 
752
- expect(errorCalled).to.eq(1);
753
-
753
+ expect(errorCalled).to.eq(1);
754
+ } finally {
755
+ console.error = oldErr;
756
+ }
754
757
  done();
755
758
 
756
759
  });
757
760
 
758
761
 
759
-
760
-
761
762
  });
@@ -261,7 +261,7 @@ var myfaces;
261
261
  *
262
262
  * @param executionFunc the function to be executed upon ready
263
263
  */
264
- function onOnDomReady(executionFunc) {
264
+ function onDomReady(executionFunc) {
265
265
  if (document.readyState !== "complete") {
266
266
  onReadyChain.push(executionFunc);
267
267
  if (!readyStateListener) {
@@ -286,7 +286,7 @@ var myfaces;
286
286
  executionFunc();
287
287
  }
288
288
  }
289
- myfaces.onOnDomReady = onOnDomReady;
289
+ myfaces.onDomReady = onDomReady;
290
290
  /**
291
291
  * legacy oam functions
292
292
  */