jsf.js_next_gen 4.0.0-RC.19 → 4.0.0-RC.20
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/docs/assets/main.js +56 -52
- package/dist/docs/assets/style.css +23 -0
- package/dist/window/faces-development.js +127 -12
- 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 +127 -12
- 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 +12 -12
- package/src/main/typescript/impl/AjaxImpl.ts +17 -5
- package/src/main/typescript/impl/util/ExtDomQuery.ts +6 -1
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +12 -4
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +53 -0
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +7 -6
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +116 -9
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +36 -0
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +32 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/tmp/test.html +12 -88
- package/target/impl/AjaxImpl.js +15 -3
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +4 -0
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +9 -1
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +45 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +7 -6
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +101 -4
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +32 -0
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +1 -0
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +30 -0
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsf.js_next_gen",
|
|
3
|
-
"version": "4.0.0-RC.
|
|
3
|
+
"version": "4.0.0-RC.20",
|
|
4
4
|
"description": "A next generation typescript reimplementation of jsf.js",
|
|
5
5
|
"main": "dist/window/faces.js",
|
|
6
6
|
"scripts": {
|
|
@@ -23,31 +23,31 @@
|
|
|
23
23
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
24
24
|
"@types/chai": "^4.3.4",
|
|
25
25
|
"@types/mocha": "^10.0.1",
|
|
26
|
-
"@types/node": "^18.11.
|
|
26
|
+
"@types/node": "^18.11.18",
|
|
27
27
|
"@types/sinon": "^10.0.13",
|
|
28
28
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
|
29
29
|
"chai": "^4.3.7",
|
|
30
30
|
"compression-webpack-plugin": "^10.0.0",
|
|
31
31
|
"html-webpack-plugin": "^5.5.0",
|
|
32
32
|
"http-server": "^14.1.1",
|
|
33
|
-
"jsdom": "^
|
|
33
|
+
"jsdom": "^21.0.0",
|
|
34
34
|
"jsdom-global": "^3.0.2",
|
|
35
|
-
"mocha": "^10.
|
|
36
|
-
"npm-check-updates": "^16.
|
|
35
|
+
"mocha": "^10.2.0",
|
|
36
|
+
"npm-check-updates": "^16.6.2",
|
|
37
37
|
"nyc": "^15.1.0",
|
|
38
38
|
"replace-in-file": "^6.3.5",
|
|
39
|
-
"rxjs": "^7.
|
|
40
|
-
"sinon": "^15.0.
|
|
39
|
+
"rxjs": "^7.8.0",
|
|
40
|
+
"sinon": "^15.0.1",
|
|
41
41
|
"terser-webpack-plugin": "^5.3.6",
|
|
42
|
-
"ts-loader": "^9.4.
|
|
42
|
+
"ts-loader": "^9.4.2",
|
|
43
43
|
"ts-node": "^10.9.1",
|
|
44
|
-
"typedoc": "^0.23.
|
|
45
|
-
"typescript": "^4.9.
|
|
44
|
+
"typedoc": "^0.23.24",
|
|
45
|
+
"typescript": "^4.9.4",
|
|
46
46
|
"webpack": "^5.75.0",
|
|
47
|
-
"webpack-cli": "^5.0.
|
|
47
|
+
"webpack-cli": "^5.0.1",
|
|
48
48
|
"webpack-dev-server": "^4.11.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"mona-dish": "^0.
|
|
51
|
+
"mona-dish": "^0.24.3"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -272,7 +272,14 @@ export module Implementation {
|
|
|
272
272
|
|
|
273
273
|
// spec conform behavior, all passthrough params must be under "passthrough
|
|
274
274
|
const params = remapArrayToAssocArr(options.getIf(CTX_OPTIONS_PARAMS).orElse({}).value);
|
|
275
|
-
|
|
275
|
+
//we turn off the remapping for the param merge, because we do not want to have
|
|
276
|
+
//any namespacing to be remapped
|
|
277
|
+
|
|
278
|
+
let ctxPassthrough = requestCtx.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;
|
|
279
|
+
ctxPassthrough.$nspEnabled = false;
|
|
280
|
+
ctxPassthrough.shallowMerge(new Config(params), true);
|
|
281
|
+
//now we turn it on again
|
|
282
|
+
ctxPassthrough.$nspEnabled = true;
|
|
276
283
|
requestCtx.assignIf(!!event, CTX_PARAM_REQ_PASS_THR, P_EVT).value = event?.type;
|
|
277
284
|
|
|
278
285
|
/**
|
|
@@ -530,7 +537,7 @@ export module Implementation {
|
|
|
530
537
|
*
|
|
531
538
|
* adds a new request to our queue for further processing
|
|
532
539
|
*/
|
|
533
|
-
addRequestToQueue: function (elem: DQ, form: DQ, reqCtx:
|
|
540
|
+
addRequestToQueue: function (elem: DQ, form: DQ, reqCtx: ExtConfig, respPassThr: Config, delay = 0, timeout = 0) {
|
|
534
541
|
requestQueue = requestQueue ?? new AsynchronousQueue<XhrRequest>();
|
|
535
542
|
requestQueue.enqueue(new XhrRequest(elem, form, reqCtx, respPassThr, [], timeout), delay);
|
|
536
543
|
}
|
|
@@ -638,13 +645,13 @@ export module Implementation {
|
|
|
638
645
|
const hasLeadingSep = componentIdToTransform.indexOf(SEP) === 0;
|
|
639
646
|
const isAbsolutSearchExpr = hasLeadingSep || (rootNamingContainerId.length
|
|
640
647
|
&& componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0);
|
|
641
|
-
|
|
648
|
+
let finalIdentifier = "";
|
|
642
649
|
if (isAbsolutSearchExpr) {
|
|
643
650
|
//we cut off the leading sep if there is one
|
|
644
651
|
componentIdToTransform = hasLeadingSep ? componentIdToTransform.substring(1) : componentIdToTransform;
|
|
645
652
|
componentIdToTransform = componentIdToTransform.indexOf(rootNamingContainerPrefix) == 0 ? componentIdToTransform.substring(rootNamingContainerPrefix.length) : componentIdToTransform;
|
|
646
653
|
//now we prepend either the prefix or "" from the cut-off string to get the final result
|
|
647
|
-
|
|
654
|
+
finalIdentifier = [rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);
|
|
648
655
|
} else { //relative search according to the javadoc
|
|
649
656
|
//we cut off the root naming container id from the form
|
|
650
657
|
if (formClientId.indexOf(rootNamingContainerPrefix) == 0) {
|
|
@@ -653,10 +660,15 @@ export module Implementation {
|
|
|
653
660
|
|
|
654
661
|
//If prependId = true, the outer form id must be present in the id if same form
|
|
655
662
|
let hasPrependId = componentIdToTransform.indexOf(formClientId) == 0;
|
|
656
|
-
|
|
663
|
+
finalIdentifier = hasPrependId ?
|
|
657
664
|
[rootNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR) :
|
|
658
665
|
[nearestNamingContainerPrefix, componentIdToTransform].join(EMPTY_STR);
|
|
659
666
|
}
|
|
667
|
+
// We need to double check because we have scenarios where we have a naming container
|
|
668
|
+
// and no prepend (aka tobago testcase "must handle ':' in IDs properly", scenario 3,
|
|
669
|
+
// in this case we return the component id, and be happy
|
|
670
|
+
// we can roll a dom check here
|
|
671
|
+
return (!!document.getElementById(finalIdentifier)) ? finalIdentifier : componentIdToTransform;
|
|
660
672
|
};
|
|
661
673
|
|
|
662
674
|
// in this case we do not use lazy stream because it wont bring any code reduction
|
|
@@ -257,6 +257,8 @@ export const ExtDQ = ExtDomQuery;
|
|
|
257
257
|
*/
|
|
258
258
|
export class ExtConfig extends Config {
|
|
259
259
|
|
|
260
|
+
$nspEnabled = true;
|
|
261
|
+
|
|
260
262
|
constructor(root: any) {
|
|
261
263
|
super(root);
|
|
262
264
|
}
|
|
@@ -326,7 +328,10 @@ export class ExtConfig extends Config {
|
|
|
326
328
|
* @param accessPath the access paths to be remapped
|
|
327
329
|
* @private returns an array of access paths with version remapped namespaces
|
|
328
330
|
*/
|
|
329
|
-
private remap(accessPath:
|
|
331
|
+
private remap(accessPath: string[]): string[] {
|
|
332
|
+
if(!this.$nspEnabled) {
|
|
333
|
+
return accessPath;
|
|
334
|
+
}
|
|
330
335
|
return Stream.of(...accessPath).map(key => $nsp(key)).collect(new ArrayCollector());
|
|
331
336
|
}
|
|
332
337
|
}
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
} from "../core/Const";
|
|
46
46
|
import {resolveFinalUrl, resolveHandlerFunc} from "./RequestDataResolver";
|
|
47
47
|
import failSaveExecute = ExtLang.failSaveExecute;
|
|
48
|
+
import {ExtConfig} from "../util/ExtDomQuery";
|
|
48
49
|
|
|
49
50
|
/**
|
|
50
51
|
* Faces XHR Request Wrapper
|
|
@@ -87,7 +88,7 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
87
88
|
constructor(
|
|
88
89
|
private source: DQ,
|
|
89
90
|
private sourceForm: DQ,
|
|
90
|
-
private requestContext:
|
|
91
|
+
private requestContext: ExtConfig,
|
|
91
92
|
private internalContext: Config,
|
|
92
93
|
private partialIdsArray = [],
|
|
93
94
|
private timeout = NO_TIMEOUT,
|
|
@@ -132,13 +133,20 @@ export class XhrRequest implements AsyncRunnable<XMLHttpRequest> {
|
|
|
132
133
|
this.contentType = formData.isMultipartRequest ? "undefined" : this.contentType;
|
|
133
134
|
|
|
134
135
|
// next step the pass through parameters are merged in for post params
|
|
136
|
+
this.requestContext.$nspEnabled = false;
|
|
135
137
|
let requestContext = this.requestContext;
|
|
136
|
-
let requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR);
|
|
137
|
-
|
|
138
|
+
let requestPassThroughParams = requestContext.getIf(CTX_PARAM_REQ_PASS_THR) as ExtConfig;
|
|
139
|
+
requestPassThroughParams.$nspEnabled = false;
|
|
138
140
|
// this is an extension where we allow pass through parameters to be sent down additionally
|
|
139
141
|
// this can be used and is used in the impl to enrich the post request parameters with additional
|
|
140
142
|
// information
|
|
141
|
-
|
|
143
|
+
|
|
144
|
+
try {
|
|
145
|
+
formData.shallowMerge(requestPassThroughParams, true, true);
|
|
146
|
+
} finally {
|
|
147
|
+
this.requestContext.$nspEnabled = true;
|
|
148
|
+
requestPassThroughParams.$nspEnabled = true;
|
|
149
|
+
}
|
|
142
150
|
|
|
143
151
|
this.responseContext = requestPassThroughParams.deepCopy;
|
|
144
152
|
|
|
@@ -90,6 +90,54 @@ export module StandardInits {
|
|
|
90
90
|
</html>`;
|
|
91
91
|
|
|
92
92
|
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* a page simulating basically a simple faces form
|
|
96
|
+
*/
|
|
97
|
+
const HTML_FORM_PREFIXED = `<!DOCTYPE html>
|
|
98
|
+
<html lang="en">
|
|
99
|
+
<head>
|
|
100
|
+
<meta charset="UTF-8">
|
|
101
|
+
<title>Title</title>
|
|
102
|
+
</head>
|
|
103
|
+
<body>
|
|
104
|
+
<form id="form1">
|
|
105
|
+
<input type="text" id="form1:input_1::field" name="form1:input_1" value="form1:input_1_val"></input>
|
|
106
|
+
<input type="hidden" id="form1:jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
|
|
107
|
+
<input type="button" id="form1:input_2::field" name="form1:input_2" value="form1:input_1_val"></input>
|
|
108
|
+
<input type="text" id="form1:input_3::field" name="form1:input_23 value="form1:input_1_val"></input>
|
|
109
|
+
</form>
|
|
110
|
+
</body>
|
|
111
|
+
</html>`;
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* a page simulating basically a simple faces form
|
|
117
|
+
*/
|
|
118
|
+
export const HTML_PREFIX_EMBEDDED_BODY = `<form id="form1">
|
|
119
|
+
<tobago-in id="page:input" class="tobago-auto-spacing">
|
|
120
|
+
<input type="text" name="page:input" id="page:input::field" class="form-control" value="input_value">
|
|
121
|
+
<tobago-behavior event="change" client-id="page:input" field-id="page:input::field" execute="page:input" render="page:output"></tobago-behavior>
|
|
122
|
+
</tobago-in>
|
|
123
|
+
|
|
124
|
+
<tobago-out id="page:output" class="tobago-auto-spacing">
|
|
125
|
+
<input type="text" name="page:output" id="page:output::field" class="form-control">
|
|
126
|
+
</tobago-out>
|
|
127
|
+
</form>`;
|
|
128
|
+
|
|
129
|
+
const HTML_FORM_PREFIXED_EMBEDDED = `<!DOCTYPE html>
|
|
130
|
+
<html lang="en">
|
|
131
|
+
<head>
|
|
132
|
+
<meta charset="UTF-8">
|
|
133
|
+
<title>Title</title>
|
|
134
|
+
</head>
|
|
135
|
+
<body>
|
|
136
|
+
${HTML_PREFIX_EMBEDDED_BODY}
|
|
137
|
+
</body>
|
|
138
|
+
</html>`;
|
|
139
|
+
|
|
140
|
+
|
|
93
141
|
const HTML_FORM_NAMESPACED = `<!DOCTYPE html>
|
|
94
142
|
<html lang="en">
|
|
95
143
|
<head>
|
|
@@ -321,6 +369,11 @@ export module StandardInits {
|
|
|
321
369
|
return <any>init((IS_40) ? PROTOCOL_PAGE : PROTOCOL_PAGE.replace(/jakarta/gi,"javax"), withJsf, IS_40);
|
|
322
370
|
}
|
|
323
371
|
|
|
372
|
+
export function prefixEmbeddedPage(withJsf = true, IS_40 = true): Promise<() => void> {
|
|
373
|
+
return <any>init((IS_40) ? HTML_FORM_PREFIXED_EMBEDDED : HTML_FORM_PREFIXED_EMBEDDED.replace(/jakarta/gi,"javax"), withJsf, IS_40);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
|
|
324
377
|
export function defaultSeparatorChar(separatorChar: string, withJsf = true, IS_40 = true): Promise<() => void> {
|
|
325
378
|
let template = HTML_DEFAULT_SEPARATOR_CHAR(separatorChar, IS_40);
|
|
326
379
|
return init(template, withJsf);
|
|
@@ -82,9 +82,10 @@ describe('Namespacing tests', function () {
|
|
|
82
82
|
it('must send the element identifiers properly encoded', function () {
|
|
83
83
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
84
84
|
try {
|
|
85
|
+
global["debug3"] = true;
|
|
85
86
|
faces.ajax.request(document.getElementById("jd_0:input_2"), null, {
|
|
86
87
|
execute: ":input_1",
|
|
87
|
-
render: ":blarg :
|
|
88
|
+
render: ":blarg :input_2",
|
|
88
89
|
params: {
|
|
89
90
|
pass1: "pass1",
|
|
90
91
|
pass2: "pass2"
|
|
@@ -108,7 +109,7 @@ describe('Namespacing tests', function () {
|
|
|
108
109
|
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
109
110
|
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
110
111
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
111
|
-
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:
|
|
112
|
+
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
|
|
112
113
|
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
113
114
|
} finally {
|
|
114
115
|
send.restore();
|
|
@@ -120,7 +121,7 @@ describe('Namespacing tests', function () {
|
|
|
120
121
|
try {
|
|
121
122
|
faces.ajax.request(document.getElementById("jd_0:input_2"), null, {
|
|
122
123
|
execute: "jd_0:input_1",
|
|
123
|
-
render: ":blarg jd_0:
|
|
124
|
+
render: ":blarg jd_0:input_2",
|
|
124
125
|
params: {
|
|
125
126
|
pass1: "pass1",
|
|
126
127
|
pass2: "pass2"
|
|
@@ -144,7 +145,7 @@ describe('Namespacing tests', function () {
|
|
|
144
145
|
expect(P_VIEWSTATE in resultsMap).to.be.true;
|
|
145
146
|
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
146
147
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
147
|
-
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:
|
|
148
|
+
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
|
|
148
149
|
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
149
150
|
} finally {
|
|
150
151
|
send.restore();
|
|
@@ -160,7 +161,7 @@ describe('Namespacing tests', function () {
|
|
|
160
161
|
|
|
161
162
|
faces.ajax.request(document.getElementById("jd_0:input_2"), null, {
|
|
162
163
|
execute: "jd_0:input_1",
|
|
163
|
-
render: ":blarg jd_0:
|
|
164
|
+
render: ":blarg jd_0:input_2",
|
|
164
165
|
params: {
|
|
165
166
|
pass1: "pass1",
|
|
166
167
|
pass2: "pass2"
|
|
@@ -185,7 +186,7 @@ describe('Namespacing tests', function () {
|
|
|
185
186
|
expect(resultsMap[P_VIEWSTATE]).to.eq("booga");
|
|
186
187
|
expect(resultsMap[P_PARTIAL_SOURCE]).to.eq(escape("jd_0:input_2"));
|
|
187
188
|
expect(resultsMap[P_AJAX]).to.eq("true");
|
|
188
|
-
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:
|
|
189
|
+
expect(resultsMap[P_RENDER]).to.eq(escape("jd_0:blarg jd_0:input_2"));
|
|
189
190
|
expect(resultsMap[P_EXECUTE]).to.eq(escape("jd_0:input_1 jd_0:input_2"));
|
|
190
191
|
} finally {
|
|
191
192
|
send.restore();
|
|
@@ -20,7 +20,11 @@ import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
|
20
20
|
import protocolPage = StandardInits.protocolPage;
|
|
21
21
|
import {DQ} from "mona-dish";
|
|
22
22
|
import {XhrFormData} from "../../impl/xhrCore/XhrFormData";
|
|
23
|
-
import {
|
|
23
|
+
import {expect} from "chai";
|
|
24
|
+
import prefixPage = StandardInits.prefixEmbeddedPage;
|
|
25
|
+
import prefixEmbeddedPage = StandardInits.prefixEmbeddedPage;
|
|
26
|
+
import HTML_PREFIX_EMBEDDED_BODY = StandardInits.HTML_PREFIX_EMBEDDED_BODY;
|
|
27
|
+
import {it} from "mocha";
|
|
24
28
|
|
|
25
29
|
describe("test for proper request param patterns identical to the old implementation", function () {
|
|
26
30
|
const UPDATE_INSERT_2 = {
|
|
@@ -35,12 +39,12 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
35
39
|
/**
|
|
36
40
|
* matches two maps for absolute identicality
|
|
37
41
|
*/
|
|
38
|
-
let matches = (item1: {[key: string]: any}, item2: {[key: string]: any}): boolean => {
|
|
39
|
-
if(Object.keys(item1).length != Object.keys(item2).length) {
|
|
42
|
+
let matches = (item1: { [key: string]: any }, item2: { [key: string]: any }): boolean => {
|
|
43
|
+
if (Object.keys(item1).length != Object.keys(item2).length) {
|
|
40
44
|
return false;
|
|
41
45
|
}
|
|
42
|
-
for(let key in item1) {
|
|
43
|
-
if((!(key in item2)) || item1[key] != item2[key]) {
|
|
46
|
+
for (let key in item1) {
|
|
47
|
+
if ((!(key in item2)) || item1[key] != item2[key]) {
|
|
44
48
|
return false;
|
|
45
49
|
}
|
|
46
50
|
}
|
|
@@ -77,7 +81,7 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
77
81
|
this.closeIt();
|
|
78
82
|
});
|
|
79
83
|
|
|
80
|
-
it("must pass updateinsert2 with proper parameters", function() {
|
|
84
|
+
it("must pass updateinsert2 with proper parameters", function () {
|
|
81
85
|
DQ.byId("cmd_update_insert2").click();
|
|
82
86
|
|
|
83
87
|
let requestBody = this.requests[0].requestBody;
|
|
@@ -88,7 +92,7 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
88
92
|
});
|
|
89
93
|
|
|
90
94
|
|
|
91
|
-
it("must handle base64 encoded strings properly as request data", function() {
|
|
95
|
+
it("must handle base64 encoded strings properly as request data", function () {
|
|
92
96
|
let probe = "YWFhYWFhc1Rlc3RpdCDDpGtvNDU5NjczMDA9PSsrNDU5MGV3b3UkJiUmLyQmJQ==";
|
|
93
97
|
DQ.byId("jakarta.faces.ViewState").inputValue.value = probe;
|
|
94
98
|
DQ.byId("cmd_update_insert2").click();
|
|
@@ -100,7 +104,7 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
100
104
|
});
|
|
101
105
|
|
|
102
106
|
|
|
103
|
-
it("must handle empty parameters properly", function() {
|
|
107
|
+
it("must handle empty parameters properly", function () {
|
|
104
108
|
let probe = "";
|
|
105
109
|
DQ.byId("jakarta.faces.ViewState").inputValue.value = probe;
|
|
106
110
|
DQ.byId("cmd_update_insert2").click();
|
|
@@ -113,7 +117,7 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
113
117
|
|
|
114
118
|
//KssbpZfCe+0lwDhgMRQ44wRFkaM1o1lbMMUO3lini5YhXWm6
|
|
115
119
|
|
|
116
|
-
it("must handle base64 special cases properly (+ in encoding)", function() {
|
|
120
|
+
it("must handle base64 special cases properly (+ in encoding)", function () {
|
|
117
121
|
let probe = "KssbpZfCe+0lwDhgMRQ44wRFkaM1o1lbMMUO3lini5YhXWm6";
|
|
118
122
|
DQ.byId("jakarta.faces.ViewState").inputValue.value = probe;
|
|
119
123
|
DQ.byId("cmd_update_insert2").click();
|
|
@@ -123,4 +127,107 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
123
127
|
|
|
124
128
|
expect(decodeURIComponent(formData.getIf("jakarta.faces.ViewState").value) == probe).to.be.true;
|
|
125
129
|
});
|
|
130
|
+
|
|
131
|
+
it("must handle prefixed inputs properly (prefixes must be present) faces4", function (done) {
|
|
132
|
+
window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
|
|
133
|
+
|
|
134
|
+
//we now run the tests here
|
|
135
|
+
try {
|
|
136
|
+
|
|
137
|
+
let event = {
|
|
138
|
+
isTrusted: true,
|
|
139
|
+
type: 'change',
|
|
140
|
+
target: document.getElementById("page:input::field"),
|
|
141
|
+
currentTarget: document.getElementById("page:input::field")
|
|
142
|
+
};
|
|
143
|
+
faces.ajax.request(document.getElementById("page:input"), event as any, {
|
|
144
|
+
render: "page:output",
|
|
145
|
+
execute: "page:input",
|
|
146
|
+
params: {
|
|
147
|
+
"booga2.xxx": "yyy",
|
|
148
|
+
"javax.faces.behavior.event": "change",
|
|
149
|
+
"booga": "bla"
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
} catch (err) {
|
|
153
|
+
console.error(err);
|
|
154
|
+
expect(false).to.eq(true);
|
|
155
|
+
}
|
|
156
|
+
const requestBody = this.requests[0].requestBody;
|
|
157
|
+
//We check if the base64 encoded string matches the original
|
|
158
|
+
expect(requestBody.indexOf("javax.faces.behavior.event")).to.not.eq(-1);
|
|
159
|
+
expect(requestBody.indexOf("javax.faces.behavior.event=change")).to.not.eq(-1);
|
|
160
|
+
expect(requestBody.indexOf("page%3Ainput=input_value")).to.not.eq(-1);
|
|
161
|
+
done();
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* This test is based on Tobago 6 (Jakarte EE 9).
|
|
169
|
+
*/
|
|
170
|
+
it("must handle ':' in IDs properly", function (done) {
|
|
171
|
+
window.document.body.innerHTML = `
|
|
172
|
+
|
|
173
|
+
<tobago-page locale="en" class="container-fluid" id="page" focus-on-error="true" wait-overlay-delay-full="1000" wait-overlay-delay-ajax="1000">
|
|
174
|
+
<form action="/content/010-input/10-in/In.xhtml?jfwid=q6qbeuqed" id="page::form" method="post" accept-charset="UTF-8" data-tobago-context-path="">
|
|
175
|
+
<input type="hidden" name="jakarta.faces.source" id="jakarta.faces.source" disabled="disabled">
|
|
176
|
+
<tobago-focus id="page::lastFocusId">
|
|
177
|
+
<input type="hidden" name="page::lastFocusId" id="page::lastFocusId::field">
|
|
178
|
+
</tobago-focus>
|
|
179
|
+
<input type="hidden" name="org.apache.myfaces.tobago.webapp.Secret" id="org.apache.myfaces.tobago.webapp.Secret" value="secretValue">
|
|
180
|
+
<tobago-in id="page:input" class="tobago-auto-spacing">
|
|
181
|
+
<input type="text" name="page:input" id="page:input::field" class="form-control" value="Bob">
|
|
182
|
+
<tobago-behavior event="change" client-id="page:input" field-id="page:input::field" execute="page:input" render="page:output"></tobago-behavior>
|
|
183
|
+
</tobago-in>
|
|
184
|
+
<tobago-out id="page:output" class="tobago-auto-spacing">
|
|
185
|
+
<span class="form-control-plaintext"></span>
|
|
186
|
+
</tobago-out>
|
|
187
|
+
<div class="tobago-page-menuStore">
|
|
188
|
+
</div>
|
|
189
|
+
<span id="page::faces-state-container">
|
|
190
|
+
<input type="hidden" name="jakarta.faces.ViewState" id="j_id__v_0:jakarta.faces.ViewState:1" value="viewStateValue" autocomplete="off">
|
|
191
|
+
<input type="hidden" name="jakarta.faces.RenderKitId" value="tobago">
|
|
192
|
+
<input type="hidden" id="j_id__v_0:jakarta.faces.ClientWindow:1" name="jakarta.faces.ClientWindow" value="clientWindowValue">
|
|
193
|
+
</span>
|
|
194
|
+
</form>
|
|
195
|
+
</tobago-page>
|
|
196
|
+
`;
|
|
197
|
+
|
|
198
|
+
//we now run the tests here
|
|
199
|
+
try {
|
|
200
|
+
|
|
201
|
+
let event = {
|
|
202
|
+
isTrusted: true,
|
|
203
|
+
type: 'change',
|
|
204
|
+
target: document.getElementById("page:input::field"),
|
|
205
|
+
currentTarget: document.getElementById("page:input::field")
|
|
206
|
+
};
|
|
207
|
+
global.debug2 = true;
|
|
208
|
+
faces.ajax.request(document.getElementById("page:input"), event as any, {
|
|
209
|
+
"jakarta.faces.behavior.event": 'change',
|
|
210
|
+
execute: "page:input",
|
|
211
|
+
render: "page:output"
|
|
212
|
+
});
|
|
213
|
+
} catch (err) {
|
|
214
|
+
console.error(err);
|
|
215
|
+
expect(false).to.eq(true);
|
|
216
|
+
}
|
|
217
|
+
const requestBody = this.requests[0].requestBody;
|
|
218
|
+
expect(requestBody.indexOf("org.apache.myfaces.tobago.webapp.Secret=secretValue")).to.not.eq(-1);
|
|
219
|
+
expect(requestBody.indexOf("page%3Ainput=Bob")).to.not.eq(-1);
|
|
220
|
+
expect(requestBody.indexOf("jakarta.faces.ViewState=viewStateValue")).to.not.eq(-1);
|
|
221
|
+
expect(requestBody.indexOf("jakarta.faces.RenderKitId=tobago")).to.not.eq(-1);
|
|
222
|
+
expect(requestBody.indexOf("jakarta.faces.ClientWindow=clientWindowValue")).to.not.eq(-1);
|
|
223
|
+
expect(requestBody.indexOf("jakarta.faces.behavior.event=change")).to.not.eq(-1);
|
|
224
|
+
expect(requestBody.indexOf("jakarta.faces.partial.event=change")).to.not.eq(-1);
|
|
225
|
+
expect(requestBody.indexOf("jakarta.faces.source=page%3Ainput")).to.not.eq(-1);
|
|
226
|
+
expect(requestBody.indexOf("jakarta.faces.partial.ajax=true")).to.not.eq(-1);
|
|
227
|
+
expect(requestBody.indexOf("page%3A%3Aform=page%3A%3Aform")).to.not.eq(-1);
|
|
228
|
+
expect(requestBody.indexOf("jakarta.faces.partial.execute=page%3Ainput")).to.not.eq(-1);
|
|
229
|
+
expect(requestBody.indexOf("jakarta.faces.partial.render=page%3Aoutput")).to.not.eq(-1);
|
|
230
|
+
done();
|
|
231
|
+
});
|
|
232
|
+
|
|
126
233
|
});
|
|
@@ -65,6 +65,7 @@ let {
|
|
|
65
65
|
|
|
66
66
|
import STD_XML = StandardInits.STD_XML;
|
|
67
67
|
import defaultMyFaces23 = StandardInits.defaultMyFaces23;
|
|
68
|
+
import HTML_PREFIX_EMBEDDED_BODY = StandardInits.HTML_PREFIX_EMBEDDED_BODY;
|
|
68
69
|
|
|
69
70
|
declare var jsf: any;
|
|
70
71
|
declare var Implementation: any;
|
|
@@ -360,5 +361,40 @@ describe('Tests after core when it hits response', function () {
|
|
|
360
361
|
}
|
|
361
362
|
|
|
362
363
|
});
|
|
364
|
+
|
|
365
|
+
it("must handle prefixed inputs properly (prefixes must be present)", function (done) {
|
|
366
|
+
window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
|
|
367
|
+
|
|
368
|
+
//we now run the tests here
|
|
369
|
+
try {
|
|
370
|
+
|
|
371
|
+
let event = {
|
|
372
|
+
isTrusted: true,
|
|
373
|
+
type: 'change',
|
|
374
|
+
target: document.getElementById("page:input::field"),
|
|
375
|
+
currentTarget: document.getElementById("page:input::field")
|
|
376
|
+
};
|
|
377
|
+
jsf.ajax.request(document.getElementById("page:input"), event as any, {
|
|
378
|
+
render: "page:output",
|
|
379
|
+
execute: "page:input",
|
|
380
|
+
params: {
|
|
381
|
+
"booga2.xxx": "yyy",
|
|
382
|
+
"javax.faces.behavior.event": "change",
|
|
383
|
+
"booga": "bla"
|
|
384
|
+
},
|
|
385
|
+
});
|
|
386
|
+
} catch (err) {
|
|
387
|
+
console.error(err);
|
|
388
|
+
expect(false).to.eq(true);
|
|
389
|
+
}
|
|
390
|
+
const requestBody = this.requests[0].requestBody;
|
|
391
|
+
//We check if the base64 encoded string matches the original
|
|
392
|
+
expect(requestBody.indexOf("javax.faces.behavior.event")).to.not.eq(-1);
|
|
393
|
+
expect(requestBody.indexOf("javax.faces.behavior.event=change")).to.not.eq(-1);
|
|
394
|
+
expect(requestBody.indexOf("page%3Ainput=input_value")).to.not.eq(-1);
|
|
395
|
+
done();
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
|
|
363
399
|
});
|
|
364
400
|
|
|
@@ -516,7 +516,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
516
516
|
</partial-response>`
|
|
517
517
|
|
|
518
518
|
window.document.body.innerHTML = INNER_HTML_MULIT_VIEW;
|
|
519
|
-
|
|
519
|
+
global["debug4"] = true;
|
|
520
520
|
faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
|
|
521
521
|
"javax.faces.behavior.event": "change",
|
|
522
522
|
execute: "submit_1",
|
|
@@ -24,6 +24,8 @@ import {expect} from "chai";
|
|
|
24
24
|
import protocolPage = StandardInits.protocolPage;
|
|
25
25
|
import {DQ, DQ$} from "mona-dish";
|
|
26
26
|
import {$nsp} from "../../impl/core/Const";
|
|
27
|
+
import STD_XML = StandardInits.STD_XML;
|
|
28
|
+
import HTML_PREFIX_EMBEDDED_BODY = StandardInits.HTML_PREFIX_EMBEDDED_BODY;
|
|
27
29
|
|
|
28
30
|
|
|
29
31
|
declare var jsf: any;
|
|
@@ -358,7 +360,37 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
358
360
|
});
|
|
359
361
|
|
|
360
362
|
|
|
363
|
+
it("must pass named params properly (tobago testcase)", function(done) {
|
|
364
|
+
window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;
|
|
365
|
+
try {
|
|
366
|
+
|
|
367
|
+
let event = {
|
|
368
|
+
isTrusted: true,
|
|
369
|
+
type: 'change',
|
|
370
|
+
target: document.getElementById("page:input::field"),
|
|
371
|
+
currentTarget: document.getElementById("page:input::field")
|
|
372
|
+
};
|
|
373
|
+
jsf.ajax.request(document.getElementById("page:input"), event as any, {
|
|
374
|
+
render: "page:output",
|
|
375
|
+
execute: "page:input",
|
|
376
|
+
params: {
|
|
377
|
+
"booga2.xxx": "yyy",
|
|
378
|
+
"javax.faces.behavior.event": "change",
|
|
379
|
+
"booga": "bla"
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
} catch (err) {
|
|
383
|
+
console.error(err);
|
|
384
|
+
expect(false).to.eq(true);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const requestBody = this.requests[0].requestBody;
|
|
388
|
+
expect(requestBody.indexOf("javax.faces.behavior.event")).to.not.eq(-1);
|
|
389
|
+
expect(requestBody.indexOf("javax.faces.behavior.event=change")).to.not.eq(-1);
|
|
390
|
+
expect(requestBody.indexOf("page%3Ainput=input_value")).to.not.eq(-1);
|
|
391
|
+
done();
|
|
361
392
|
|
|
393
|
+
});
|
|
362
394
|
|
|
363
395
|
|
|
364
396
|
});
|