jsf.js_next_gen 4.0.1-alpha.0 → 4.0.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -12
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/faces.ajax.addOnError.html +4 -4
- package/dist/docs/functions/faces.ajax.request.html +7 -7
- package/dist/docs/functions/faces.ajax.response.html +0 -1
- package/dist/docs/functions/faces.util.chain.html +3 -3
- package/dist/docs/functions/myfaces.ab.html +1 -1
- package/dist/docs/functions/{myfaces.onDomReady.html → myfaces.onOnDomReady.html} +5 -5
- package/dist/docs/index.html +0 -14
- package/dist/docs/modules/myfaces.html +2 -2
- package/dist/docs/variables/myfaces.oam.html +1 -1
- package/dist/window/faces-development.js +1323 -1300
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1323 -1300
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +3 -3
- package/pom.xml +1 -1
- package/src/main/typescript/@types/definitions/index.d.ts +5 -5
- package/src/main/typescript/api/_api.ts +12 -13
- package/src/main/typescript/impl/AjaxImpl.ts +68 -65
- package/src/main/typescript/impl/core/Const.ts +2 -5
- package/src/main/typescript/impl/util/AsyncQueue.ts +133 -0
- package/src/main/typescript/impl/util/AsyncRunnable.ts +6 -81
- package/src/main/typescript/impl/util/ExtDomQuery.ts +9 -7
- package/src/main/typescript/impl/util/FileUtils.ts +22 -26
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +3 -7
- package/src/main/typescript/impl/util/Lang.ts +4 -61
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +10 -12
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +19 -32
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +72 -51
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -6
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +40 -179
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +4 -4
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +231 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +4 -5
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +5 -5
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +3 -4
- package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +78 -0
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +22 -28
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +4 -4
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +6 -80
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +1 -6
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +22 -23
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +5 -5
- package/target/api/_api.js +11 -12
- package/target/api/_api.js.map +1 -1
- package/target/impl/AjaxImpl.js +59 -55
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +5 -7
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +0 -60
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +8 -8
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +20 -21
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/impl/util/HiddenInputBuilder.js +3 -7
- package/target/impl/util/HiddenInputBuilder.js.map +1 -1
- package/target/impl/util/Lang.js +1 -52
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +2 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +7 -9
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +15 -29
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +64 -43
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +3 -5
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +37 -138
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +4 -4
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +4 -5
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +3 -3
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/ClientWindow.spec.js +90 -0
- package/target/test/xhrCore/ClientWindow.spec.js.map +1 -0
- package/target/test/xhrCore/EventTests.spec.js +19 -26
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +3 -3
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +4 -73
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +0 -6
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +15 -22
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +5 -5
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -1
- package/plans for 4.0.1.txt +0 -8
- package/src/main/typescript/impl/util/XhrQueueController.ts +0 -112
- package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +0 -0
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +0 -921
- package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +0 -108
- package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +0 -0
- package/src/main/typescript/test/myfaces/OnLoadSpec.ts +0 -52
|
@@ -83,7 +83,6 @@ 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>
|
|
87
86
|
<input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
|
|
88
87
|
<input type="button" id="input_2" name="input_2" value="input_1_val"></input>
|
|
89
88
|
</form>
|
|
@@ -125,7 +124,7 @@ export module StandardInits {
|
|
|
125
124
|
<body>
|
|
126
125
|
<tobago-page locale='de' class='container-fluid' id='page' focus-on-error='true' wait-overlay-delay-full='1000' wait-overlay-delay-ajax='1000'>
|
|
127
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=''>
|
|
128
|
-
<input type='hidden' name='
|
|
127
|
+
<input type='hidden' name='jakarta.faces.source' id='jakarta.faces.source' disabled='disabled'>
|
|
129
128
|
<tobago-focus id='page::lastFocusId'>
|
|
130
129
|
<input type='hidden' name='page::lastFocusId' id='page::lastFocusId::field'>
|
|
131
130
|
</tobago-focus>
|
|
@@ -139,7 +138,7 @@ export module StandardInits {
|
|
|
139
138
|
</tobago-file>
|
|
140
139
|
<div class='tobago-page-menuStore'>
|
|
141
140
|
</div>
|
|
142
|
-
<span id='page::jsf-state-container'><input type='hidden' name='
|
|
141
|
+
<span id='page::jsf-state-container'><input type='hidden' name='jakarta.faces.ViewState' id='j_id__v_0:jakarta.faces.ViewState:1' value='viewStateValue' autocomplete='off'><input type='hidden' name='jakarta.faces.RenderKitId' value='tobago'><input type='hidden' id='j_id__v_0:jakarta.faces.ClientWindow:1' name='jakarta.faces.ClientWindow' value='clientWindowValue'></span>
|
|
143
142
|
</form>
|
|
144
143
|
</tobago-page>
|
|
145
144
|
</body>
|
|
@@ -223,7 +222,7 @@ export module StandardInits {
|
|
|
223
222
|
<meta charset="UTF-8">
|
|
224
223
|
<title>Title</title>
|
|
225
224
|
<script type="text/javascript"
|
|
226
|
-
src="
|
|
225
|
+
src="/wfmportal/${IS_40 ? 'jakarta' : 'javax'}.faces.resource/${IS_40 ? 'faces': 'jsf'}.js.jsf?ln=jakarta.faces&separator=${separatorChar}"></script>
|
|
227
226
|
</head>
|
|
228
227
|
<body>
|
|
229
228
|
<form id="blarg">
|
|
@@ -514,7 +513,7 @@ export module StandardInits {
|
|
|
514
513
|
//let dom2 = new JSDOM(template)
|
|
515
514
|
//return initMyFacesFromDom(dom2);
|
|
516
515
|
let clean = null;
|
|
517
|
-
//we use jsdom global to
|
|
516
|
+
//we use jsdom global to fullfill our requirements
|
|
518
517
|
//we need to import dynamically and use awaits
|
|
519
518
|
if (withJsf) {
|
|
520
519
|
|
|
@@ -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 {
|
|
21
|
+
import {AsyncRunnable} from "../../impl/util/AsyncRunnable";
|
|
22
22
|
import {IValueHolder} from "mona-dish";
|
|
23
23
|
|
|
24
|
-
export class ProbeClass implements
|
|
24
|
+
export class ProbeClass implements AsyncRunnable<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 IAsyncRunnable<Promise<any>>, IValueHolder<Pr
|
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
catch(func: (data: any) => any):
|
|
47
|
+
catch(func: (data: any) => any): AsyncRunnable<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 IAsyncRunnable<Promise<any>>, IValueHolder<Pr
|
|
|
57
57
|
return this;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
finally(func: () => void):
|
|
60
|
+
finally(func: () => void): AsyncRunnable<boolean> {
|
|
61
61
|
let finallyFunc = () => {
|
|
62
62
|
this.finallyPerformed = true;
|
|
63
63
|
func();
|
|
@@ -88,7 +88,7 @@ export class ProbeClass implements IAsyncRunnable<Promise<any>>, IValueHolder<Pr
|
|
|
88
88
|
//TODO do something with it
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
then(func: (data: any) => any):
|
|
91
|
+
then(func: (data: any) => any): AsyncRunnable<boolean> {
|
|
92
92
|
|
|
93
93
|
let thenFunc = (data: any) => {
|
|
94
94
|
this.thenPerformed = true;
|
|
@@ -18,11 +18,10 @@ 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
|
-
|
|
21
|
+
import {AsynchronousQueue} from "../../impl/util/AsyncQueue";
|
|
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";
|
|
26
25
|
|
|
27
26
|
describe('Asynchronous Queue tests', () => {
|
|
28
27
|
|
|
@@ -61,7 +60,7 @@ describe('Asynchronous Queue tests', () => {
|
|
|
61
60
|
|
|
62
61
|
const probe1 = new ProbeClass(setTimeout);
|
|
63
62
|
|
|
64
|
-
const queue = new
|
|
63
|
+
const queue = new AsynchronousQueue();
|
|
65
64
|
probe1.then(() => {
|
|
66
65
|
expect(probe1.thenPerformed, "called").to.be.true;
|
|
67
66
|
done();
|
|
@@ -70,7 +69,7 @@ describe('Asynchronous Queue tests', () => {
|
|
|
70
69
|
});
|
|
71
70
|
|
|
72
71
|
it('multiple entries', (done) => {
|
|
73
|
-
const queue = new
|
|
72
|
+
const queue = new AsynchronousQueue();
|
|
74
73
|
const probe1 = new ProbeClass(setTimeout);
|
|
75
74
|
const probe2 = new ProbeClass(setTimeout);
|
|
76
75
|
const probe3 = new ProbeClass(setTimeout);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import {describe} from "mocha";
|
|
2
|
+
import * as sinon from "sinon";
|
|
3
|
+
import {Implementation} from "../../impl/AjaxImpl";
|
|
4
|
+
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
5
|
+
import {expect} from "chai";
|
|
6
|
+
|
|
7
|
+
const jsdom = require("jsdom");
|
|
8
|
+
const {JSDOM} = jsdom;
|
|
9
|
+
|
|
10
|
+
describe('adds a getClientWindowTests', function () {
|
|
11
|
+
|
|
12
|
+
// noinspection DuplicatedCode
|
|
13
|
+
beforeEach(function () {
|
|
14
|
+
|
|
15
|
+
let waitForResult = StandardInits.tobagoFileForm();
|
|
16
|
+
|
|
17
|
+
return waitForResult.then((close) => {
|
|
18
|
+
|
|
19
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
20
|
+
this.requests = [];
|
|
21
|
+
this.xhr.onCreate = (xhr) => {
|
|
22
|
+
this.requests.push(xhr);
|
|
23
|
+
};
|
|
24
|
+
(<any>global).XMLHttpRequest = this.xhr;
|
|
25
|
+
window.XMLHttpRequest = this.xhr;
|
|
26
|
+
|
|
27
|
+
this.jsfAjaxResponse = sinon.spy((<any>global).faces.ajax, "response");
|
|
28
|
+
|
|
29
|
+
this.closeIt = () => {
|
|
30
|
+
(<any>global).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
31
|
+
this.jsfAjaxResponse.restore();
|
|
32
|
+
Implementation.reset();
|
|
33
|
+
close();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
afterEach(function () {
|
|
38
|
+
this.closeIt();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("must handle a node based client window call", function (done) {
|
|
42
|
+
let ret = faces.getClientWindow(document.getElementById("page::form"));
|
|
43
|
+
expect(ret).to.eq("clientWindowValue");
|
|
44
|
+
done();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("must handle a url based client id as well", function (done) {
|
|
48
|
+
let waitForResult = StandardInits.defaultMyFaces();
|
|
49
|
+
let oldWindow = window;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
waitForResult.then(() => {
|
|
53
|
+
global["window"] = Object.create(window);
|
|
54
|
+
Object.defineProperty(window, 'location', {
|
|
55
|
+
value: {
|
|
56
|
+
href: oldWindow.location.href + "?jfwid=test2"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
let ret = faces.getClientWindow(document.body);
|
|
60
|
+
expect(ret).to.eq("test2");
|
|
61
|
+
done();
|
|
62
|
+
})
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("document highest priority", function (done) {
|
|
66
|
+
const oldWindow = window;
|
|
67
|
+
global["window"] = Object.create(window);
|
|
68
|
+
Object.defineProperty(window, 'location', {
|
|
69
|
+
value: {
|
|
70
|
+
href: oldWindow.location.href + "?jfwid=test2"
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
let ret = faces.getClientWindow(document.body);
|
|
74
|
+
expect(ret).to.eq("clientWindowValue");
|
|
75
|
+
done();
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
});
|
|
@@ -87,34 +87,28 @@ 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
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
}
|
|
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');
|
|
118
112
|
});
|
|
119
113
|
|
|
120
114
|
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
|
-
|
|
27
|
+
P_PARTIAL_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[
|
|
110
|
+
expect(resultsMap[P_PARTIAL_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[
|
|
146
|
+
expect(resultsMap[P_PARTIAL_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 +
|
|
194
|
+
expect(resultsMap[NAMING_CONTAINER_PREF + P_PARTIAL_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: string[]
|
|
34
|
+
function mergeKeyValueEntries(target: Config, keyValueEntries: Stream<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: string[][], param
|
|
|
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
|
-
.
|
|
45
|
+
.each(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
|
-
|
|
26
|
+
P_PARTIAL_SOURCE,
|
|
27
27
|
P_RENDER,
|
|
28
28
|
P_VIEWSTATE,
|
|
29
29
|
P_WINDOW_ID,
|
|
@@ -45,29 +45,6 @@ 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
|
-
|
|
71
48
|
/**
|
|
72
49
|
* specialized tests testing the xhr core behavior when it hits the xmlHttpRequest object
|
|
73
50
|
*/
|
|
@@ -142,16 +119,13 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
142
119
|
resultsMap[keyVal[0]] = keyVal[1];
|
|
143
120
|
}
|
|
144
121
|
|
|
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);
|
|
148
122
|
expect(resultsMap["pass1"]).to.eq("pass1");
|
|
149
123
|
expect(resultsMap["pass2"]).to.eq("pass2");
|
|
150
124
|
expect(!!resultsMap["render"]).to.be.false;
|
|
151
125
|
expect(!!resultsMap["execute"]).to.be.false;
|
|
152
126
|
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
153
127
|
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
154
|
-
expect(resultsMap[
|
|
128
|
+
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq("input_2");
|
|
155
129
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
156
130
|
expect(resultsMap[P_RENDER]).to.eq("blarg");
|
|
157
131
|
expect(resultsMap[P_EXECUTE]).to.eq("input_1%20input_2");
|
|
@@ -318,7 +292,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
318
292
|
expect(!!lastArg.onError).to.be.false;
|
|
319
293
|
expect(lastArg.pass1 == "pass1").to.be.true;
|
|
320
294
|
expect(lastArg.pass2 == "pass2").to.be.true;
|
|
321
|
-
expect(!!lastArg[
|
|
295
|
+
expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
|
|
322
296
|
expect(!!lastArg[P_AJAX]).to.be.true;
|
|
323
297
|
expect(!!lastArg[P_EXECUTE]).to.be.true;
|
|
324
298
|
expect(!!lastArg[P_RENDER]).to.be.true;
|
|
@@ -380,7 +354,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
380
354
|
expect(!!lastArg.onError).to.be.false;
|
|
381
355
|
expect(lastArg.pass1 == "pass1").to.be.true;
|
|
382
356
|
expect(lastArg.pass2 == "pass2").to.be.true;
|
|
383
|
-
expect(!!lastArg[
|
|
357
|
+
expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
|
|
384
358
|
expect(!!lastArg[P_AJAX]).to.be.true;
|
|
385
359
|
expect(!!lastArg[P_EXECUTE]).to.be.true;
|
|
386
360
|
expect(!!lastArg[P_RENDER]).to.be.true;
|
|
@@ -443,7 +417,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
443
417
|
expect(!!lastArg.onError).to.be.false;
|
|
444
418
|
expect(lastArg.pass1 == "pass1").to.be.true;
|
|
445
419
|
expect(lastArg.pass2 == "pass2").to.be.true;
|
|
446
|
-
expect(!!lastArg[
|
|
420
|
+
expect(!!lastArg[P_PARTIAL_SOURCE]).to.be.true;
|
|
447
421
|
expect(!!lastArg[P_AJAX]).to.be.true;
|
|
448
422
|
expect(!!lastArg[P_EXECUTE]).to.be.true;
|
|
449
423
|
expect(!!lastArg[P_RENDER]).to.be.true;
|
|
@@ -477,10 +451,9 @@ describe('Tests after core when it hits response', function () {
|
|
|
477
451
|
|
|
478
452
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
479
453
|
let xhrReq = null;
|
|
480
|
-
|
|
454
|
+
|
|
481
455
|
try {
|
|
482
456
|
let errorCnt = 0;
|
|
483
|
-
|
|
484
457
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
485
458
|
faces.ajax.request(element, null, {
|
|
486
459
|
execute: "input_1",
|
|
@@ -501,8 +474,6 @@ describe('Tests after core when it hits response', function () {
|
|
|
501
474
|
},
|
|
502
475
|
onevent: (evt: any) => {
|
|
503
476
|
if (evt.status == COMPLETE) {
|
|
504
|
-
console.error = () => {
|
|
505
|
-
};
|
|
506
477
|
throw Error("This error is wanted, ignore the log");
|
|
507
478
|
}
|
|
508
479
|
}
|
|
@@ -513,13 +484,9 @@ describe('Tests after core when it hits response', function () {
|
|
|
513
484
|
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
514
485
|
|
|
515
486
|
} catch (e) {
|
|
516
|
-
if (e.message.indexOf("This error is wanted") != -1) {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
487
|
console.error(e);
|
|
520
488
|
|
|
521
489
|
} finally {
|
|
522
|
-
console.error = oldErr;
|
|
523
490
|
send.restore();
|
|
524
491
|
}
|
|
525
492
|
|
|
@@ -590,47 +557,6 @@ describe('Tests after core when it hits response', function () {
|
|
|
590
557
|
done("Expecting a client error to be thrown")
|
|
591
558
|
});
|
|
592
559
|
|
|
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
|
-
|
|
634
560
|
|
|
635
561
|
});
|
|
636
562
|
|
|
@@ -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
|
+
|
|
328
328
|
try {
|
|
329
329
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
330
330
|
jsf.ajax.request(element, null, {
|
|
@@ -344,7 +344,6 @@ 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 = () => {};
|
|
348
347
|
throw Error("This error is wanted, ignore the log");
|
|
349
348
|
}
|
|
350
349
|
}
|
|
@@ -355,13 +354,9 @@ describe('Tests after core when it hits response', function () {
|
|
|
355
354
|
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
356
355
|
|
|
357
356
|
} catch (e) {
|
|
358
|
-
if(e.message.indexOf("This error is wanted") != -1) {
|
|
359
|
-
return;
|
|
360
|
-
}
|
|
361
357
|
console.error(e);
|
|
362
358
|
|
|
363
359
|
} finally {
|
|
364
|
-
console.error = oldErr;
|
|
365
360
|
send.restore();
|
|
366
361
|
}
|
|
367
362
|
|
|
@@ -517,6 +517,7 @@ 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;
|
|
520
521
|
faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
|
|
521
522
|
"javax.faces.behavior.event": "change",
|
|
522
523
|
execute: "submit_1",
|
|
@@ -674,7 +675,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
674
675
|
});
|
|
675
676
|
|
|
676
677
|
//TODO xhr stubbing, to check if the viewId is prepended in render!
|
|
677
|
-
|
|
678
|
+
|
|
678
679
|
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
679
680
|
<partial-response id="viewroot_1">
|
|
680
681
|
<changes>
|
|
@@ -726,37 +727,35 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
726
727
|
it('must handle a ViewExpired Error correctly, and only once in a listener', function (done) {
|
|
727
728
|
|
|
728
729
|
document.body.innerHTML = TCK_790_NAV_MARKUP;
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
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"?>
|
|
747
746
|
<partial-response><error>
|
|
748
747
|
<error-name>jakarta.faces.application.ViewExpiredException</error-name>
|
|
749
748
|
<error-message><![CDATA[View "/testhmtl.xhtml" could not be restored.]]></error-message>
|
|
750
749
|
</error>
|
|
751
750
|
</partial-response>`)
|
|
752
751
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
console.error = oldErr;
|
|
756
|
-
}
|
|
752
|
+
expect(errorCalled).to.eq(1);
|
|
753
|
+
|
|
757
754
|
done();
|
|
758
755
|
|
|
759
756
|
});
|
|
760
757
|
|
|
761
758
|
|
|
759
|
+
|
|
760
|
+
|
|
762
761
|
});
|
|
@@ -74,7 +74,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
74
74
|
actionElement,
|
|
75
75
|
event,
|
|
76
76
|
{
|
|
77
|
-
"
|
|
77
|
+
"jakarta.faces.behavior.event": "change",
|
|
78
78
|
execute: 'page:fileAjax',
|
|
79
79
|
render: null
|
|
80
80
|
});
|
|
@@ -91,10 +91,10 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
91
91
|
let formData: FormData = request.requestBody;
|
|
92
92
|
expect(formData.get("page::lastFocusId")).to.eq("");
|
|
93
93
|
expect(formData.get("org.apache.myfaces.tobago.webapp.Secret")).to.eq("secretValue");
|
|
94
|
-
expect(formData.get("
|
|
95
|
-
expect(formData.get("
|
|
96
|
-
expect(formData.get("
|
|
97
|
-
expect(formData.get("
|
|
94
|
+
expect(formData.get("jakarta.faces.ViewState")).to.eq("viewStateValue");
|
|
95
|
+
expect(formData.get("jakarta.faces.RenderKitId")).to.eq("tobago");
|
|
96
|
+
expect(formData.get("jakarta.faces.ClientWindow")).to.eq("clientWindowValue");
|
|
97
|
+
expect(formData.get("jakarta.faces.behavior.event")).to.eq("change");
|
|
98
98
|
expect(formData.get("jakarta.faces.partial.event")).to.eq("change");
|
|
99
99
|
expect(formData.get("jakarta.faces.source")).to.eq("page:fileAjax");
|
|
100
100
|
expect(formData.get("jakarta.faces.partial.ajax")).to.eq("true");
|