jsf.js_next_gen 4.0.0-beta-23 → 4.0.0
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/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
- package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/README.md +7 -22
- package/dist/docs/assets/main.js +56 -52
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/assets/style.css +23 -0
- package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
- package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
- package/dist/docs/functions/faces.ajax.request.html +7 -7
- package/dist/docs/functions/faces.ajax.response.html +0 -1
- package/dist/docs/functions/faces.push.close.html +4 -2
- package/dist/docs/functions/faces.push.init.html +19 -7
- package/dist/docs/functions/faces.push.open.html +4 -2
- package/dist/docs/functions/faces.util.chain.html +3 -3
- package/dist/docs/functions/myfaces.ab.html +9 -4
- package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
- package/dist/docs/index.html +7 -18
- package/dist/docs/modules/myfaces.html +3 -1
- package/dist/docs/variables/myfaces.oam.html +2 -1
- package/dist/window/faces-development.js +2147 -1779
- 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 +17 -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 +2156 -1777
- 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 +17 -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 +19 -18
- package/pom.xml +1 -1
- package/src/main/test.xml +23 -0
- package/src/main/typescript/@types/definitions/index.d.ts +24 -7
- package/src/main/typescript/api/_api.ts +79 -37
- package/src/main/typescript/api/jsf.ts +18 -0
- package/src/main/typescript/impl/AjaxImpl.ts +168 -78
- package/src/main/typescript/impl/PushImpl.ts +63 -38
- package/src/main/typescript/impl/core/Const.ts +52 -39
- 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/AsyncRunnable.ts +4 -4
- package/src/main/typescript/impl/util/ExtDomQuery.ts +58 -45
- package/src/main/typescript/impl/util/FileUtils.ts +104 -0
- package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
- package/src/main/typescript/impl/util/Lang.ts +30 -31
- 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 +25 -11
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
- package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +202 -131
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +79 -166
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -68
- package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +19 -22
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +108 -1
- 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 -7
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
- 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 +158 -17
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +242 -11
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +373 -35
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
- package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
- package/src/main/typescript/test.xml +6 -0
- package/src/main/typescript/tsconfig.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/src/tmp/test.html +12 -88
- package/target/api/_api.js +72 -31
- package/target/api/_api.js.map +1 -1
- package/target/api/jsf.js +11 -0
- package/target/api/jsf.js.map +1 -1
- package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
- package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
- package/target/impl/AjaxImpl.js +144 -59
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +66 -35
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +51 -38
- 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 +58 -40
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/FileUtils.js +96 -0
- package/target/impl/util/FileUtils.js.map +1 -0
- package/target/impl/util/HiddenElementBuilder.js +7 -0
- package/target/impl/util/HiddenElementBuilder.js.map +1 -0
- package/target/impl/util/HiddenInputBuilder.js +79 -0
- package/target/impl/util/HiddenInputBuilder.js.map +1 -0
- package/target/impl/util/Lang.js +29 -30
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/util/URLCodec.js +77 -0
- package/target/impl/util/URLCodec.js.map +1 -0
- package/target/impl/util/XhrQueueController.js +82 -0
- package/target/impl/util/XhrQueueController.js.map +1 -0
- 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 +70 -23
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +44 -29
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +182 -116
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +68 -156
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrQueHandler.js +11 -0
- package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
- package/target/impl/xhrCore/XhrQueueController.js +62 -0
- package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
- package/target/impl/xhrCore/XhrRequest.js +68 -59
- 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 +16 -16
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
- package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
- package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +100 -1
- 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/myfaces/OnLoadSpec.js +57 -0
- package/target/test/myfaces/OnLoadSpec.js.map +1 -0
- package/target/test/xhrCore/EventTests.spec.js +1 -1
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -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 +142 -10
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +217 -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 +308 -24
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
- package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
- package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/target/test-classes/.gz +0 -0
- package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
- package/target/test-classes/fileuploadtest.html +24 -0
- package/target/test-classes/jsf-development.js +3559 -0
- package/target/test-classes/jsf-development.js.br +0 -0
- package/target/test-classes/jsf-development.js.gz +0 -0
- package/target/test-classes/jsf-development.js.map +1 -0
- package/target/test-classes/jsf.js +3 -0
- package/target/test-classes/jsf.js.br +0 -0
- package/target/test-classes/jsf.js.gz +0 -0
- package/tmp.xml +36 -0
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
- package/target/types/index.js +0 -18
- package/target/types/index.js.map +0 -1
|
@@ -62,18 +62,23 @@ export module oam {
|
|
|
62
62
|
DQ.byId(element).delete();
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
-
// noinspection JSUnusedGlobalSymbols
|
|
65
|
+
// noinspection JSUnusedGlobalSymbols,JSUnusedLocalSymbols
|
|
66
66
|
/**
|
|
67
67
|
* does special form submit remapping
|
|
68
68
|
* re-maps the issuing command link into something,
|
|
69
|
-
*
|
|
69
|
+
* the "decode" of the command link on the server can understand
|
|
70
70
|
*
|
|
71
71
|
* @param formName
|
|
72
72
|
* @param linkId
|
|
73
73
|
* @param target
|
|
74
74
|
* @param params
|
|
75
75
|
*/
|
|
76
|
-
export const submitForm = function (formName: string, linkId: string, target: string, params:
|
|
76
|
+
export const submitForm = function (formName: string, linkId: string | null = null, target: string |null = null, params: AssocArr<any> | Tuples<string, any> | null = {} ): boolean {
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
//handle a possible incoming null, not sure if this is used that way anywhere, but we allow it
|
|
80
|
+
params = (!params) ? {} : params;
|
|
81
|
+
|
|
77
82
|
let clearFn = 'clearFormHiddenParams_' + formName.replace(/-/g, '\$:').replace(/:/g, '_');
|
|
78
83
|
window?.[clearFn]?.(formName);
|
|
79
84
|
|
|
@@ -81,18 +86,23 @@ export module oam {
|
|
|
81
86
|
if (window?.myfaces?.core?.config?.autoScroll && (window as any)?.getScrolling) {
|
|
82
87
|
myfaces.oam.setHiddenInput(formName, 'autoScroll', (window as any)?.getScrolling());
|
|
83
88
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
});
|
|
89
|
+
let paramsStream: Stream<[string, any]> = Array.isArray(params) ? Stream.of(...params) : Stream.ofAssoc(params);
|
|
90
|
+
paramsStream.each(([key, data]) => myfaces.oam.setHiddenInput(formName, key, data));
|
|
87
91
|
|
|
88
92
|
//we call the namespaced function, to allow decoration, via a direct call we would
|
|
89
|
-
myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId);
|
|
93
|
+
myfaces.oam.setHiddenInput(formName, `${formName}:_idcl`, linkId ?? '');
|
|
94
|
+
|
|
90
95
|
|
|
91
|
-
DQ.byId(document.forms[formName]).each(form => {
|
|
96
|
+
DQ.byId(document.forms?.[formName] ?? document.getElementById(formName)).each(form => {
|
|
92
97
|
const ATTR_TARGET = "target";
|
|
93
98
|
const formElement = form.getAsElem(0).value as HTMLFormElement;
|
|
94
|
-
const oldTarget = form.
|
|
95
|
-
|
|
99
|
+
const oldTarget = (form.getAsElem(0).value as HTMLFormElement).getAttribute("target");
|
|
100
|
+
|
|
101
|
+
if(target != "null" && target) {
|
|
102
|
+
(form.getAsElem(0).value as HTMLFormElement).setAttribute("target", target);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
|
|
96
106
|
|
|
97
107
|
const result = formElement?.onsubmit?.(null);
|
|
98
108
|
|
|
@@ -103,9 +113,15 @@ export module oam {
|
|
|
103
113
|
} catch (e) {
|
|
104
114
|
window?.console.error(e);
|
|
105
115
|
} finally {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
116
|
+
if(oldTarget == null || oldTarget == "null") {
|
|
117
|
+
(form.getAsElem(0).value as HTMLFormElement).removeAttribute("target");
|
|
118
|
+
} else {
|
|
119
|
+
(form.getAsElem(0).value as HTMLFormElement).setAttribute("target", oldTarget);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// noinspection JSUnusedLocalSymbols
|
|
123
|
+
paramsStream.each(([key, data]) => {
|
|
124
|
+
myfaces.oam.clearHiddenInput(formName, key);
|
|
109
125
|
});
|
|
110
126
|
myfaces.oam.clearHiddenInput(formName, `${formName}:_idcl`);
|
|
111
127
|
}
|
|
@@ -18,7 +18,6 @@ import {expect} from 'chai';
|
|
|
18
18
|
import {describe, it} from 'mocha';
|
|
19
19
|
import {ArrayCollector, DomQuery, DomQueryCollector, Lang, LazyStream} from "mona-dish";
|
|
20
20
|
import trim = Lang.trim;
|
|
21
|
-
import {ExtDomquery} from "../../../../impl/util/ExtDomQuery";
|
|
22
21
|
import {from} from "rxjs";
|
|
23
22
|
|
|
24
23
|
|
|
@@ -30,6 +29,7 @@ describe('DOMQuery tests', function () {
|
|
|
30
29
|
|
|
31
30
|
beforeEach(function () {
|
|
32
31
|
|
|
32
|
+
// language=HTML
|
|
33
33
|
dom = new JSDOM(`
|
|
34
34
|
<!DOCTYPE html>
|
|
35
35
|
<html lang="en">
|
|
@@ -93,7 +93,7 @@ describe('DOMQuery tests', function () {
|
|
|
93
93
|
let isDQuery = false;
|
|
94
94
|
let cnt2 = 0;
|
|
95
95
|
|
|
96
|
-
o1.subscribe((
|
|
96
|
+
o1.subscribe(() => {
|
|
97
97
|
cnt1++;
|
|
98
98
|
});
|
|
99
99
|
|
|
@@ -119,7 +119,7 @@ describe('DOMQuery tests', function () {
|
|
|
119
119
|
let isDQuery = false;
|
|
120
120
|
let cnt2 = 0;
|
|
121
121
|
|
|
122
|
-
o1.subscribe((
|
|
122
|
+
o1.subscribe(() => {
|
|
123
123
|
cnt1++;
|
|
124
124
|
});
|
|
125
125
|
|
|
@@ -183,7 +183,7 @@ describe('DOMQuery tests', function () {
|
|
|
183
183
|
it('domquery ops test2 eachNode', function () {
|
|
184
184
|
let probe2 = DomQuery.querySelectorAll("div");
|
|
185
185
|
let noIter = 0;
|
|
186
|
-
probe2
|
|
186
|
+
probe2.each((item, cnt) => {
|
|
187
187
|
expect(item instanceof DomQuery).to.be.true;
|
|
188
188
|
expect(noIter == cnt).to.be.true;
|
|
189
189
|
noIter++;
|
|
@@ -319,7 +319,7 @@ describe('DOMQuery tests', function () {
|
|
|
319
319
|
|
|
320
320
|
it('it must have parents', function () {
|
|
321
321
|
let probe1 = new DomQuery(document).querySelectorAll("div");
|
|
322
|
-
let coll: Array<any> = probe1.
|
|
322
|
+
let coll: Array<any> = probe1.firstParent("body").stream.collect(new ArrayCollector());
|
|
323
323
|
expect(coll.length == 1).to.be.true;
|
|
324
324
|
|
|
325
325
|
});
|
|
@@ -345,19 +345,19 @@ describe('DOMQuery tests', function () {
|
|
|
345
345
|
it("must have a working input handling", function () {
|
|
346
346
|
DomQuery.querySelectorAll("body").innerHTML = `<form id="blarg">
|
|
347
347
|
<div id="embed1">
|
|
348
|
-
<input type="text" id="id_1" name="id_1" value="id_1_val"
|
|
349
|
-
<input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled">
|
|
350
|
-
<textarea
|
|
348
|
+
<input type="text" id="id_1" name="id_1" value="id_1_val">
|
|
349
|
+
<input type="text" id="id_2" name="id_2" value="id_2_val" disabled="disabled">
|
|
350
|
+
<textarea id="id_3" name="id_3">textareaVal</textarea>
|
|
351
351
|
|
|
352
352
|
<fieldset>
|
|
353
|
-
<input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked"
|
|
353
|
+
<input type="radio" id="mc" name="cc_1" value="Mastercard" checked="checked">
|
|
354
354
|
<label for="mc"> Mastercard</label>
|
|
355
|
-
<input type="radio" id="vi" name="cc_1" value="Visa"
|
|
355
|
+
<input type="radio" id="vi" name="cc_1" value="Visa">
|
|
356
356
|
<label for="vi"> Visa</label>
|
|
357
|
-
<input type="radio" id="ae" name="cc_1" value="AmericanExpress"
|
|
357
|
+
<input type="radio" id="ae" name="cc_1" value="AmericanExpress">
|
|
358
358
|
<label for="ae"> American Express</label>
|
|
359
359
|
</fieldset>
|
|
360
|
-
<select id="val_5" name="val_5"
|
|
360
|
+
<select id="val_5" name="val_5" size="5">
|
|
361
361
|
<option>barg</option>
|
|
362
362
|
<option>jjj</option>
|
|
363
363
|
<option selected>akaka</option>
|
|
@@ -376,7 +376,7 @@ describe('DOMQuery tests', function () {
|
|
|
376
376
|
expect(length2 == 8).to.be.true;
|
|
377
377
|
|
|
378
378
|
let count = DomQuery.byId("embed1").elements
|
|
379
|
-
.stream.map
|
|
379
|
+
.stream.map(item => item.disabled ? 1 : 0)
|
|
380
380
|
.reduce((val1, val2) => val1 + val2, 0);
|
|
381
381
|
expect(count.value).to.eq(1);
|
|
382
382
|
|
|
@@ -385,12 +385,12 @@ describe('DOMQuery tests', function () {
|
|
|
385
385
|
.each(item => item.disabled = false);
|
|
386
386
|
|
|
387
387
|
count = DomQuery.byId("embed1").elements
|
|
388
|
-
.stream.map
|
|
388
|
+
.stream.map(item => item.disabled ? 1 : 0)
|
|
389
389
|
.reduce((val1, val2) => val1 + val2, 0);
|
|
390
390
|
expect(count.value).to.eq(0);
|
|
391
391
|
|
|
392
392
|
count = DomQuery.byId("embed1").elements
|
|
393
|
-
.stream.map
|
|
393
|
+
.stream.map(item => item.attr("checked").isPresent() ? 1 : 0)
|
|
394
394
|
.reduce((val1, val2) => val1 + val2, 0);
|
|
395
395
|
expect(count.value).to.eq(1);
|
|
396
396
|
|
|
@@ -451,7 +451,7 @@ describe('DOMQuery tests', function () {
|
|
|
451
451
|
//-->
|
|
452
452
|
</script>
|
|
453
453
|
|
|
454
|
-
<style
|
|
454
|
+
<style>
|
|
455
455
|
#first {
|
|
456
456
|
border: 1px solid black;
|
|
457
457
|
}
|
|
@@ -482,7 +482,7 @@ describe('DOMQuery tests', function () {
|
|
|
482
482
|
|
|
483
483
|
it("it must handle events properly", function () {
|
|
484
484
|
let clicked = 0;
|
|
485
|
-
let listener = (
|
|
485
|
+
let listener = () => {
|
|
486
486
|
clicked++;
|
|
487
487
|
};
|
|
488
488
|
let eventReceiver = DomQuery.byId("id_1");
|
|
@@ -629,14 +629,11 @@ describe('DOMQuery tests', function () {
|
|
|
629
629
|
|
|
630
630
|
it('must by recycleable', function () {
|
|
631
631
|
let probe = DomQuery.querySelectorAll("div");
|
|
632
|
-
let probe2 = DomQuery.querySelectorAll("body");
|
|
633
632
|
|
|
634
633
|
let res1 = probe.filter(item => item.matchesSelector("div"));
|
|
635
634
|
expect(res1.length).to.eq(4);
|
|
636
635
|
let res2 = probe.filter(item => item.matchesSelector("div"));
|
|
637
636
|
expect(res2.length).to.eq(4);
|
|
638
|
-
|
|
639
|
-
|
|
640
637
|
})
|
|
641
638
|
|
|
642
639
|
it('delete must work', function () {
|
|
@@ -654,8 +651,8 @@ describe('DOMQuery tests', function () {
|
|
|
654
651
|
let probe2 = DomQuery.querySelectorAll("div");
|
|
655
652
|
let probeCnt = 0;
|
|
656
653
|
let probe2Cnt = 0;
|
|
657
|
-
from(probe).subscribe(
|
|
658
|
-
from(probe2.stream).subscribe(
|
|
654
|
+
from(probe).subscribe(() => probeCnt++);
|
|
655
|
+
from(probe2.stream).subscribe(() => probe2Cnt++);
|
|
659
656
|
expect(probeCnt).to.be.above(0);
|
|
660
657
|
expect(probeCnt).to.eq(probe2Cnt);
|
|
661
658
|
})
|
|
@@ -91,6 +91,102 @@ export module StandardInits {
|
|
|
91
91
|
|
|
92
92
|
|
|
93
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
|
+
* a page based on Tobago for a file upload
|
|
116
|
+
*/
|
|
117
|
+
const HTML_TOBAGO_FILE_FORM = `<!DOCTYPE html>
|
|
118
|
+
<html lang='de'>
|
|
119
|
+
<head>
|
|
120
|
+
<meta charset='UTF-8'>
|
|
121
|
+
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
|
|
122
|
+
<title>Test</title>
|
|
123
|
+
</head>
|
|
124
|
+
<body>
|
|
125
|
+
<tobago-page locale='de' class='container-fluid' id='page' focus-on-error='true' wait-overlay-delay-full='1000' wait-overlay-delay-ajax='1000'>
|
|
126
|
+
<form action='/content/100-upload/File_Upload.xhtml' id='page::form' method='post' enctype='multipart/form-data' accept-charset='UTF-8' data-tobago-context-path=''>
|
|
127
|
+
<input type='hidden' name='javax.faces.source' id='javax.faces.source' disabled='disabled'>
|
|
128
|
+
<tobago-focus id='page::lastFocusId'>
|
|
129
|
+
<input type='hidden' name='page::lastFocusId' id='page::lastFocusId::field'>
|
|
130
|
+
</tobago-focus>
|
|
131
|
+
<input type='hidden' name='org.apache.myfaces.tobago.webapp.Secret' id='org.apache.myfaces.tobago.webapp.Secret' value='secretValue'>
|
|
132
|
+
<tobago-file id='page:fileAjax' class='tobago-auto-spacing'>
|
|
133
|
+
<div class='input-group'>
|
|
134
|
+
<input type='file' tabindex='-1' id='page:fileAjax::field' class='form-control' name='page:fileAjax'>
|
|
135
|
+
<tobago-behavior event='change' client-id='page:fileAjax' field-id='page:fileAjax::field' execute='page:fileAjax'></tobago-behavior>
|
|
136
|
+
<label class='input-group-text' for='page:fileAjax::field'><span><i class='bi-folder2-open'></i></span></label>
|
|
137
|
+
</div>
|
|
138
|
+
</tobago-file>
|
|
139
|
+
<div class='tobago-page-menuStore'>
|
|
140
|
+
</div>
|
|
141
|
+
<span id='page::jsf-state-container'><input type='hidden' name='javax.faces.ViewState' id='j_id__v_0:javax.faces.ViewState:1' value='viewStateValue' autocomplete='off'><input type='hidden' name='javax.faces.RenderKitId' value='tobago'><input type='hidden' id='j_id__v_0:javax.faces.ClientWindow:1' name='javax.faces.ClientWindow' value='clientWindowValue'></span>
|
|
142
|
+
</form>
|
|
143
|
+
</tobago-page>
|
|
144
|
+
</body>
|
|
145
|
+
</html>`;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* a page simulating basically a simple faces form
|
|
149
|
+
*/
|
|
150
|
+
export const HTML_PREFIX_EMBEDDED_BODY = `<form id="form1">
|
|
151
|
+
<tobago-in id="page:input" class="tobago-auto-spacing">
|
|
152
|
+
<input type="text" name="page:input" id="page:input::field" class="form-control" value="input_value">
|
|
153
|
+
<tobago-behavior event="change" client-id="page:input" field-id="page:input::field" execute="page:input" render="page:output"></tobago-behavior>
|
|
154
|
+
</tobago-in>
|
|
155
|
+
|
|
156
|
+
<tobago-out id="page:output" class="tobago-auto-spacing">
|
|
157
|
+
<input type="text" name="page:output" id="page:output::field" class="form-control">
|
|
158
|
+
</tobago-out>
|
|
159
|
+
</form>`;
|
|
160
|
+
|
|
161
|
+
const HTML_FORM_PREFIXED_EMBEDDED = `<!DOCTYPE html>
|
|
162
|
+
<html lang="en">
|
|
163
|
+
<head>
|
|
164
|
+
<meta charset="UTF-8">
|
|
165
|
+
<title>Title</title>
|
|
166
|
+
</head>
|
|
167
|
+
<body>
|
|
168
|
+
${HTML_PREFIX_EMBEDDED_BODY}
|
|
169
|
+
</body>
|
|
170
|
+
</html>`;
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
const HTML_FORM_NAMESPACED = `<!DOCTYPE html>
|
|
174
|
+
<html lang="en">
|
|
175
|
+
<head>
|
|
176
|
+
<meta charset="UTF-8">
|
|
177
|
+
<title>Title</title>
|
|
178
|
+
</head>
|
|
179
|
+
<body>
|
|
180
|
+
<form id="jd_0:blarg">
|
|
181
|
+
<input type="text" id="jd_0:input_1" name="jd_0:input_1" value="input_1_val"></input>
|
|
182
|
+
<input type="hidden" id="jd_0:jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
|
|
183
|
+
<input type="button" id="jd_0:input_2" name="input_2" value="input_1_val"></input>
|
|
184
|
+
</form>
|
|
185
|
+
</body>
|
|
186
|
+
</html>`;
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
|
|
94
190
|
/**
|
|
95
191
|
* a page simulating basically a simple faces form
|
|
96
192
|
*/
|
|
@@ -102,7 +198,7 @@ export module StandardInits {
|
|
|
102
198
|
</head>
|
|
103
199
|
<body>
|
|
104
200
|
<form id="blarg" enctype="multipart/form-data">
|
|
105
|
-
<input type="file" id="fíleupload"></input>
|
|
201
|
+
<input type="file" id="fíleupload" name="fíleupload"></input>
|
|
106
202
|
<input type="text" id="input_1" name="input_1" value="input_1_val"></input>
|
|
107
203
|
<input type="hidden" id="jakarta.faces.ViewState" name="jakarta.faces.ViewState" value="blubbblubblubb"></input>
|
|
108
204
|
<input type="button" id="input_2" name="input_2" value="input_1_val"></input>
|
|
@@ -277,12 +373,18 @@ export module StandardInits {
|
|
|
277
373
|
export function defaultMyFaces(withJsf = true): Promise<() => void> {
|
|
278
374
|
return init(HTML_FORM_DEFAULT, withJsf);
|
|
279
375
|
}
|
|
376
|
+
export function defaultMyFacesNamespaces(withJsf = true): Promise<() => void> {
|
|
377
|
+
return init(HTML_FORM_NAMESPACED, withJsf);
|
|
378
|
+
}
|
|
280
379
|
export function defaultMyFaces23(withJsf = true): Promise<() => void> {
|
|
281
380
|
return init(HTML_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
|
|
282
381
|
}
|
|
283
382
|
export function defaultFileForm(withJsf = true): Promise<() => void> {
|
|
284
383
|
return init(HTML_FILE_FORM_DEFAULT, withJsf);
|
|
285
384
|
}
|
|
385
|
+
export function tobagoFileForm(withJsf = true): Promise<() => void> {
|
|
386
|
+
return init(HTML_TOBAGO_FILE_FORM, withJsf);
|
|
387
|
+
}
|
|
286
388
|
export function defaultFileForm_23(withJsf = true): Promise<() => void> {
|
|
287
389
|
return init(HTML_FILE_FORM_DEFAULT.replace(/jakarta/gi, "javax"), withJsf, false);
|
|
288
390
|
}
|
|
@@ -302,6 +404,11 @@ export module StandardInits {
|
|
|
302
404
|
return <any>init((IS_40) ? PROTOCOL_PAGE : PROTOCOL_PAGE.replace(/jakarta/gi,"javax"), withJsf, IS_40);
|
|
303
405
|
}
|
|
304
406
|
|
|
407
|
+
export function prefixEmbeddedPage(withJsf = true, IS_40 = true): Promise<() => void> {
|
|
408
|
+
return <any>init((IS_40) ? HTML_FORM_PREFIXED_EMBEDDED : HTML_FORM_PREFIXED_EMBEDDED.replace(/jakarta/gi,"javax"), withJsf, IS_40);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
|
|
305
412
|
export function defaultSeparatorChar(separatorChar: string, withJsf = true, IS_40 = true): Promise<() => void> {
|
|
306
413
|
let template = HTML_DEFAULT_SEPARATOR_CHAR(separatorChar, IS_40);
|
|
307
414
|
return init(template, withJsf);
|
|
@@ -194,7 +194,7 @@ export class XmlResponses {
|
|
|
194
194
|
<partial-response id="j_id__v_0"><changes><update id="jakarta.faces.Resource">
|
|
195
195
|
<![CDATA[
|
|
196
196
|
<script src="../../../xhrCore/fixtures/addedViewHead3.js"></script>
|
|
197
|
-
<
|
|
197
|
+
<link rel="stylesheet" href="../../../xhrCore/fixtures/addedViewHead2.css"></link>
|
|
198
198
|
<script type="text/javascript">
|
|
199
199
|
document.getElementById('resource_area_1').innerHTML = 'booga';
|
|
200
200
|
</script>
|
|
@@ -204,6 +204,45 @@ export class XmlResponses {
|
|
|
204
204
|
</partial-response>
|
|
205
205
|
`
|
|
206
206
|
|
|
207
|
+
static HEAD_REPLACE = `
|
|
208
|
+
<partial-response id="j_id__v_0"><changes><update id="jakarta.faces.ViewHead">
|
|
209
|
+
<![CDATA[
|
|
210
|
+
<head>
|
|
211
|
+
<script type="text/javascript" src="../../../xhrCore/fixtures/addedViewHead3.js"></script>
|
|
212
|
+
<link rel="stylesheet" href="../../../xhrCore/fixtures/addedViewHead2.css"></link>
|
|
213
|
+
<script type="text/javascript">
|
|
214
|
+
setTimeout(() => document.getElementById('resource_area_1').innerHTML = 'booga', 100);
|
|
215
|
+
</script>
|
|
216
|
+
</head>
|
|
217
|
+
]]>
|
|
218
|
+
</update>
|
|
219
|
+
</changes>
|
|
220
|
+
</partial-response>
|
|
221
|
+
`
|
|
222
|
+
|
|
223
|
+
static HEAD_REPLACE2 = `
|
|
224
|
+
<partial-response id="j_id__v_0"><changes><update id="jakarta.faces.ViewHead">
|
|
225
|
+
<![CDATA[
|
|
226
|
+
<head>
|
|
227
|
+
<title>After Update</title>
|
|
228
|
+
<meta charset="UTF-8">
|
|
229
|
+
<meta name="description" content="Free Web tutorials">
|
|
230
|
+
<meta name="keywords" content="HTML, CSS, JavaScript, JSF">
|
|
231
|
+
<meta name="viewport" content="width=device-width, initial-scale=0.8">
|
|
232
|
+
<meta name="author" content="Whoever">
|
|
233
|
+
<script type="text/javascript" src="../../../xhrCore/fixtures/addedViewHead3.js"></script>
|
|
234
|
+
<link rel="stylesheet" href="../../../xhrCore/fixtures/addedViewHead2.css"></link>
|
|
235
|
+
<script type="text/javascript">
|
|
236
|
+
setTimeout(() => document.getElementById('resource_area_1').innerHTML = 'booga', 100);
|
|
237
|
+
</script>
|
|
238
|
+
</head>
|
|
239
|
+
]]>
|
|
240
|
+
</update>
|
|
241
|
+
</changes>
|
|
242
|
+
</partial-response>
|
|
243
|
+
`
|
|
244
|
+
|
|
245
|
+
|
|
207
246
|
static NONCE_REPLY = `
|
|
208
247
|
<partial-response><changes><update id='nonce_result'>
|
|
209
248
|
<![CDATA[<script nonce='test12d3' type='text/javascript' src='http://foobaz/nonce_script.js'></script>]]>
|
|
@@ -20,7 +20,7 @@ import {expect} from 'chai';
|
|
|
20
20
|
import * as sinon from 'sinon';
|
|
21
21
|
|
|
22
22
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
23
|
-
import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
|
|
23
|
+
import {CTX_PARAM_REQ_PASS_THR, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
|
|
24
24
|
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
25
25
|
|
|
26
26
|
|
|
@@ -60,9 +60,9 @@ describe('faces.ajax.request test suite', () => {
|
|
|
60
60
|
expect(addRequestToQueue.callCount).to.eq(1);
|
|
61
61
|
const context = (<Config>addRequestToQueue.args[0][2]);
|
|
62
62
|
|
|
63
|
-
expect(context.getIf(
|
|
63
|
+
expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_RENDER).value).eq("@all");
|
|
64
64
|
//Execute issuing form due to @form and always the issuing element
|
|
65
|
-
expect(context.getIf(
|
|
65
|
+
expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value).eq("blarg input_2");
|
|
66
66
|
} finally {
|
|
67
67
|
//once done we restore the proper state
|
|
68
68
|
addRequestToQueue.restore();
|
|
@@ -20,7 +20,7 @@ import {expect} from 'chai';
|
|
|
20
20
|
import * as sinon from 'sinon';
|
|
21
21
|
|
|
22
22
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
23
|
-
import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
|
|
23
|
+
import {CTX_PARAM_REQ_PASS_THR, P_EXECUTE, P_RENDER} from "../../impl/core/Const";
|
|
24
24
|
import defaultMyFaces23 = StandardInits.defaultMyFaces23;
|
|
25
25
|
|
|
26
26
|
|
|
@@ -60,9 +60,9 @@ describe('javax.ajax.request test suite', () => {
|
|
|
60
60
|
expect(addRequestToQueue.callCount).to.eq(1);
|
|
61
61
|
const context = (<Config>addRequestToQueue.args[0][2]);
|
|
62
62
|
|
|
63
|
-
expect(context.getIf(
|
|
63
|
+
expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_RENDER).value).eq("@all");
|
|
64
64
|
//Execute issuing form due to @form and always the issuing element
|
|
65
|
-
expect(context.getIf(
|
|
65
|
+
expect(context.getIf(CTX_PARAM_REQ_PASS_THR, P_EXECUTE).value).eq("blarg input_2");
|
|
66
66
|
} finally {
|
|
67
67
|
//once done we restore the proper state
|
|
68
68
|
addRequestToQueue.restore();
|
|
@@ -120,10 +120,6 @@ describe('javax.ajax.request test suite', () => {
|
|
|
120
120
|
expect(!!called["func5"]).to.be.false;
|
|
121
121
|
|
|
122
122
|
});
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
123
|
});
|
|
128
124
|
|
|
129
125
|
|
|
@@ -108,7 +108,7 @@ describe('tests the addOnEvent and addOnError handling', function () {
|
|
|
108
108
|
expect(onErrorCalled1).to.eq(1);
|
|
109
109
|
expect(onErrorCalled2).to.eq(1);
|
|
110
110
|
expect(errorTitle).to.eq('Erro21');
|
|
111
|
-
expect(errorMessage).to.eq('Error2 Text');
|
|
111
|
+
expect(errorMessage).to.eq('serverError: Error2 Text');
|
|
112
112
|
});
|
|
113
113
|
|
|
114
114
|
it("must have an id set if there is an emitting element", function () {
|
|
@@ -17,7 +17,7 @@ import {describe, it} from "mocha";
|
|
|
17
17
|
import * as sinon from "sinon";
|
|
18
18
|
import {expect} from "chai";
|
|
19
19
|
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
20
|
-
import {DomQuery} from "mona-dish";
|
|
20
|
+
import {DomQuery, DQ} from "mona-dish";
|
|
21
21
|
import defaultFileForm = StandardInits.defaultFileForm;
|
|
22
22
|
import {Implementation} from "../../impl/AjaxImpl";
|
|
23
23
|
|
|
@@ -66,6 +66,8 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
66
66
|
const CONTENT_TYPE = "Content-Type";
|
|
67
67
|
const POST = "POST";
|
|
68
68
|
|
|
69
|
+
global["debug_f"] = true;
|
|
70
|
+
|
|
69
71
|
try {
|
|
70
72
|
|
|
71
73
|
let button = DomQuery.byId("input_1");
|
|
@@ -128,11 +130,12 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
128
130
|
const MULTIPART_FORM = "multipart/form-data";
|
|
129
131
|
const POST = "POST";
|
|
130
132
|
|
|
133
|
+
|
|
131
134
|
try {
|
|
132
135
|
let button = DomQuery.byId("input_1");
|
|
133
136
|
|
|
134
137
|
button.addEventListener("click", (event: Event) => {
|
|
135
|
-
faces.ajax.request(event.target, event, {render: '@all', execute: '
|
|
138
|
+
faces.ajax.request(event.target, event, {render: '@all', execute: '@none'});
|
|
136
139
|
}).click();
|
|
137
140
|
|
|
138
141
|
expect(this.requests.length).to.eq(1);
|