jsf.js_next_gen 4.0.0-RC.2 → 4.0.0-RC.21
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/docs/functions/myfaces.ab.html +2 -2
- package/dist/window/faces-development.js +789 -306
- 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 +789 -306
- 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 +16 -16
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +19 -2
- package/src/main/typescript/api/_api.ts +5 -4
- package/src/main/typescript/impl/AjaxImpl.ts +109 -37
- package/src/main/typescript/impl/core/Const.ts +48 -38
- package/src/main/typescript/impl/util/Assertions.ts +16 -8
- package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
- package/src/main/typescript/impl/util/ExtDomQuery.ts +12 -4
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +78 -0
- package/src/main/typescript/impl/util/Lang.ts +9 -11
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
- package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +8 -1
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +40 -22
- 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 +157 -98
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +4 -2
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +24 -14
- package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +72 -0
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
- 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/EventTests.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
- package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +116 -9
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +236 -11
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +368 -31
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +41 -7
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +5 -4
- package/target/api/_api.js.map +1 -1
- package/target/impl/AjaxImpl.js +97 -26
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +48 -37
- 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 +12 -7
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +9 -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 +69 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/impl/util/Lang.js +8 -10
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/ErrorData.js +10 -8
- package/target/impl/xhrCore/ErrorData.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/RequestContext.js +11 -0
- package/target/impl/xhrCore/RequestContext.js.map +1 -0
- package/target/impl/xhrCore/RequestDataResolver.js +34 -15
- 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 +136 -82
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +4 -2
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +20 -11
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +23 -14
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +63 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.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/EventTests.spec.js +1 -1
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +203 -0
- package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
- package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
- package/target/test/xhrCore/RequestParamsTest.spec.js +101 -4
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +212 -9
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +303 -22
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +36 -6
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/tmp.xml +36 -0
- package/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +0 -4
- package/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +0 -4
- package/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/createdFiles.lst +0 -1
- package/target/maven-status/maven-compiler-plugin/testCompile/default-testCompile/inputFiles.lst +0 -1
- package/target/surefire-reports/TEST-com.example.jsfs_js_ts.JsfsJsTsApplicationTests.xml +0 -78
- package/target/surefire-reports/com.example.jsfs_js_ts.JsfsJsTsApplicationTests.txt +0 -7
|
@@ -21,9 +21,9 @@ import * as sinon from "sinon";
|
|
|
21
21
|
|
|
22
22
|
import {XmlResponses} from "../frameworkBase/_ext/shared/XmlResponses";
|
|
23
23
|
import {expect} from "chai";
|
|
24
|
-
import {DomQuery, DQ} from "mona-dish";
|
|
24
|
+
import {DomQuery, DQ, DQ$} from "mona-dish";
|
|
25
25
|
import protocolPage = StandardInits.protocolPage;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
|
|
28
28
|
declare var faces: any;
|
|
29
29
|
declare var Implementation: any;
|
|
@@ -199,7 +199,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
199
199
|
"embedded scripts must be executed").to.be.true;
|
|
200
200
|
});
|
|
201
201
|
|
|
202
|
-
it("must have a
|
|
202
|
+
it("must have a viewState update to be performed", function () {
|
|
203
203
|
DQ.byId("cmd_viewstate").click();
|
|
204
204
|
|
|
205
205
|
this.respond(XmlResponses.VIEWSTATE_1);
|
|
@@ -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"
|
|
@@ -245,18 +245,17 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
245
245
|
|
|
246
246
|
// language=XML
|
|
247
247
|
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
248
|
+
<partial-response id="j_id__v_0">
|
|
249
|
+
<changes>
|
|
250
|
+
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
|
|
251
|
+
<update id="j_id__v_0:jakarta.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]></update>
|
|
252
|
+
</changes>
|
|
253
|
+
</partial-response>`);
|
|
254
254
|
|
|
255
255
|
|
|
256
|
-
expect(DQ
|
|
256
|
+
expect(DQ$("[name*='jakarta.faces.ViewState']").isPresent()).to.be.true;
|
|
257
257
|
|
|
258
|
-
expect((
|
|
259
|
-
expect(DQ.byId("jakarta.faces.ViewState").inputValue.value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
258
|
+
expect(DQ$("[name*='jakarta.faces.ViewState']").val == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
260
259
|
});
|
|
261
260
|
|
|
262
261
|
|
|
@@ -264,7 +263,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
264
263
|
DQ.byId("cmd_eval").click();
|
|
265
264
|
/*js full submit form, coming from the integration tests*/
|
|
266
265
|
window.document.body.innerHTML = `<form id="j_id__v_0" name="j_id__v_0" method="post" action="/IntegrationJSTest/integrationtestsjasmine/test7-eventtest.jsf"
|
|
267
|
-
|
|
266
|
+
><span id="updatePanel">hello world</span><a href="#"
|
|
268
267
|
onclick="return faces.util.chain(this, event,'return false;', 'return myfaces.ab(\'j_id_1l\',\'updateTrigger\');');"
|
|
269
268
|
id="updateTrigger"
|
|
270
269
|
name="updateTrigger"
|
|
@@ -280,20 +279,20 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
280
279
|
|
|
281
280
|
// language=XML
|
|
282
281
|
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
282
|
+
<partial-response id="j_id__v_0">
|
|
283
|
+
<changes>
|
|
284
|
+
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
|
|
285
|
+
<update id="j_id__v_0:jakarta.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]><!--
|
|
287
286
|
Some random junk which is sent by the server
|
|
288
287
|
--></update>
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
</changes>
|
|
289
|
+
</partial-response>`);
|
|
291
290
|
|
|
292
291
|
|
|
293
|
-
expect(DQ
|
|
292
|
+
expect(DQ$("[name*='jakarta.faces.ViewState']").isAbsent()).to.be.false;
|
|
294
293
|
|
|
295
|
-
expect((<HTMLInputElement>document.
|
|
296
|
-
expect(DQ
|
|
294
|
+
// expect((<HTMLInputElement>document.getElementsByName("jakarta.faces.ViewState")[0]).value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
295
|
+
expect(DQ$("[name*='jakarta.faces.ViewState']").inputValue.value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
297
296
|
});
|
|
298
297
|
|
|
299
298
|
|
|
@@ -357,8 +356,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
357
356
|
});
|
|
358
357
|
|
|
359
358
|
|
|
360
|
-
|
|
361
|
-
it("must handle simple resource responses properly", function(done) {
|
|
359
|
+
it("must handle simple resource responses properly", function (done) {
|
|
362
360
|
|
|
363
361
|
// we need to fake the response as well to see whether the server has loaded the addedViewHead code and has interpreted it
|
|
364
362
|
//(window as any)["test"] = "booga";
|
|
@@ -373,10 +371,10 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
373
371
|
})
|
|
374
372
|
|
|
375
373
|
|
|
376
|
-
it("only single resources are allowed", function(done) {
|
|
374
|
+
it("only single resources are allowed", function (done) {
|
|
377
375
|
// we need to fake the response as well to see whether the server has loaded the addedViewHead code and has interpreted it
|
|
378
376
|
//(window as any)["test"] = "booga";
|
|
379
|
-
for(let cnt = 0; cnt < 10; cnt++) {
|
|
377
|
+
for (let cnt = 0; cnt < 10; cnt++) {
|
|
380
378
|
DQ.byId("cmd_simple_resource").click();
|
|
381
379
|
this.respond(XmlResponses.MULTIPLE_RESOURCE_RESPONSE);
|
|
382
380
|
}
|
|
@@ -390,7 +388,7 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
390
388
|
})
|
|
391
389
|
|
|
392
390
|
//TODO implement secondary response mockup
|
|
393
|
-
it("must handle complex resource responses properly", function(done) {
|
|
391
|
+
it("must handle complex resource responses properly", function (done) {
|
|
394
392
|
DQ.byId("cmd_complex_resource").click();
|
|
395
393
|
this.respond(XmlResponses.MULTIPLE_RESOURCE_RESPONSE);
|
|
396
394
|
|
|
@@ -403,14 +401,62 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
403
401
|
.catch(done);
|
|
404
402
|
})
|
|
405
403
|
|
|
406
|
-
it("embedded scripts must be evaled", function(done) {
|
|
404
|
+
it("embedded scripts must be evaled", function (done) {
|
|
407
405
|
|
|
408
406
|
DQ.byId("cmd_complex_resource2").click();
|
|
409
407
|
this.respond(XmlResponses.EMBEDDED_SCRIPTS_RESOURCE_RESPONSE);
|
|
410
|
-
|
|
408
|
+
// this.respond("debugger; document.getElementById('resource_area_1').innerHTML = 'true3'", {'Content-Type': 'text/javascript'});
|
|
411
409
|
let headHTML = document.head.innerHTML;
|
|
412
410
|
expect(headHTML.indexOf("../../../xhrCore/fixtures/addedViewHead3.js")).not.eq(-1);
|
|
413
|
-
expect(headHTML.indexOf("
|
|
411
|
+
expect(headHTML.indexOf("href=\"../../../xhrCore/fixtures/addedViewHead2.css\"")).not.eq(-1);
|
|
412
|
+
expect(DQ$("head link[rel='stylesheet'][href='../../../xhrCore/fixtures/addedViewHead2.css']").length).to.eq(1);
|
|
413
|
+
setTimeout(() => {
|
|
414
|
+
let evalAreaHtml = DQ.byId('resource_area_1').innerHTML;
|
|
415
|
+
//last one must be the last item, order must be preserved
|
|
416
|
+
expect(evalAreaHtml).to.eq("booga");
|
|
417
|
+
done();
|
|
418
|
+
}, 800)
|
|
419
|
+
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
it("head replacement must work (https://issues.apache.org/jira/browse/MYFACES-4498 and TCK Issue 4345IT)", function (done) {
|
|
424
|
+
|
|
425
|
+
DQ.byId("cmd_complex_resource2").click();
|
|
426
|
+
this.respond(XmlResponses.HEAD_REPLACE);
|
|
427
|
+
let headHTML = document.head.innerHTML;
|
|
428
|
+
|
|
429
|
+
//failing now, no elements in the html head after respond!!!
|
|
430
|
+
expect(headHTML.indexOf("href=\"../../../xhrCore/fixtures/addedViewHead2.css\"")).not.eq(-1);
|
|
431
|
+
expect(DQ$("head link[rel='stylesheet'][href='../../../xhrCore/fixtures/addedViewHead2.css']").length).to.eq(1);
|
|
432
|
+
|
|
433
|
+
expect(headHTML.indexOf("../../../xhrCore/fixtures/addedViewHead3.js")).not.eq(-1);
|
|
434
|
+
setTimeout(() => {
|
|
435
|
+
let evalAreaHtml = DQ.byId('resource_area_1').innerHTML;
|
|
436
|
+
//last one must be the last item, order must be preserved
|
|
437
|
+
expect(evalAreaHtml).to.eq("booga");
|
|
438
|
+
done();
|
|
439
|
+
}, 800)
|
|
440
|
+
|
|
441
|
+
})
|
|
442
|
+
|
|
443
|
+
|
|
444
|
+
it("complex head replacement must work", function (done) {
|
|
445
|
+
|
|
446
|
+
DQ.byId("cmd_complex_resource2").click();
|
|
447
|
+
this.respond(XmlResponses.HEAD_REPLACE2);
|
|
448
|
+
let headHTML = document.head.innerHTML;
|
|
449
|
+
|
|
450
|
+
//failing now, no elements in the html head after respond!!!
|
|
451
|
+
expect(headHTML.indexOf("href=\"../../../xhrCore/fixtures/addedViewHead2.css\"")).not.eq(-1);
|
|
452
|
+
expect(DQ$("head link[rel='stylesheet'][href='../../../xhrCore/fixtures/addedViewHead2.css']").length).to.eq(1);
|
|
453
|
+
|
|
454
|
+
let metas = DQ$("head meta");
|
|
455
|
+
expect(metas.length).to.eq(5);
|
|
456
|
+
expect(metas.get(0).attr("charSet").value == "UTF-8");
|
|
457
|
+
expect(metas.get(4).attr("author").value == "Whoever");
|
|
458
|
+
|
|
459
|
+
expect(headHTML.indexOf("../../../xhrCore/fixtures/addedViewHead3.js")).not.eq(-1);
|
|
414
460
|
setTimeout(() => {
|
|
415
461
|
let evalAreaHtml = DQ.byId('resource_area_1').innerHTML;
|
|
416
462
|
//last one must be the last item, order must be preserved
|
|
@@ -419,5 +465,296 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
419
465
|
}, 800)
|
|
420
466
|
|
|
421
467
|
})
|
|
468
|
+
const INNER_HTML_MULIT_VIEW = `
|
|
469
|
+
<div id="viewroot_1">
|
|
470
|
+
<form id="viewroot_1:form1">
|
|
471
|
+
<button type="submit" id="viewroot_1:submit_1"></button>
|
|
472
|
+
<input type="hidden" id="viewroot_1:form1:jakarta.faces.ViewState:1" name="jakarta.faces.ViewState" value="booga"></input>
|
|
473
|
+
</form>
|
|
474
|
+
<form id="viewroot_1:form2">
|
|
475
|
+
<button type="submit" id="viewroot_1:submit_2"></button>
|
|
476
|
+
</form>
|
|
477
|
+
</div>
|
|
478
|
+
|
|
479
|
+
<div id="viewroot_2">
|
|
480
|
+
<form id="viewroot_2:form1">
|
|
481
|
+
<button type="submit" id="viewroot_1:submit_2"></button>
|
|
482
|
+
</form>
|
|
483
|
+
</div>
|
|
484
|
+
`;
|
|
485
|
+
it("must handle multiple view roots", function (done) {
|
|
486
|
+
|
|
487
|
+
|
|
488
|
+
const RESPONSE_1 = `<?xml version="1.0" encoding="UTF-8"?>
|
|
489
|
+
<partial-response id='viewroot_1'>
|
|
490
|
+
<changes>
|
|
491
|
+
<update id='viewroot_1:jakarta.faces.ViewState:1'><![CDATA[updatedVST]]></update>
|
|
492
|
+
</changes>
|
|
493
|
+
</partial-response>`
|
|
494
|
+
|
|
495
|
+
window.document.body.innerHTML = INNER_HTML_MULIT_VIEW;
|
|
496
|
+
|
|
497
|
+
faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
|
|
498
|
+
"javax.faces.behavior.event": "change",
|
|
499
|
+
execute: "submit_1",
|
|
500
|
+
render: "form1"
|
|
501
|
+
});
|
|
502
|
+
this.respond(RESPONSE_1);
|
|
503
|
+
expect(DQ$("#viewroot_1\\:form2 [name='jakarta.faces.ViewState']").isAbsent()).to.be.true;
|
|
504
|
+
expect(DQ$("#viewroot_1\\:form1 [name='jakarta.faces.ViewState']").isPresent()).to.be.true;
|
|
505
|
+
expect(DQ$("#viewroot_1\\:form1 [name='jakarta.faces.ViewState']").val).to.be.eq("updatedVST");
|
|
506
|
+
|
|
507
|
+
done();
|
|
508
|
+
})
|
|
509
|
+
|
|
510
|
+
it("must handle multiple view roots multi forms", function (done) {
|
|
511
|
+
const RESPONSE_1 = `<?xml version="1.0" encoding="UTF-8"?>
|
|
512
|
+
<partial-response id='viewroot_1'>
|
|
513
|
+
<changes>
|
|
514
|
+
<update id='viewroot_1:jakarta.faces.ViewState:1'><![CDATA[updatedVST]]></update>
|
|
515
|
+
</changes>
|
|
516
|
+
</partial-response>`
|
|
517
|
+
|
|
518
|
+
window.document.body.innerHTML = INNER_HTML_MULIT_VIEW;
|
|
519
|
+
global["debug4"] = true;
|
|
520
|
+
faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
|
|
521
|
+
"javax.faces.behavior.event": "change",
|
|
522
|
+
execute: "submit_1",
|
|
523
|
+
render: "viewroot_1:form1 submit_2"
|
|
524
|
+
});
|
|
525
|
+
this.respond(RESPONSE_1);
|
|
526
|
+
expect(DQ$("#viewroot_1\\:form2 [name*='jakarta.faces.ViewState']").isPresent()).to.be.true;
|
|
527
|
+
expect(DQ$("#viewroot_1\\:form1 [name*='jakarta.faces.ViewState']").isPresent()).to.be.true;
|
|
528
|
+
expect(DQ$("#viewroot_2\\:form1\\:form1 [name*='jakarta.faces.ViewState']").isAbsent()).to.be.true;
|
|
529
|
+
|
|
530
|
+
expect(faces.getViewState(DQ$("#viewroot_1\\:form2").getAsElem(0).value).indexOf("jakarta.faces.ViewState=updatedVST") != -1).to.be.true;
|
|
531
|
+
expect(faces.getViewState("viewroot_1:form1").indexOf("jakarta.faces.ViewState=updatedVST") != -1).to.be.true;
|
|
532
|
+
|
|
533
|
+
done();
|
|
534
|
+
})
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
it("must handle multiple view roots with ClientWindow ids", function (done) {
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
const RESPONSE_1 = `<?xml version="1.0" encoding="UTF-8"?>
|
|
541
|
+
<partial-response id='viewroot_1'>
|
|
542
|
+
<changes>
|
|
543
|
+
<update id='viewroot_1:jakarta.faces.ClientWindow:1'><![CDATA[updatedViewId]]></update>
|
|
544
|
+
</changes>
|
|
545
|
+
</partial-response>`
|
|
546
|
+
|
|
547
|
+
window.document.body.innerHTML = INNER_HTML_MULIT_VIEW;
|
|
548
|
+
|
|
549
|
+
faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
|
|
550
|
+
"javax.faces.behavior.event": "change",
|
|
551
|
+
execute: "submit_1",
|
|
552
|
+
render: "viewroot_1:form1"
|
|
553
|
+
});
|
|
554
|
+
this.respond(RESPONSE_1);
|
|
555
|
+
expect(DQ$("#viewroot_1\\:form2 [name*='jakarta.faces.ClientWindow']").isAbsent()).to.be.true;
|
|
556
|
+
expect(DQ$("#viewroot_1\\:form1 [name*='jakarta.faces.ClientWindow']").isPresent()).to.be.true;
|
|
557
|
+
expect(DQ$("#viewroot_1\\:form1 [name*='jakarta.faces.ClientWindow']").val).to.be.eq("updatedViewId");
|
|
558
|
+
|
|
559
|
+
done();
|
|
560
|
+
})
|
|
561
|
+
|
|
562
|
+
it("must handle multiple view roots multi forms with ClientWindow ids", function (done) {
|
|
563
|
+
const RESPONSE_1 = `<?xml version="1.0" encoding="UTF-8"?>
|
|
564
|
+
<partial-response id='viewroot_1'>
|
|
565
|
+
<changes>
|
|
566
|
+
<update id='viewroot_1:jakarta.faces.ClientWindow:1'><![CDATA[updatedViewId]]></update>
|
|
567
|
+
</changes>
|
|
568
|
+
</partial-response>`
|
|
569
|
+
|
|
570
|
+
window.document.body.innerHTML = INNER_HTML_MULIT_VIEW;
|
|
571
|
+
|
|
572
|
+
faces.ajax.request(window.document.getElementById("viewroot_1:submit_1"), null, {
|
|
573
|
+
"javax.faces.behavior.event": "change",
|
|
574
|
+
execute: "submit_1",
|
|
575
|
+
render: "viewroot_1:form1 :submit_2"
|
|
576
|
+
});
|
|
577
|
+
this.respond(RESPONSE_1);
|
|
578
|
+
expect(DQ$("#viewroot_1\\:form2 [name*='jakarta.faces.ClientWindow']").isPresent()).to.be.true;
|
|
579
|
+
expect(DQ$("#viewroot_1\\:form1 [name*='jakarta.faces.ClientWindow']").isPresent()).to.be.true;
|
|
580
|
+
expect(DQ$("#viewroot_2\\:form1\\:form1 [name*='jakarta.faces.ClientWindow']").isAbsent()).to.be.true;
|
|
581
|
+
expect(DQ$("#viewroot_1\\:form2 [name*='jakarta.faces.ClientWindow']").val).to.be.eq("updatedViewId");
|
|
582
|
+
expect(DQ$("#viewroot_1\\:form1 [name*='jakarta.faces.ClientWindow']").val).to.be.eq("updatedViewId");
|
|
583
|
+
|
|
584
|
+
done();
|
|
585
|
+
})
|
|
586
|
+
|
|
587
|
+
const TCK_790_MARKUP = `
|
|
588
|
+
<div id="panel1">
|
|
589
|
+
<form id="form1" name="form1" method="post"
|
|
590
|
+
action="booga"
|
|
591
|
+
><input id="form1:button" name="form1:button" type="submit"
|
|
592
|
+
value="submit form1 via ajax">
|
|
593
|
+
<input type="hidden" name="jakarta.faces.ViewState"
|
|
594
|
+
id="viewroot_1:jakarta.faces.ViewState:1"
|
|
595
|
+
value="beforeUpdate">
|
|
596
|
+
</form>
|
|
597
|
+
</div>
|
|
598
|
+
<div id="panel2">
|
|
599
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
600
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
601
|
+
</form>
|
|
602
|
+
</div>
|
|
603
|
+
<div id="panel3">
|
|
604
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
605
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
606
|
+
</form>
|
|
607
|
+
</div>
|
|
608
|
+
`;
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
const TCK_790_NAV_MARKUP = `
|
|
612
|
+
<form id="form1x" name="form1" method="post"
|
|
613
|
+
action="booga"
|
|
614
|
+
><input id="form1x:button" name="form1x:button" type="submit"
|
|
615
|
+
value="submit form1 via ajax">
|
|
616
|
+
<input type="hidden" name="jakarta.faces.ViewState"
|
|
617
|
+
id="viewroot_1:jakarta.faces.ViewState:1"
|
|
618
|
+
value="beforeUpdate">
|
|
619
|
+
</form>
|
|
620
|
+
`;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Similar to TCK 790
|
|
624
|
+
*/
|
|
625
|
+
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
|
|
626
|
+
|
|
627
|
+
document.body.innerHTML = TCK_790_MARKUP;
|
|
628
|
+
|
|
629
|
+
const RESPONSE_1 = `<partial-response id="viewroot_1">
|
|
630
|
+
<changes>
|
|
631
|
+
<update id="panel2"><![CDATA[
|
|
632
|
+
<div id="panel2">
|
|
633
|
+
after update
|
|
634
|
+
<form id="form2" name="form2" method="post" action="booga2"
|
|
635
|
+
><a href="#" id="form2:link" name="form2:link"></a>
|
|
636
|
+
<input type="hidden" name="form2_SUBMIT" value="1"/></form>
|
|
637
|
+
</div>
|
|
638
|
+
]]>
|
|
639
|
+
</update>
|
|
640
|
+
<update id="panel3"><![CDATA[
|
|
641
|
+
<div id="panel3">
|
|
642
|
+
after update
|
|
643
|
+
<form id="form3" name="form3" method="post" action="booga3"
|
|
644
|
+
><a href="#" id="form3:link" name="form3:link"></a>
|
|
645
|
+
</form>
|
|
646
|
+
</div>
|
|
647
|
+
]]>
|
|
648
|
+
</update>
|
|
649
|
+
<update id="viewroot_1:jakarta.faces.ViewState:1"><![CDATA[booga_after_update]]></update>
|
|
650
|
+
</changes>
|
|
651
|
+
</partial-response>`;
|
|
652
|
+
faces.ajax.request(window.document.getElementById("form1:button"), null, {
|
|
653
|
+
"javax.faces.behavior.event": "click",
|
|
654
|
+
execute: "form1",
|
|
655
|
+
render: "form2 form3"
|
|
656
|
+
});
|
|
657
|
+
|
|
658
|
+
this.respond(RESPONSE_1);
|
|
659
|
+
// all forms in execute and render must receive the latest viewstate
|
|
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
|
+
it('must handle a ViewExpired Error correctly, and only once in a listener', function (done) {
|
|
727
|
+
|
|
728
|
+
document.body.innerHTML = TCK_790_NAV_MARKUP;
|
|
729
|
+
|
|
730
|
+
let errorCalled = 0;
|
|
731
|
+
faces.ajax.addOnError((error)=> {
|
|
732
|
+
expect(error.errorName).to.eq("jakarta.faces.application.ViewExpiredException");
|
|
733
|
+
expect(error.errorMessage).to.eq("serverError: View \"/testhmtl.xhtml\" could not be restored.");
|
|
734
|
+
expect(error.source.id).to.eq("form1x:button");
|
|
735
|
+
errorCalled++;
|
|
736
|
+
});
|
|
737
|
+
|
|
738
|
+
faces.ajax.request(window.document.getElementById("form1x:button"), null, {
|
|
739
|
+
"javax.faces.behavior.event": "click",
|
|
740
|
+
execute: "@form",
|
|
741
|
+
render: ":form1x:button"
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
745
|
+
<partial-response><error>
|
|
746
|
+
<error-name>jakarta.faces.application.ViewExpiredException</error-name>
|
|
747
|
+
<error-message><![CDATA[View "/testhmtl.xhtml" could not be restored.]]></error-message>
|
|
748
|
+
</error>
|
|
749
|
+
</partial-response>`)
|
|
750
|
+
|
|
751
|
+
expect(errorCalled).to.eq(1);
|
|
752
|
+
|
|
753
|
+
done();
|
|
754
|
+
|
|
755
|
+
});
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
422
759
|
|
|
423
760
|
});
|
|
@@ -22,8 +22,10 @@ import * as sinon from "sinon";
|
|
|
22
22
|
import {XmlResponses} from "../frameworkBase/_ext/shared/XmlResponses";
|
|
23
23
|
import {expect} from "chai";
|
|
24
24
|
import protocolPage = StandardInits.protocolPage;
|
|
25
|
-
import {DQ} from "mona-dish";
|
|
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;
|
|
@@ -254,10 +256,10 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
254
256
|
</partial-response>`);
|
|
255
257
|
|
|
256
258
|
|
|
257
|
-
expect(DQ
|
|
259
|
+
expect(DQ$("[name*='javax.faces.ViewState']").isAbsent()).to.be.false;
|
|
258
260
|
|
|
259
|
-
expect((<HTMLInputElement>document.getElementsByName("javax.faces.ViewState")[0]).value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
260
|
-
expect(DQ
|
|
261
|
+
//expect((<HTMLInputElement>document.getElementsByName("javax.faces.ViewState")[0]).value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
262
|
+
expect(DQ$("[name*='javax.faces.ViewState']").val == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
261
263
|
});
|
|
262
264
|
|
|
263
265
|
|
|
@@ -291,10 +293,10 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
291
293
|
</partial-response>`);
|
|
292
294
|
|
|
293
295
|
|
|
294
|
-
expect(DQ
|
|
296
|
+
expect(DQ$("[name*='javax.faces.ViewState']").isAbsent()).to.be.false;
|
|
295
297
|
|
|
296
|
-
expect((<HTMLInputElement>document.
|
|
297
|
-
expect(DQ
|
|
298
|
+
//expect((<HTMLInputElement>document.getElementsByName("javax.faces.ViewState")[0]).value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
299
|
+
expect(DQ$("[name*='javax.faces.ViewState']").inputValue.value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
298
300
|
});
|
|
299
301
|
|
|
300
302
|
|
|
@@ -357,6 +359,38 @@ describe('Tests of the various aspects of the response protocol functionality',
|
|
|
357
359
|
expect(DQ.byId("j_id__v_0:javax.faces.ClientWindow:1").isAbsent()).to.be.false;
|
|
358
360
|
});
|
|
359
361
|
|
|
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();
|
|
392
|
+
|
|
393
|
+
});
|
|
360
394
|
|
|
361
395
|
|
|
362
396
|
});
|