jsf.js_next_gen 4.0.0-RC.11 → 4.0.0-RC.14
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/dist/window/faces-development.js +298 -208
- 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.LICENSE.txt +0 -2
- 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 +298 -208
- 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.LICENSE.txt +0 -2
- 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 +4 -4
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +2 -0
- package/src/main/typescript/api/_api.ts +2 -2
- package/src/main/typescript/impl/AjaxImpl.ts +40 -29
- package/src/main/typescript/impl/core/Const.ts +43 -38
- package/src/main/typescript/impl/core/Context.ts +19 -0
- package/src/main/typescript/impl/util/Assertions.ts +2 -2
- package/src/main/typescript/impl/util/ExtDomQuery.ts +2 -2
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +63 -0
- package/src/main/typescript/impl/util/Lang.ts +8 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +17 -5
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +4 -4
- package/src/main/typescript/impl/xhrCore/Response.ts +25 -25
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +116 -120
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +1 -1
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +8 -7
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +19 -0
- package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -3
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +195 -0
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +2 -0
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +142 -2
- package/target/api/_api.js +1 -1
- package/target/api/_api.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +34 -23
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +44 -36
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/Context.js +10 -0
- package/target/impl/core/Context.js.map +1 -0
- package/target/impl/util/Assertions.js +1 -1
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +2 -2
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +58 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/impl/util/Lang.js +7 -9
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +1 -1
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +13 -3
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +3 -3
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +13 -13
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +98 -107
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +1 -1
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +7 -8
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +18 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +2 -2
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +2 -2
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +199 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +127 -2
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
|
@@ -23,11 +23,12 @@ import {ErrorData} from "./ErrorData";
|
|
|
23
23
|
import {EventData} from "./EventData";
|
|
24
24
|
import {ExtLang} from "../util/Lang";
|
|
25
25
|
import {
|
|
26
|
+
$faces,
|
|
26
27
|
BEGIN,
|
|
27
28
|
COMPLETE,
|
|
28
29
|
CONTENT_TYPE,
|
|
29
30
|
CTX_PARAM_MF_INTERNAL,
|
|
30
|
-
|
|
31
|
+
CTX_PARAM_REQ_PASS_THR,
|
|
31
32
|
ERROR,
|
|
32
33
|
HEAD_FACES_REQ,
|
|
33
34
|
MALFORMEDXML,
|
|
@@ -111,12 +112,12 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
111
112
|
let xhrObject = this.xhrObject;
|
|
112
113
|
|
|
113
114
|
let executesArr = () => {
|
|
114
|
-
return this.requestContext.getIf(
|
|
115
|
+
return this.requestContext.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).get("none").value.split(/\s+/gi);
|
|
115
116
|
};
|
|
116
117
|
try {
|
|
117
118
|
|
|
118
119
|
let formElement = this.sourceForm.getAsElem(0).value;
|
|
119
|
-
let viewState = (
|
|
120
|
+
let viewState = $faces().getViewState(formElement);
|
|
120
121
|
// encoded we need to decode
|
|
121
122
|
// We generated a base representation of the current form
|
|
122
123
|
// in case someone has overloaded the viewState with additional decorators we merge
|
|
@@ -132,14 +133,14 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
132
133
|
|
|
133
134
|
// next step the pass through parameters are merged in for post params
|
|
134
135
|
let requestContext = this.requestContext;
|
|
135
|
-
let
|
|
136
|
+
let requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR);
|
|
136
137
|
|
|
137
138
|
// this is an extension where we allow pass through parameters to be sent down additionally
|
|
138
139
|
// this can be used and is used in the impl to enrich the post request parameters with additional
|
|
139
140
|
// information
|
|
140
|
-
formData.shallowMerge(
|
|
141
|
+
formData.shallowMerge(requestPassThroughParams, true, true);
|
|
141
142
|
|
|
142
|
-
this.responseContext =
|
|
143
|
+
this.responseContext = requestPassThroughParams.deepCopy;
|
|
143
144
|
|
|
144
145
|
// we have to shift the internal passthroughs around to build up our response context
|
|
145
146
|
let responseContext = this.responseContext;
|
|
@@ -290,7 +291,7 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
290
291
|
return;
|
|
291
292
|
}
|
|
292
293
|
|
|
293
|
-
(
|
|
294
|
+
$faces().ajax.response(this.xhrObject, this.responseContext.value ?? {});
|
|
294
295
|
}
|
|
295
296
|
|
|
296
297
|
private handleMalFormedXML(resolve: Function) {
|
|
@@ -90,6 +90,22 @@ export module StandardInits {
|
|
|
90
90
|
</html>`;
|
|
91
91
|
|
|
92
92
|
|
|
93
|
+
const HTML_FORM_NAMESPACED = `<!DOCTYPE html>
|
|
94
|
+
<html lang="en">
|
|
95
|
+
<head>
|
|
96
|
+
<meta charset="UTF-8">
|
|
97
|
+
<title>Title</title>
|
|
98
|
+
</head>
|
|
99
|
+
<body>
|
|
100
|
+
<form id="jd_0:blarg">
|
|
101
|
+
<input type="text" id="jd_0:input_1" name="jd_0:input_1" value="input_1_val"></input>
|
|
102
|
+
<input type="hidden" id="jd_0:jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
|
|
103
|
+
<input type="button" id="jd_0:input_2" name="input_2" value="input_1_val"></input>
|
|
104
|
+
</form>
|
|
105
|
+
</body>
|
|
106
|
+
</html>`;
|
|
107
|
+
|
|
108
|
+
|
|
93
109
|
|
|
94
110
|
/**
|
|
95
111
|
* a page simulating basically a simple faces form
|
|
@@ -277,6 +293,9 @@ export module StandardInits {
|
|
|
277
293
|
export function defaultMyFaces(withJsf = true): Promise<() => void> {
|
|
278
294
|
return init(HTML_FORM_DEFAULT, withJsf);
|
|
279
295
|
}
|
|
296
|
+
export function defaultMyFacesNamespaces(withJsf = true): Promise<() => void> {
|
|
297
|
+
return init(HTML_FORM_NAMESPACED, withJsf);
|
|
298
|
+
}
|
|
280
299
|
export function defaultMyFaces23(withJsf = true): Promise<() => void> {
|
|
281
300
|
return init(HTML_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
|
|
282
301
|
}
|
|
@@ -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(
|
|
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(
|
|
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(
|
|
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(
|
|
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();
|
|
@@ -0,0 +1,195 @@
|
|
|
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
|
+
import * as sinon from "sinon";
|
|
19
|
+
import {expect} from "chai";
|
|
20
|
+
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
21
|
+
import {DomQuery, DQ$} from "mona-dish";
|
|
22
|
+
import {
|
|
23
|
+
$nsp,
|
|
24
|
+
COMPLETE,
|
|
25
|
+
P_AJAX,
|
|
26
|
+
P_EXECUTE,
|
|
27
|
+
P_PARTIAL_SOURCE,
|
|
28
|
+
P_RENDER,
|
|
29
|
+
P_VIEWSTATE,
|
|
30
|
+
P_WINDOW_ID,
|
|
31
|
+
SUCCESS
|
|
32
|
+
} from "../../impl/core/Const";
|
|
33
|
+
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
34
|
+
import STD_XML = StandardInits.STD_XML;
|
|
35
|
+
import defaultMyFacesNamespaces = StandardInits.defaultMyFacesNamespaces;
|
|
36
|
+
import {escape} from "querystring";
|
|
37
|
+
|
|
38
|
+
declare var faces: any;
|
|
39
|
+
declare var Implementation: any;
|
|
40
|
+
|
|
41
|
+
let issueStdReq = function (element) {
|
|
42
|
+
faces.ajax.request(element, null, {
|
|
43
|
+
execute: "input_1",
|
|
44
|
+
render: "@form",
|
|
45
|
+
params: {
|
|
46
|
+
pass1: "pass1",
|
|
47
|
+
pass2: "pass2"
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
describe('Namespacing tests', function () {
|
|
53
|
+
beforeEach(async function () {
|
|
54
|
+
|
|
55
|
+
let waitForResult = defaultMyFacesNamespaces();
|
|
56
|
+
|
|
57
|
+
return waitForResult.then((close) => {
|
|
58
|
+
|
|
59
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
60
|
+
this.requests = [];
|
|
61
|
+
this.xhr.onCreate = (xhr) => {
|
|
62
|
+
this.requests.push(xhr);
|
|
63
|
+
};
|
|
64
|
+
(<any>global).XMLHttpRequest = this.xhr;
|
|
65
|
+
window.XMLHttpRequest = this.xhr;
|
|
66
|
+
|
|
67
|
+
this.jsfAjaxResponse = sinon.spy((<any>global).faces.ajax, "response");
|
|
68
|
+
|
|
69
|
+
this.closeIt = () => {
|
|
70
|
+
(<any>global).XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
71
|
+
this.jsfAjaxResponse.restore();
|
|
72
|
+
Implementation.reset();
|
|
73
|
+
close();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
afterEach(function () {
|
|
79
|
+
this.closeIt();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('must send the element identifiers properly encoded', function () {
|
|
83
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
84
|
+
try {
|
|
85
|
+
faces.ajax.request(document.getElementById("jd_0:input_2"), null, {
|
|
86
|
+
execute: ":input_1",
|
|
87
|
+
render: ":blarg :input2",
|
|
88
|
+
params: {
|
|
89
|
+
pass1: "pass1",
|
|
90
|
+
pass2: "pass2"
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
expect(send.called).to.be.true;
|
|
95
|
+
let argsVal: any = send.args[0][0];
|
|
96
|
+
let arsArr = argsVal.split("&");
|
|
97
|
+
let resultsMap = {};
|
|
98
|
+
for (let val of arsArr) {
|
|
99
|
+
let keyVal = val.split("=");
|
|
100
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
expect(resultsMap["pass1"]).to.eq("pass1");
|
|
104
|
+
expect(resultsMap["pass2"]).to.eq("pass2");
|
|
105
|
+
expect(!!resultsMap["render"]).to.be.false;
|
|
106
|
+
expect(!!resultsMap["execute"]).to.be.false;
|
|
107
|
+
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
108
|
+
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
109
|
+
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
110
|
+
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
111
|
+
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input2"));
|
|
112
|
+
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
113
|
+
} finally {
|
|
114
|
+
send.restore();
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
it('must send the element identifiers properly encoded 2', function () {
|
|
119
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
120
|
+
try {
|
|
121
|
+
faces.ajax.request(document.getElementById("jd_0:input_2"), null, {
|
|
122
|
+
execute: "jd_0:input_1",
|
|
123
|
+
render: ":blarg jd_0:input2",
|
|
124
|
+
params: {
|
|
125
|
+
pass1: "pass1",
|
|
126
|
+
pass2: "pass2"
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
expect(send.called).to.be.true;
|
|
131
|
+
let argsVal: any = send.args[0][0];
|
|
132
|
+
let arsArr = argsVal.split("&");
|
|
133
|
+
let resultsMap = {};
|
|
134
|
+
for (let val of arsArr) {
|
|
135
|
+
let keyVal = val.split("=");
|
|
136
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
expect(resultsMap["pass1"]).to.eq("pass1");
|
|
140
|
+
expect(resultsMap["pass2"]).to.eq("pass2");
|
|
141
|
+
expect(!!resultsMap["render"]).to.be.false;
|
|
142
|
+
expect(!!resultsMap["execute"]).to.be.false;
|
|
143
|
+
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
144
|
+
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
145
|
+
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
146
|
+
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
147
|
+
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input2"));
|
|
148
|
+
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
149
|
+
} finally {
|
|
150
|
+
send.restore();
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
it('must get name prefixed viewstate properly', function () {
|
|
156
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
157
|
+
try {
|
|
158
|
+
DQ$(`[name*='${P_VIEWSTATE}']`).attr("name").value = `jd_0:${P_VIEWSTATE}`;
|
|
159
|
+
DQ$(`[name*='${P_VIEWSTATE}']`).val = "booga";
|
|
160
|
+
|
|
161
|
+
faces.ajax.request(document.getElementById("jd_0:input_2"), null, {
|
|
162
|
+
execute: "jd_0:input_1",
|
|
163
|
+
render: ":blarg jd_0:input2",
|
|
164
|
+
params: {
|
|
165
|
+
pass1: "pass1",
|
|
166
|
+
pass2: "pass2"
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
expect(send.called).to.be.true;
|
|
171
|
+
let argsVal: any = send.args[0][0];
|
|
172
|
+
let arsArr = argsVal.split("&");
|
|
173
|
+
let resultsMap = {};
|
|
174
|
+
for (let val of arsArr) {
|
|
175
|
+
let keyVal = val.split("=");
|
|
176
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
expect(resultsMap["pass1"]).to.eq("pass1");
|
|
180
|
+
expect(resultsMap["pass2"]).to.eq("pass2");
|
|
181
|
+
expect(!!resultsMap["render"]).to.be.false;
|
|
182
|
+
expect(!!resultsMap["execute"]).to.be.false;
|
|
183
|
+
expect(P_WINDOW_ID in resultsMap).to.be.false;
|
|
184
|
+
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
185
|
+
expect(resultsMap[P_VIEWSTATE]).to.eq("booga");
|
|
186
|
+
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
187
|
+
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
188
|
+
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input2"));
|
|
189
|
+
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
190
|
+
} finally {
|
|
191
|
+
send.restore();
|
|
192
|
+
}
|
|
193
|
+
})
|
|
194
|
+
|
|
195
|
+
});
|
|
@@ -229,7 +229,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
229
229
|
DQ.byId("cmd_eval").click();
|
|
230
230
|
/*js full submit form, coming from the integration tests*/
|
|
231
231
|
window.document.body.innerHTML = `<form id="j_id__v_0" name="j_id__v_0" method="post" action="/IntegrationJSTest/integrationtestsjasmine/test7-eventtest.jsf"
|
|
232
|
-
|
|
232
|
+
><span id="updatePanel">hello world</span><a href="#"
|
|
233
233
|
onclick="return faces.util.chain(this, event,'return false;', 'return myfaces.ab(\'j_id_1l\',\'updateTrigger\');');"
|
|
234
234
|
id="updateTrigger"
|
|
235
235
|
name="updateTrigger"
|
|
@@ -263,7 +263,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
263
263
|
DQ.byId("cmd_eval").click();
|
|
264
264
|
/*js full submit form, coming from the integration tests*/
|
|
265
265
|
window.document.body.innerHTML = `<form id="j_id__v_0" name="j_id__v_0" method="post" action="/IntegrationJSTest/integrationtestsjasmine/test7-eventtest.jsf"
|
|
266
|
-
|
|
266
|
+
><span id="updatePanel">hello world</span><a href="#"
|
|
267
267
|
onclick="return faces.util.chain(this, event,'return false;', 'return myfaces.ab(\'j_id_1l\',\'updateTrigger\');');"
|
|
268
268
|
id="updateTrigger"
|
|
269
269
|
name="updateTrigger"
|
|
@@ -584,4 +584,144 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
584
584
|
|
|
585
585
|
done();
|
|
586
586
|
})
|
|
587
|
+
|
|
588
|
+
const TCK_790_MARKUP = `
|
|
589
|
+
<div id="panel1">
|
|
590
|
+
<form id="form1" name="form1" method="post"
|
|
591
|
+
action="booga"
|
|
592
|
+
><input id="form1:button" name="form1:button" type="submit"
|
|
593
|
+
value="submit form1 via ajax">
|
|
594
|
+
<input type="hidden" name="jakarta.faces.ViewState"
|
|
595
|
+
id="viewroot_1:jakarta.faces.ViewState:1"
|
|
596
|
+
value="beforeUpdate">
|
|
597
|
+
</form>
|
|
598
|
+
</div>
|
|
599
|
+
<div id="panel2">
|
|
600
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
601
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
602
|
+
</form>
|
|
603
|
+
</div>
|
|
604
|
+
<div id="panel3">
|
|
605
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
606
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
607
|
+
</form>
|
|
608
|
+
</div>
|
|
609
|
+
`;
|
|
610
|
+
|
|
611
|
+
|
|
612
|
+
const TCK_790_NAV_MARKUP = `
|
|
613
|
+
<form id="form1x" name="form1" method="post"
|
|
614
|
+
action="booga"
|
|
615
|
+
><input id="form1x:button" name="form1x:button" type="submit"
|
|
616
|
+
value="submit form1 via ajax">
|
|
617
|
+
<input type="hidden" name="jakarta.faces.ViewState"
|
|
618
|
+
id="viewroot_1:jakarta.faces.ViewState:1"
|
|
619
|
+
value="beforeUpdate">
|
|
620
|
+
</form>
|
|
621
|
+
`;
|
|
622
|
+
|
|
623
|
+
/**
|
|
624
|
+
* Similar to TCK 790
|
|
625
|
+
*/
|
|
626
|
+
it("must handle a more complex replace with several forms and one issuing form and a viewstate and a viewroot id in response but viewroot is not present in page", function (done) { //special case, viewid given but no viewid in page special result all render and executes must be updated
|
|
627
|
+
|
|
628
|
+
document.body.innerHTML = TCK_790_MARKUP;
|
|
629
|
+
|
|
630
|
+
const RESPONSE_1 = `<partial-response id="viewroot_1">
|
|
631
|
+
<changes>
|
|
632
|
+
<update id="panel2"><![CDATA[
|
|
633
|
+
<div id="panel2">
|
|
634
|
+
after update
|
|
635
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
636
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
637
|
+
<input type="hidden" name="form2_SUBMIT" value="1"/></form>
|
|
638
|
+
</div>
|
|
639
|
+
]]>
|
|
640
|
+
</update>
|
|
641
|
+
<update id="panel3"><![CDATA[
|
|
642
|
+
<div id="panel3">
|
|
643
|
+
after update
|
|
644
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
645
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
646
|
+
</form>
|
|
647
|
+
</div>
|
|
648
|
+
]]>
|
|
649
|
+
</update>
|
|
650
|
+
<update id="viewroot_1:jakarta.faces.ViewState:1"><![CDATA[booga_after_update]]></update>
|
|
651
|
+
</changes>
|
|
652
|
+
</partial-response>`;
|
|
653
|
+
faces.ajax.request(window.document.getElementById("form1:button"), null, {
|
|
654
|
+
"javax.faces.behavior.event": "click",
|
|
655
|
+
execute: "form1",
|
|
656
|
+
render: "form2 form3"
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
this.respond(RESPONSE_1);
|
|
660
|
+
expect(DQ$("#form1 [name='jakarta.faces.ViewState']").val).to.eq("booga_after_update");
|
|
661
|
+
expect(DQ$("#form2 [name='jakarta.faces.ViewState']").val).to.eq("booga_after_update");
|
|
662
|
+
expect(DQ$("#form2 [name='jakarta.faces.ViewState']").val).to.eq("booga_after_update");
|
|
663
|
+
done();
|
|
664
|
+
})
|
|
665
|
+
|
|
666
|
+
it("must handle a complex navigation response (TCK Spec790)", function (done) {
|
|
667
|
+
/*we start from a simple form which triggers a an internal navigation*/
|
|
668
|
+
document.body.innerHTML = TCK_790_NAV_MARKUP;
|
|
669
|
+
|
|
670
|
+
faces.ajax.request(window.document.getElementById("form1x:button"), null, {
|
|
671
|
+
"javax.faces.behavior.event": "click",
|
|
672
|
+
execute: "@form",
|
|
673
|
+
render: ":form1x:button"
|
|
674
|
+
});
|
|
675
|
+
|
|
676
|
+
//TODO xhr stubbing, to check if the viewId is prepended in render!
|
|
677
|
+
|
|
678
|
+
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
679
|
+
<partial-response id="viewroot_1">
|
|
680
|
+
<changes>
|
|
681
|
+
<update id="jakarta.faces.ViewRoot"><![CDATA[<!DOCTYPE html>
|
|
682
|
+
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
683
|
+
<head>
|
|
684
|
+
<title>Spec 790</title>
|
|
685
|
+
<script src="/jakarta.faces.resource/faces.js.xhtml?ln=jakarta.faces;stage=Development"></script>
|
|
686
|
+
</head>
|
|
687
|
+
<body>
|
|
688
|
+
<div id="panel1">
|
|
689
|
+
<form id="form1" name="form1" method="post"
|
|
690
|
+
action="booga"
|
|
691
|
+
><input id="form1:button" name="form1:button" type="submit"
|
|
692
|
+
value="submit form1 via ajax">
|
|
693
|
+
</form>
|
|
694
|
+
</div>
|
|
695
|
+
<div id="panel2">
|
|
696
|
+
after update
|
|
697
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
698
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
699
|
+
<input type="hidden" name="form2_SUBMIT" value="1"/></form>
|
|
700
|
+
</div>
|
|
701
|
+
<div id="panel3">
|
|
702
|
+
after update
|
|
703
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
704
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
705
|
+
</form>
|
|
706
|
+
</div>
|
|
707
|
+
</body>
|
|
708
|
+
</html>
|
|
709
|
+
]]>
|
|
710
|
+
</update>
|
|
711
|
+
<update id="viewroot_1:jakarta.faces.ViewState:1"><![CDATA[booga_after_update]]></update>
|
|
712
|
+
</changes>
|
|
713
|
+
</partial-response>
|
|
714
|
+
`)
|
|
715
|
+
expect(DQ$("#form1 [name='jakarta.faces.ViewState']").val).to.eq("booga_after_update");
|
|
716
|
+
expect(DQ$("#form2 [name='jakarta.faces.ViewState']").val).to.eq("booga_after_update");
|
|
717
|
+
expect(DQ$("#form3 [name='jakarta.faces.ViewState']").val).to.eq("booga_after_update");
|
|
718
|
+
|
|
719
|
+
expect(DQ$("#form1 [name='jakarta.faces.ViewState']").id.value.indexOf("viewroot_1:jakarta.faces.ViewState:0") === 0).to.be.true;
|
|
720
|
+
expect(DQ$("#form2 [name='jakarta.faces.ViewState']").id.value.indexOf("viewroot_1:jakarta.faces.ViewState:1") === 0).to.be.true;
|
|
721
|
+
expect(DQ$("#form3 [name='jakarta.faces.ViewState']").id.value.indexOf("viewroot_1:jakarta.faces.ViewState:2") === 0).to.be.true;
|
|
722
|
+
|
|
723
|
+
done();
|
|
724
|
+
});
|
|
725
|
+
|
|
726
|
+
|
|
587
727
|
});
|
package/target/api/_api.js
CHANGED
|
@@ -243,7 +243,7 @@ var myfaces;
|
|
|
243
243
|
options[(0, Const_1.$nsp)(Const_1.P_BEHAVIOR_EVENT)] = eventName;
|
|
244
244
|
}
|
|
245
245
|
if (execute) {
|
|
246
|
-
options[Const_1.
|
|
246
|
+
options[Const_1.CTX_OPTIONS_EXECUTE] = execute;
|
|
247
247
|
}
|
|
248
248
|
if (render) {
|
|
249
249
|
options[Const_1.CTX_PARAM_RENDER] = render;
|
package/target/api/_api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_api.js","sourceRoot":"","sources":["../../src/main/typescript/api/_api.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,+CAAgD;AAChD,+CAA0C;AAC1C,oDAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"_api.js","sourceRoot":"","sources":["../../src/main/typescript/api/_api.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;GAcG;AACH,+CAAgD;AAChD,+CAA0C;AAC1C,oDAAiD;AACjD,8CAAiG;AAIjG,4EAA4E;AAC5E,yBAAyB;AACzB,IAAc,KAAK,CAuNlB;AAvND,WAAc,KAAK;IAGf;;;;;;;;;;OAUG;IACQ,iBAAW,GAAG,MAAM,CAAC;IAChC;;;;;;;OAOG;IACQ,iBAAW,GAAG,CAAC,CAAC;IAE3B;;OAEG;IACQ,mBAAa,GAAW,gBAAgB,EAAE,CAAC;IAEtD,qCAAqC;IACrC;;OAEG;IACQ,iBAAW,GAAW,oDAAoD,CAAC;IACtF,0CAA0C;IAE1C;;;;;;;;;;;;;;OAcG;IACH,SAAgB,eAAe;QAC3B,OAAO,yBAAc,CAAC,eAAe,EAAE,CAAC;IAC5C,CAAC;IAFe,qBAAe,kBAE9B,CAAA;IAED;;;;;;;OAOG;IACH,SAAgB,YAAY,CAAC,WAA6B;QACtD,OAAO,yBAAc,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IACpD,CAAC;IAFe,kBAAY,eAE3B,CAAA;IAED;;;;OAIG;IACH,SA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