jsf.js_next_gen 4.0.2-beta.4 → 4.0.2-beta.6
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 +101 -23
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +101 -23
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.map +1 -1
- package/package.json +2 -2
- package/src/main/typescript/impl/util/FileUtils.ts +3 -2
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +184 -1
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +126 -4
- package/target/classes/application.properties +1 -0
- 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/util/FileUtils.js +3 -2
- package/target/impl/util/FileUtils.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +176 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +112 -3
- package/target/test/xhrCore/RequestTest.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsf.js_next_gen",
|
|
3
|
-
"version": "4.0.2-beta.
|
|
3
|
+
"version": "4.0.2-beta.6",
|
|
4
4
|
"description": "A next generation typescript reimplementation of jsf.js",
|
|
5
5
|
"main": "dist/window/faces.js",
|
|
6
6
|
"scripts": {
|
|
@@ -48,6 +48,6 @@
|
|
|
48
48
|
"webpack-dev-server": "^4.15.1"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"mona-dish": "0.28.
|
|
51
|
+
"mona-dish": "0.28.11"
|
|
52
52
|
}
|
|
53
53
|
}
|
|
@@ -41,7 +41,8 @@ export function encodeFormData(formData: Config,
|
|
|
41
41
|
*/
|
|
42
42
|
export function decodeEncodedValues(encoded: string): string[][] {
|
|
43
43
|
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
|
|
44
|
-
const splitKeyValuePair =
|
|
44
|
+
const splitKeyValuePair = _line => {
|
|
45
|
+
let line = decodeURIComponent(_line);
|
|
45
46
|
let index = line.indexOf("=");
|
|
46
47
|
if (index == -1) {
|
|
47
48
|
return [line];
|
|
@@ -49,7 +50,7 @@ export function decodeEncodedValues(encoded: string): string[][] {
|
|
|
49
50
|
return [line.substring(0, index), line.substring(index + 1)];
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
let requestParamEntries =
|
|
53
|
+
let requestParamEntries = encoded.split(/&/gi);
|
|
53
54
|
return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);
|
|
54
55
|
}
|
|
55
56
|
|
|
@@ -265,4 +265,187 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
265
265
|
done();
|
|
266
266
|
});
|
|
267
267
|
|
|
268
|
-
|
|
268
|
+
/**
|
|
269
|
+
* This test is based on Tobago 6.0.0 (Jakarte EE 10).
|
|
270
|
+
*/
|
|
271
|
+
it("tobago tree select", function (done) {
|
|
272
|
+
window.document.body.innerHTML = `
|
|
273
|
+
<tobago-page locale='de' class='container-fluid' id='page' focus-on-error='true' wait-overlay-delay-full='1000' wait-overlay-delay-ajax='1000'>
|
|
274
|
+
<form action='/content/090-tree/01-select/Tree_Select.xhtml' id='page::form' method='post' accept-charset='UTF-8' data-tobago-context-path=''>
|
|
275
|
+
<input type='hidden' name='jakarta.faces.source' id='jakarta.faces.source' disabled='disabled'>
|
|
276
|
+
<tobago-focus id='page::lastFocusId'>
|
|
277
|
+
<input type='hidden' name='page::lastFocusId' id='page::lastFocusId::field'>
|
|
278
|
+
</tobago-focus>
|
|
279
|
+
<input type='hidden' name='org.apache.myfaces.tobago.webapp.Secret' id='org.apache.myfaces.tobago.webapp.Secret' value='secretValue'>
|
|
280
|
+
<div class='tobago-page-menuStore'>
|
|
281
|
+
</div>
|
|
282
|
+
<div class='tobago-page-toastStore'>
|
|
283
|
+
</div>
|
|
284
|
+
<span id='page::faces-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>
|
|
285
|
+
<tobago-tree id='page:categoriesTree' data-tobago-selectable='multi' selectable='multi'>
|
|
286
|
+
<tobago-tree-node id='page:categoriesTree:0:j_id_3' class='tobago-folder tobago-expanded' expandable='expandable' index='0' data-tobago-level='0'>
|
|
287
|
+
<span id='page:categoriesTree:0:j_id_4' class='tobago-toggle'><i class='bi-dash-square' data-tobago-open='bi-dash-square' data-tobago-closed='bi-plus-square'></i></span>
|
|
288
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
289
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:0:select' value='page:categoriesTree:0:select' id='page:categoriesTree:0:select'>
|
|
290
|
+
<label class='form-check-label' for='page:categoriesTree:0:select'>Category</label>
|
|
291
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:0:select' execute='page:categoriesTree:0:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
292
|
+
</tobago-tree-select>
|
|
293
|
+
</tobago-tree-node>
|
|
294
|
+
<tobago-tree-node id='page:categoriesTree:1:j_id_3' index='1' data-tobago-tree-parent='page:categoriesTree:0:j_id_3' parent='page:categoriesTree:0:j_id_3' data-tobago-level='1'>
|
|
295
|
+
<span id='page:categoriesTree:1:j_id_4' class='tobago-toggle invisible'><i class='bi-square invisible'></i></span>
|
|
296
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
297
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:1:select' value='page:categoriesTree:1:select' id='page:categoriesTree:1:select'>
|
|
298
|
+
<label class='form-check-label' for='page:categoriesTree:1:select'>Sports</label>
|
|
299
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:1:select' execute='page:categoriesTree:1:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
300
|
+
</tobago-tree-select>
|
|
301
|
+
</tobago-tree-node>
|
|
302
|
+
<tobago-tree-node id='page:categoriesTree:2:j_id_3' index='2' data-tobago-tree-parent='page:categoriesTree:0:j_id_3' parent='page:categoriesTree:0:j_id_3' data-tobago-level='1'>
|
|
303
|
+
<span id='page:categoriesTree:2:j_id_4' class='tobago-toggle invisible'><i class='bi-square invisible'></i></span>
|
|
304
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
305
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:2:select' value='page:categoriesTree:2:select' id='page:categoriesTree:2:select'>
|
|
306
|
+
<label class='form-check-label' for='page:categoriesTree:2:select'>Movies</label>
|
|
307
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:2:select' execute='page:categoriesTree:2:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
308
|
+
</tobago-tree-select>
|
|
309
|
+
</tobago-tree-node>
|
|
310
|
+
<tobago-tree-node id='page:categoriesTree:3:j_id_3' class='tobago-selected tobago-folder tobago-expanded' selected='selected' expandable='expandable' index='3' data-tobago-tree-parent='page:categoriesTree:0:j_id_3' parent='page:categoriesTree:0:j_id_3' data-tobago-level='1'>
|
|
311
|
+
<span id='page:categoriesTree:3:j_id_4' class='tobago-toggle'><i class='bi-dash-square' data-tobago-open='bi-dash-square' data-tobago-closed='bi-plus-square'></i></span>
|
|
312
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
313
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:3:select' value='page:categoriesTree:3:select' id='page:categoriesTree:3:select' checked='checked'>
|
|
314
|
+
<label class='form-check-label' for='page:categoriesTree:3:select'>Music</label>
|
|
315
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:3:select' execute='page:categoriesTree:3:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
316
|
+
</tobago-tree-select>
|
|
317
|
+
</tobago-tree-node>
|
|
318
|
+
<tobago-tree-node id='page:categoriesTree:4:j_id_3' index='4' data-tobago-tree-parent='page:categoriesTree:3:j_id_3' parent='page:categoriesTree:3:j_id_3' data-tobago-level='2'>
|
|
319
|
+
<span id='page:categoriesTree:4:j_id_4' class='tobago-toggle invisible'><i class='bi-square invisible'></i></span>
|
|
320
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
321
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:4:select' value='page:categoriesTree:4:select' id='page:categoriesTree:4:select'>
|
|
322
|
+
<label class='form-check-label' for='page:categoriesTree:4:select'>Classic</label>
|
|
323
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:4:select' execute='page:categoriesTree:4:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
324
|
+
</tobago-tree-select>
|
|
325
|
+
</tobago-tree-node>
|
|
326
|
+
<tobago-tree-node id='page:categoriesTree:5:j_id_3' index='5' data-tobago-tree-parent='page:categoriesTree:3:j_id_3' parent='page:categoriesTree:3:j_id_3' data-tobago-level='2'>
|
|
327
|
+
<span id='page:categoriesTree:5:j_id_4' class='tobago-toggle invisible'><i class='bi-square invisible'></i></span>
|
|
328
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
329
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:5:select' value='page:categoriesTree:5:select' id='page:categoriesTree:5:select'>
|
|
330
|
+
<label class='form-check-label' for='page:categoriesTree:5:select'>Pop</label>
|
|
331
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:5:select' execute='page:categoriesTree:5:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
332
|
+
</tobago-tree-select>
|
|
333
|
+
</tobago-tree-node>
|
|
334
|
+
<tobago-tree-node id='page:categoriesTree:6:j_id_3' class='tobago-folder' expandable='expandable' index='6' data-tobago-tree-parent='page:categoriesTree:3:j_id_3' parent='page:categoriesTree:3:j_id_3' data-tobago-level='2'>
|
|
335
|
+
<span id='page:categoriesTree:6:j_id_4' class='tobago-toggle'><i class='bi-plus-square' data-tobago-open='bi-dash-square' data-tobago-closed='bi-plus-square'></i></span>
|
|
336
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
337
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:6:select' value='page:categoriesTree:6:select' id='page:categoriesTree:6:select'>
|
|
338
|
+
<label class='form-check-label' for='page:categoriesTree:6:select'>World</label>
|
|
339
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:6:select' execute='page:categoriesTree:6:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
340
|
+
</tobago-tree-select>
|
|
341
|
+
</tobago-tree-node>
|
|
342
|
+
<tobago-tree-node id='page:categoriesTree:7:j_id_3' index='7' data-tobago-tree-parent='page:categoriesTree:0:j_id_3' parent='page:categoriesTree:0:j_id_3' data-tobago-level='1'>
|
|
343
|
+
<span id='page:categoriesTree:7:j_id_4' class='tobago-toggle invisible'><i class='bi-square invisible'></i></span>
|
|
344
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
345
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:7:select' value='page:categoriesTree:7:select' id='page:categoriesTree:7:select'>
|
|
346
|
+
<label class='form-check-label' for='page:categoriesTree:7:select'>Games</label>
|
|
347
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:7:select' execute='page:categoriesTree:7:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
348
|
+
</tobago-tree-select>
|
|
349
|
+
</tobago-tree-node>
|
|
350
|
+
<tobago-tree-node id='page:categoriesTree:8:j_id_3' class='tobago-folder tobago-expanded' expandable='expandable' index='8' data-tobago-tree-parent='page:categoriesTree:0:j_id_3' parent='page:categoriesTree:0:j_id_3' data-tobago-level='1'>
|
|
351
|
+
<span id='page:categoriesTree:8:j_id_4' class='tobago-toggle'><i class='bi-dash-square' data-tobago-open='bi-dash-square' data-tobago-closed='bi-plus-square'></i></span>
|
|
352
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
353
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:8:select' value='page:categoriesTree:8:select' id='page:categoriesTree:8:select'>
|
|
354
|
+
<label class='form-check-label' for='page:categoriesTree:8:select'>Science</label>
|
|
355
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:8:select' execute='page:categoriesTree:8:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
356
|
+
</tobago-tree-select>
|
|
357
|
+
</tobago-tree-node>
|
|
358
|
+
<tobago-tree-node id='page:categoriesTree:9:j_id_3' class='tobago-folder' expandable='expandable' index='9' data-tobago-tree-parent='page:categoriesTree:8:j_id_3' parent='page:categoriesTree:8:j_id_3' data-tobago-level='2'>
|
|
359
|
+
<span id='page:categoriesTree:9:j_id_4' class='tobago-toggle'><i class='bi-plus-square' data-tobago-open='bi-dash-square' data-tobago-closed='bi-plus-square'></i></span>
|
|
360
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
361
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:9:select' value='page:categoriesTree:9:select' id='page:categoriesTree:9:select'>
|
|
362
|
+
<label class='form-check-label' for='page:categoriesTree:9:select'>Mathematics</label>
|
|
363
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:9:select' execute='page:categoriesTree:9:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
364
|
+
</tobago-tree-select>
|
|
365
|
+
</tobago-tree-node>
|
|
366
|
+
<tobago-tree-node id='page:categoriesTree:10:j_id_3' index='10' data-tobago-tree-parent='page:categoriesTree:8:j_id_3' parent='page:categoriesTree:8:j_id_3' data-tobago-level='2'>
|
|
367
|
+
<span id='page:categoriesTree:10:j_id_4' class='tobago-toggle invisible'><i class='bi-square invisible'></i></span>
|
|
368
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
369
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:10:select' value='page:categoriesTree:10:select' id='page:categoriesTree:10:select'>
|
|
370
|
+
<label class='form-check-label' for='page:categoriesTree:10:select'>Geography</label>
|
|
371
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:10:select' execute='page:categoriesTree:10:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
372
|
+
</tobago-tree-select>
|
|
373
|
+
</tobago-tree-node>
|
|
374
|
+
<tobago-tree-node id='page:categoriesTree:11:j_id_3' class='tobago-folder' expandable='expandable' index='11' data-tobago-tree-parent='page:categoriesTree:8:j_id_3' parent='page:categoriesTree:8:j_id_3' data-tobago-level='2'>
|
|
375
|
+
<span id='page:categoriesTree:11:j_id_4' class='tobago-toggle'><i class='bi-plus-square' data-tobago-open='bi-dash-square' data-tobago-closed='bi-plus-square'></i></span>
|
|
376
|
+
<tobago-tree-select class='form-check-inline form-check'>
|
|
377
|
+
<input class='form-check-input' type='checkbox' name='page:categoriesTree:11:select' value='page:categoriesTree:11:select' id='page:categoriesTree:11:select'>
|
|
378
|
+
<label class='form-check-label' for='page:categoriesTree:11:select'>Astronomy</label>
|
|
379
|
+
<tobago-behavior event='change' client-id='page:categoriesTree:11:select' execute='page:categoriesTree:11:select page:categoriesTree' render='page:selectedNodesOutput page:categoriesTree'></tobago-behavior>
|
|
380
|
+
</tobago-tree-select>
|
|
381
|
+
</tobago-tree-node>
|
|
382
|
+
<input type='hidden' name='page:categoriesTree::selected' id='page:categoriesTree::selected' class='tobago-selected' value='[3]'>
|
|
383
|
+
<input type='hidden' name='page:categoriesTree::expanded' id='page:categoriesTree::expanded' class='tobago-expanded' value='[0,3,8]'>
|
|
384
|
+
<tobago-scroll>
|
|
385
|
+
<input id='page:categoriesTree::scrollPosition' name='page:categoriesTree::scrollPosition' type='hidden' value='[0,0]' data-tobago-scroll-position='true'>
|
|
386
|
+
</tobago-scroll>
|
|
387
|
+
</tobago-tree>
|
|
388
|
+
<tobago-out id='page:selectedNodesOutput' class='tobago-label-container tobago-auto-spacing'><label for='page:selectedNodesOutput' class='col-form-label'>Selected Nodes</label><span class='form-control-plaintext'>Music</span></tobago-out>
|
|
389
|
+
</form>
|
|
390
|
+
<noscript>
|
|
391
|
+
<div class='tobago-page-noscript'>Diese Seite benötigt JavaScript, allerdings ist JavaScript in Ihrem Browser derzeit deaktiviert. Um JavaScript zu aktivieren, lesen Sie ggf. die Anleitung Ihres Browsers.
|
|
392
|
+
</div>
|
|
393
|
+
</noscript>
|
|
394
|
+
</tobago-page>
|
|
395
|
+
`;
|
|
396
|
+
|
|
397
|
+
//we now run the tests here
|
|
398
|
+
try {
|
|
399
|
+
let event = {
|
|
400
|
+
isTrusted: true,
|
|
401
|
+
type: 'change',
|
|
402
|
+
target: document.getElementById("page:categoriesTree:3:select"),
|
|
403
|
+
currentTarget: document.getElementById("page:categoriesTree:3:select")
|
|
404
|
+
};
|
|
405
|
+
global.debug2 = true;
|
|
406
|
+
faces.ajax.request(
|
|
407
|
+
document.getElementById("page:categoriesTree:3:select"),
|
|
408
|
+
event as any,
|
|
409
|
+
{
|
|
410
|
+
"jakarta.faces.behavior.event": "change",
|
|
411
|
+
execute: 'page:categoriesTree:3:select page:categoriesTree',
|
|
412
|
+
render: 'page:selectedNodesOutput page:categoriesTree'
|
|
413
|
+
});
|
|
414
|
+
} catch (err) {
|
|
415
|
+
console.error(err);
|
|
416
|
+
expect(false).to.eq(true);
|
|
417
|
+
}
|
|
418
|
+
const requestBody = this.requests[0].requestBody;
|
|
419
|
+
let arsArr = requestBody.split("&");
|
|
420
|
+
let resultsMap = {};
|
|
421
|
+
for (let val of arsArr) {
|
|
422
|
+
let keyVal = val.split("=");
|
|
423
|
+
|
|
424
|
+
if (resultsMap[keyVal[0]]) {
|
|
425
|
+
console.log("duplicated key '" + keyVal[0] + "'");
|
|
426
|
+
expect(resultsMap[keyVal[0]]).not.to.exist;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
expect(resultsMap[encodeURIComponent("page::lastFocusId")]).to.exist;
|
|
433
|
+
expect(resultsMap["org.apache.myfaces.tobago.webapp.Secret"]).to.eq("secretValue");
|
|
434
|
+
expect(resultsMap["jakarta.faces.ViewState"]).to.eq("viewStateValue");
|
|
435
|
+
expect(resultsMap["jakarta.faces.RenderKitId"]).to.eq("tobago");
|
|
436
|
+
expect(resultsMap["jakarta.faces.ClientWindow"]).to.eq("clientWindowValue");
|
|
437
|
+
expect(resultsMap[encodeURIComponent("page:categoriesTree::selected")]).to.eq(encodeURIComponent("[3]"));
|
|
438
|
+
expect(resultsMap[encodeURIComponent("page:categoriesTree::expanded")]).to.eq(encodeURIComponent("[0,3,8]"));
|
|
439
|
+
expect(resultsMap[encodeURIComponent("page:categoriesTree::scrollPosition")]).to.eq(encodeURIComponent("[0,0]"));
|
|
440
|
+
expect(resultsMap["jakarta.faces.behavior.event"]).to.eq("change");
|
|
441
|
+
expect(resultsMap["jakarta.faces.partial.event"]).to.eq("change");
|
|
442
|
+
expect(resultsMap["jakarta.faces.source"]).to.eq(encodeURIComponent("page:categoriesTree:3:select"));
|
|
443
|
+
expect(resultsMap["jakarta.faces.partial.ajax"]).to.eq("true");
|
|
444
|
+
expect(resultsMap[encodeURIComponent("page::form")]).to.eq(encodeURIComponent("page::form"));
|
|
445
|
+
expect(resultsMap["jakarta.faces.partial.execute"]).to.eq(encodeURIComponent("page:categoriesTree:3:select page:categoriesTree"));
|
|
446
|
+
expect(resultsMap["jakarta.faces.partial.render"]).to.eq(encodeURIComponent("page:selectedNodesOutput page:categoriesTree"));
|
|
447
|
+
expect(resultsMap[encodeURIComponent("page:categoriesTree:3:select")]).to.exist;
|
|
448
|
+
|
|
449
|
+
done();
|
|
450
|
+
});
|
|
451
|
+
});
|
|
@@ -18,7 +18,7 @@ import {describe, it} from "mocha";
|
|
|
18
18
|
import * as sinon from "sinon";
|
|
19
19
|
import {expect} from "chai";
|
|
20
20
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
21
|
-
import {_Es2019Array, DomQuery} from "mona-dish";
|
|
21
|
+
import {_Es2019Array, DomQuery, DQ$} from "mona-dish";
|
|
22
22
|
import {
|
|
23
23
|
COMPLETE, EMPTY_STR,
|
|
24
24
|
P_AJAX,
|
|
@@ -687,7 +687,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
687
687
|
|
|
688
688
|
/**
|
|
689
689
|
* the idea is if a checkbox or radio button is the issuing element
|
|
690
|
-
* we cannot attach it
|
|
690
|
+
* we cannot attach it if unchecked
|
|
691
691
|
*/
|
|
692
692
|
it("must handle issuing checkboxes and radio buttons with values correctly", () => {
|
|
693
693
|
const waitForResult = initCheckboxForm();
|
|
@@ -719,7 +719,46 @@ describe('Tests after core when it hits response', function () {
|
|
|
719
719
|
}
|
|
720
720
|
|
|
721
721
|
//TODO test assert here
|
|
722
|
-
expect(resultsMap["page%
|
|
722
|
+
expect(resultsMap["page%3Anumbers%3A1"]).to.not.exist;
|
|
723
|
+
//expect(doubles).to.eq(2);
|
|
724
|
+
|
|
725
|
+
});
|
|
726
|
+
});
|
|
727
|
+
|
|
728
|
+
/**
|
|
729
|
+
* the idea is if a checkbox or radio button is the issuing element
|
|
730
|
+
* if checked
|
|
731
|
+
*/
|
|
732
|
+
it("must handle issuing checkboxes and radio buttons with values correctly", () => {
|
|
733
|
+
const waitForResult = initCheckboxForm();
|
|
734
|
+
return waitForResult.then((close) => {
|
|
735
|
+
const send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
736
|
+
let dqElem = DomQuery.byId("page:numbers:1");
|
|
737
|
+
let element = dqElem.getAsElem(0).value;
|
|
738
|
+
|
|
739
|
+
faces.ajax.request(element, null, {
|
|
740
|
+
execute: "form1",
|
|
741
|
+
render: "@form",
|
|
742
|
+
params: {
|
|
743
|
+
pass1: "pass1",
|
|
744
|
+
pass2: "pass2"
|
|
745
|
+
}
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
let argsVal: any = send.args[0][0];
|
|
749
|
+
let arsArr = argsVal.split("&");
|
|
750
|
+
let resultsMap = {};
|
|
751
|
+
let doubles = 0;
|
|
752
|
+
for (let val of arsArr) {
|
|
753
|
+
let keyVal = val.split("=");
|
|
754
|
+
if(!!resultsMap[keyVal[0]]) {
|
|
755
|
+
doubles++;
|
|
756
|
+
}
|
|
757
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
//TODO test assert here
|
|
761
|
+
expect(resultsMap["page%3Anumbers%3A1"]).to.eq("1");
|
|
723
762
|
//expect(doubles).to.eq(2);
|
|
724
763
|
|
|
725
764
|
});
|
|
@@ -755,11 +794,94 @@ describe('Tests after core when it hits response', function () {
|
|
|
755
794
|
}
|
|
756
795
|
|
|
757
796
|
//TODO test assert here
|
|
758
|
-
expect(resultsMap["page%
|
|
797
|
+
expect(resultsMap["page%3Anumbers%3Ar%3A1"]).to.not.exist;
|
|
798
|
+
//expect(doubles).to.eq(2);
|
|
799
|
+
|
|
800
|
+
});
|
|
801
|
+
});
|
|
802
|
+
|
|
803
|
+
it("must handle issuing checkboxes and radio buttons with values correctly with value", () => {
|
|
804
|
+
const waitForResult = initCheckboxForm();
|
|
805
|
+
return waitForResult.then((close) => {
|
|
806
|
+
const send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
807
|
+
let dqElem = DomQuery.byId("page:numbers:r:1");
|
|
808
|
+
let element = dqElem.getAsElem(0).value;
|
|
809
|
+
|
|
810
|
+
faces.ajax.request(element, null, {
|
|
811
|
+
execute: "form2",
|
|
812
|
+
render: "@form",
|
|
813
|
+
params: {
|
|
814
|
+
pass1: "pass1",
|
|
815
|
+
pass2: "pass2"
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
|
|
819
|
+
let argsVal: any = send.args[0][0];
|
|
820
|
+
let arsArr = argsVal.split("&");
|
|
821
|
+
let resultsMap = {};
|
|
822
|
+
let doubles = 0;
|
|
823
|
+
for (let val of arsArr) {
|
|
824
|
+
let keyVal = val.split("=");
|
|
825
|
+
if(!!resultsMap[keyVal[0]]) {
|
|
826
|
+
doubles++;
|
|
827
|
+
}
|
|
828
|
+
resultsMap[keyVal[0]] = keyVal[1];
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
//TODO test assert here
|
|
832
|
+
expect(resultsMap["page%3Anumbers%3Ar%3A1"]).to.exist;
|
|
759
833
|
//expect(doubles).to.eq(2);
|
|
760
834
|
|
|
761
835
|
});
|
|
762
836
|
});
|
|
763
837
|
|
|
838
|
+
/**
|
|
839
|
+
* https://issues.apache.org/jira/browse/MYFACES-4638
|
|
840
|
+
*/
|
|
841
|
+
it("must pass values with & in its value correctly", function (done) {
|
|
842
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
843
|
+
let globalCnt = 0;
|
|
844
|
+
let localCnt = 0;
|
|
845
|
+
DomQuery.byId("input_1").val = "aaa&bbb";
|
|
846
|
+
try {
|
|
847
|
+
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
848
|
+
faces.ajax.addOnEvent(() => {
|
|
849
|
+
globalCnt++;
|
|
850
|
+
});
|
|
851
|
+
faces.ajax.request(element, null, {
|
|
852
|
+
execute: "input_1",
|
|
853
|
+
render: "@form",
|
|
854
|
+
params: {
|
|
855
|
+
pass1: "pass1",
|
|
856
|
+
pass2: "pass2"
|
|
857
|
+
},
|
|
858
|
+
message: "Hello World",
|
|
859
|
+
onevent: (evt: any) => {
|
|
860
|
+
localCnt++;
|
|
861
|
+
}
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
let xhrReq = this.requests[0];
|
|
865
|
+
let requestBody = xhrReq.requestBody.split("&");
|
|
866
|
+
|
|
867
|
+
xhrReq.respond(200, {'Content-Type': 'text/xml'}, STD_XML);
|
|
868
|
+
expect(requestBody.indexOf("input_1=aaa%26bbb")).not.to.eq(-1);
|
|
869
|
+
expect(requestBody.indexOf("pass1=pass1")).not.to.eq(-1);
|
|
870
|
+
expect(requestBody.indexOf("pass2=pass2")).not.to.eq(-1);
|
|
871
|
+
expect(requestBody.indexOf("message=Hello%20World")).not.to.eq(-1);
|
|
872
|
+
|
|
873
|
+
expect(this.jsfAjaxResponse.callCount).to.eq(1);
|
|
874
|
+
//success ommitted due to fake response
|
|
875
|
+
expect(globalCnt == 3).to.eq(true);
|
|
876
|
+
expect(localCnt == 3).to.eq(true);
|
|
877
|
+
done();
|
|
878
|
+
} catch (e) {
|
|
879
|
+
console.error(e);
|
|
880
|
+
|
|
881
|
+
} finally {
|
|
882
|
+
send.restore();
|
|
883
|
+
}
|
|
884
|
+
});
|
|
885
|
+
|
|
764
886
|
});
|
|
765
887
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
Binary file
|
|
Binary file
|
|
@@ -37,14 +37,15 @@ exports.encodeFormData = encodeFormData;
|
|
|
37
37
|
*/
|
|
38
38
|
function decodeEncodedValues(encoded) {
|
|
39
39
|
const filterBlanks = item => !!(item || '').replace(/\s+/g, '');
|
|
40
|
-
const splitKeyValuePair =
|
|
40
|
+
const splitKeyValuePair = _line => {
|
|
41
|
+
let line = decodeURIComponent(_line);
|
|
41
42
|
let index = line.indexOf("=");
|
|
42
43
|
if (index == -1) {
|
|
43
44
|
return [line];
|
|
44
45
|
}
|
|
45
46
|
return [line.substring(0, index), line.substring(index + 1)];
|
|
46
47
|
};
|
|
47
|
-
let requestParamEntries =
|
|
48
|
+
let requestParamEntries = encoded.split(/&/gi);
|
|
48
49
|
return requestParamEntries.filter(filterBlanks).map(splitKeyValuePair);
|
|
49
50
|
}
|
|
50
51
|
exports.decodeEncodedValues = decodeEncodedValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileUtils.js","sourceRoot":"","sources":["../../../src/main/typescript/impl/util/FileUtils.ts"],"names":[],"mappings":";;;AAAA,yCAA4D;AAC5D,+CAA0C;AAC1C,yCAAgD;AAEhD;;;GAGG;AAGH;;;;;GAKG;AACH,SAAgB,cAAc,CAAC,QAAgB,EAChB,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAC/C,UAAU,GAAG,iBAAS;IACjD,IAAI,QAAQ,CAAC,QAAQ,EAAE,EAAE;QACrB,OAAO,UAAU,CAAC;KACrB;IACD,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,CAAC;IAEnC,MAAM,uBAAuB,GAAG,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;IAC3F,MAAM,aAAa,GAAG,GAAG,CAAC,EAAE,CAAC,WAAW,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IAC7D,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE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