jsf.js_next_gen 1.0.0-beta-20 → 4.0.0-beta-4
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/.mocharc.json +2 -1
- package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +1 -0
- package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +1 -0
- package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +1 -0
- package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -0
- package/.nycrc +2 -1
- package/README.md +12 -0
- package/dist/docs/assets/search.js +1 -1
- package/dist/docs/functions/{jsf.ajax.addOnError.html → faces.ajax.addOnError.html} +11 -11
- package/dist/docs/functions/{jsf.ajax.addOnEvent.html → faces.ajax.addOnEvent.html} +11 -11
- package/dist/docs/functions/{jsf.ajax.request.html → faces.ajax.request.html} +11 -11
- package/dist/docs/functions/{jsf.ajax.response.html → faces.ajax.response.html} +11 -11
- package/dist/docs/functions/{jsf.getClientWindow.html → faces.getClientWindow.html} +12 -12
- package/dist/docs/functions/{jsf.getProjectStage.html → faces.getProjectStage.html} +13 -13
- package/dist/docs/functions/{jsf.getViewState.html → faces.getViewState.html} +13 -13
- package/dist/docs/functions/{jsf.push.close.html → faces.push.close.html} +10 -10
- package/dist/docs/functions/{jsf.push.init.html → faces.push.init.html} +10 -10
- package/dist/docs/functions/{jsf.push.open.html → faces.push.open.html} +10 -10
- package/dist/docs/functions/{jsf.util.chain.html → faces.util.chain.html} +8 -8
- package/dist/docs/functions/myfaces.ab.html +6 -6
- package/dist/docs/index.html +13 -4
- package/dist/docs/modules/{jsf.ajax.html → faces.ajax.html} +14 -14
- package/dist/docs/modules/{jsf.html → faces.html} +22 -22
- package/dist/docs/modules/{jsf.push.html → faces.push.html} +12 -12
- package/dist/docs/modules/{jsf.util.html → faces.util.html} +8 -8
- package/dist/docs/modules/myfaces.html +4 -4
- package/dist/docs/modules.html +5 -5
- package/dist/docs/variables/{jsf.implversion.html → faces.implversion.html} +12 -12
- package/dist/docs/variables/{jsf.separatorchar.html → faces.separatorchar.html} +12 -12
- package/dist/docs/variables/{jsf.specversion.html → faces.specversion.html} +13 -13
- package/dist/docs/variables/myfaces.oam.html +4 -4
- package/dist/window/faces-development.js +7699 -0
- 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 -0
- package/dist/window/faces.js +3 -0
- package/dist/window/faces.js.LICENSE.txt +70 -0
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -0
- package/dist/window/jsf-development.js +244 -150
- 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 +2 -1
- package/dist/window/jsf.js.LICENSE.txt +70 -0
- 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 +6 -6
- package/src/main/types/typedefs.d.ts +2 -0
- package/src/main/typescript/api/{Jsf.ts → faces.ts} +15 -11
- package/src/main/typescript/api/jsf.ts +30 -0
- package/src/main/typescript/impl/AjaxImpl.ts +18 -16
- package/src/main/typescript/impl/PushImpl.ts +4 -4
- package/src/main/typescript/impl/core/Const.ts +53 -15
- package/src/main/typescript/impl/core/ImplTypes.ts +1 -1
- package/src/main/typescript/impl/i18n/Messages.ts +2 -2
- package/src/main/typescript/impl/util/Assertions.ts +2 -2
- package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
- package/src/main/typescript/impl/util/AsyncRunnable.ts +1 -1
- package/src/main/typescript/impl/util/ExtDomQuery.ts +33 -22
- package/src/main/typescript/impl/util/IListener.ts +1 -1
- package/src/main/typescript/impl/util/Lang.ts +1 -1
- package/src/main/typescript/impl/xhrCore/ErrorData.ts +1 -1
- package/src/main/typescript/impl/xhrCore/EventData.ts +3 -2
- package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +1 -1
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +2 -2
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +1 -1
- package/src/main/typescript/impl/xhrCore/Response.ts +3 -3
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +5 -3
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +3 -3
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +5 -6
- package/src/main/typescript/myfaces/OamSubmit.ts +1 -2
- package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/monadish/StreamTest.spec.ts +1 -1
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +59 -28
- package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +4 -4
- package/src/main/typescript/test/impl/ImplTest.spec.ts +13 -13
- package/src/main/typescript/test/impl/ImplTest_23.spec.ts +134 -0
- package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +7 -4
- package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +1 -1
- package/src/main/typescript/test/queue/AsynchronousProbe.ts +1 -1
- package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +2 -2
- package/src/main/typescript/test/xhrCore/EventTests.spec.ts +8 -8
- package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +1 -1
- package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +6 -6
- package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +23 -23
- package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +12 -12
- package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +27 -27
- package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +4 -6
- package/src/main/typescript/test/xhrCore/WebsocketTest.ts +9 -9
- package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +1 -1
- package/src/main/typescript/tsconfig-typedoc.json +1 -1
- package/src/test/resources/jsf-development.js +1 -1
- package/target/api/Jsf.js +17 -245
- package/target/api/Jsf.js.map +1 -1
- package/target/api/faces.js +265 -0
- package/target/api/faces.js.map +1 -0
- package/target/impl/AjaxImpl.js +15 -14
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +4 -4
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +52 -15
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/ImplTypes.js +1 -1
- package/target/impl/i18n/Messages.js +2 -2
- package/target/impl/i18n/Messages.js.map +1 -1
- package/target/impl/util/Assertions.js +2 -2
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +1 -1
- package/target/impl/util/ExtDomQuery.js +28 -17
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/Lang.js +1 -1
- package/target/impl/xhrCore/ErrorData.js +1 -1
- package/target/impl/xhrCore/EventData.js +3 -2
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +2 -2
- package/target/impl/xhrCore/ResonseDataResolver.js +1 -1
- package/target/impl/xhrCore/Response.js +3 -3
- package/target/impl/xhrCore/ResponseProcessor.js +11 -11
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +3 -3
- package/target/impl/xhrCore/XhrRequest.js +5 -4
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +1 -2
- 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/LangTest.spec.js +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +1 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +64 -26
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +4 -4
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +54 -13
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +165 -0
- package/target/test/impl/ImplTest_23.spec.js.map +1 -0
- package/target/test/impl/ImplTest_23.spec_.js +165 -0
- package/target/test/impl/ImplTest_23.spec_.js.map +1 -0
- package/target/test/impl/SeparatorCharsTest.spec.js +7 -3
- package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
- package/target/test/myfaces/OamSubmit.spec.js +1 -1
- package/target/test/queue/AsynchronousProbe.js +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +2 -2
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +7 -7
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FakeWebsocket.js +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +5 -5
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +23 -23
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +11 -11
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest.spec.js +22 -22
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ShadowDomTest.spec.js +3 -4
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +8 -8
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +1 -1
- package/webpack.config.ts +23 -4
- package/integrationdeploy.cmd +0 -4
- package/integrationsdeploy.sh +0 -5
- package/remap.js +0 -44
- package/remap.js.map +0 -1
- package/webpack.config.js +0 -68
- package/webpack.config.js.map +0 -1
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
3
|
+
* this work for additional information regarding copyright ownership.
|
|
4
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
|
6
|
+
* the License. You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {Config} from "mona-dish";
|
|
18
|
+
import {describe, it} from 'mocha';
|
|
19
|
+
import {expect} from 'chai';
|
|
20
|
+
import * as sinon from 'sinon';
|
|
21
|
+
|
|
22
|
+
import {DomQuery} from "mona-dish";
|
|
23
|
+
|
|
24
|
+
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
25
|
+
import {P_EXECUTE, P_RENDER} from "../../impl/core/Const";
|
|
26
|
+
import defaultMyFaces23 = StandardInits.defaultMyFaces23;
|
|
27
|
+
|
|
28
|
+
sinon.reset();
|
|
29
|
+
|
|
30
|
+
declare var jsf: any;
|
|
31
|
+
declare var Implementation: any;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* testing the javax.ajax.request api without triggering any
|
|
35
|
+
* xhr request...
|
|
36
|
+
* the idea is to shim the code which triggers the request out and check what is going in
|
|
37
|
+
* and what is coming out
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
describe('javax.ajax.request test suite', () => {
|
|
41
|
+
|
|
42
|
+
beforeEach(async () => {
|
|
43
|
+
let ret = await defaultMyFaces23();
|
|
44
|
+
return ret;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("jsf.ajax.request can be called", () => {
|
|
48
|
+
//we stub the addRequestToQueue, to enable the request check only
|
|
49
|
+
//without any xhr and response, both will be tested separately for
|
|
50
|
+
//proper behavior
|
|
51
|
+
const Impl = Implementation;
|
|
52
|
+
const addRequestToQueue = sinon.stub(Impl.queueHandler, "addRequestToQueue");
|
|
53
|
+
//now the javax.ajax.request should trigger but should not go into
|
|
54
|
+
//the asynchronous event loop.
|
|
55
|
+
//lets check it out
|
|
56
|
+
|
|
57
|
+
try {
|
|
58
|
+
DomQuery.byId("input_2").addEventListener("click", (event: Event) => {
|
|
59
|
+
jsf.ajax.request(null, event, {render: '@all', execute: '@form'})
|
|
60
|
+
}).click();
|
|
61
|
+
|
|
62
|
+
expect(addRequestToQueue.called).to.be.true;
|
|
63
|
+
expect(addRequestToQueue.callCount).to.eq(1);
|
|
64
|
+
|
|
65
|
+
const argElement = <Config>addRequestToQueue.args[0][2];
|
|
66
|
+
const context = (<Config>addRequestToQueue.args[0][2]);
|
|
67
|
+
|
|
68
|
+
expect(context.getIf("passThrgh", P_RENDER).value).eq("@all");
|
|
69
|
+
//Execute issuing form due to @form and always the issuing element
|
|
70
|
+
expect(context.getIf("passThrgh", P_EXECUTE).value).eq("blarg input_2");
|
|
71
|
+
} finally {
|
|
72
|
+
//once done we restore the proper state
|
|
73
|
+
addRequestToQueue.restore();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
it("javax.ajax.request passthroughs must end up in passthrough", (done) => {
|
|
79
|
+
//TODO implementation
|
|
80
|
+
done();
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("javax.util.chain must work", () => {
|
|
84
|
+
let called = {};
|
|
85
|
+
(<any>window).called = called;
|
|
86
|
+
|
|
87
|
+
let func1 = () => {
|
|
88
|
+
called["func1"] = true;
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
let func2 = `function func2(called) {
|
|
93
|
+
called["func2"] = true;
|
|
94
|
+
return true;
|
|
95
|
+
}`;
|
|
96
|
+
|
|
97
|
+
let func3 = () => {
|
|
98
|
+
called["func3"] = true;
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
let func4 = `return (function func4(called) {
|
|
103
|
+
called["func4"] = true;
|
|
104
|
+
return false;
|
|
105
|
+
})(event)`;
|
|
106
|
+
|
|
107
|
+
let func5 = () => {
|
|
108
|
+
called["func5"] = true;
|
|
109
|
+
return false;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
(window as any).jsf.util.chain(this, called, func1, func2, func3, func4, func5);
|
|
113
|
+
|
|
114
|
+
expect(called["func1"]).to.be.true;
|
|
115
|
+
expect(called["func2"]).to.be.true;
|
|
116
|
+
expect(!!called["func3"]).to.be.true;
|
|
117
|
+
expect(!!called["func4"]).to.be.false;
|
|
118
|
+
expect(!!called["func5"]).to.be.false;
|
|
119
|
+
|
|
120
|
+
called = {};
|
|
121
|
+
(window as any).jsf.util.chain(this, called, func1, func2, func4, func5);
|
|
122
|
+
expect(called["func1"]).to.be.true;
|
|
123
|
+
expect(called["func2"]).to.be.true;
|
|
124
|
+
expect(!!called["func4"]).to.be.true;
|
|
125
|
+
expect(!!called["func5"]).to.be.false;
|
|
126
|
+
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -25,7 +25,7 @@ const jsdom = require("jsdom");
|
|
|
25
25
|
const {JSDOM} = jsdom;
|
|
26
26
|
sinon.reset();
|
|
27
27
|
|
|
28
|
-
declare var
|
|
28
|
+
declare var faces: any;
|
|
29
29
|
declare var Implementation: any;
|
|
30
30
|
|
|
31
31
|
describe('various tests for get separator char', () => {
|
|
@@ -35,7 +35,7 @@ describe('various tests for get separator char', () => {
|
|
|
35
35
|
let waitForResult = defaultMyFaces();
|
|
36
36
|
waitForResult.then((close) => {
|
|
37
37
|
try {
|
|
38
|
-
let separator =
|
|
38
|
+
let separator = faces.separatorchar;
|
|
39
39
|
expect(separator).to.eq(":");
|
|
40
40
|
} finally {
|
|
41
41
|
Implementation.reset();
|
|
@@ -47,12 +47,15 @@ describe('various tests for get separator char', () => {
|
|
|
47
47
|
|
|
48
48
|
it("should have a custom separator char", (done) => {
|
|
49
49
|
|
|
50
|
-
let waitForResult = defaultSeparatorChar("$");
|
|
50
|
+
let waitForResult = defaultSeparatorChar("$", false);
|
|
51
51
|
waitForResult.then((close) => {
|
|
52
52
|
try {
|
|
53
53
|
let separator = Implementation.getSeparatorChar();
|
|
54
54
|
expect(separator).to.eq("$");
|
|
55
55
|
done();
|
|
56
|
+
} catch(ex) {
|
|
57
|
+
console.error(ex);
|
|
58
|
+
expect(false).to.eq(true);
|
|
56
59
|
} finally {
|
|
57
60
|
Implementation.reset();
|
|
58
61
|
close();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -40,7 +40,7 @@ describe('Asynchronous Queue tests', () => {
|
|
|
40
40
|
(<any>global).XMLHttpRequest = this.xhr;
|
|
41
41
|
(<any>window).XMLHttpRequest = this.xhr;
|
|
42
42
|
|
|
43
|
-
this.jsfAjaxResponse = sinon.stub((<any>global).
|
|
43
|
+
this.jsfAjaxResponse = sinon.stub((<any>global).faces.ajax, "response");
|
|
44
44
|
|
|
45
45
|
this.closeIt = () => {
|
|
46
46
|
(<any>global).XMLHttpRequest = (<any>window).XMLHttpRequest = this.xhr.restore();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -24,7 +24,7 @@ import protocolPage = StandardInits.protocolPage;
|
|
|
24
24
|
import {DQ} from "mona-dish";
|
|
25
25
|
import {XmlResponses} from "../frameworkBase/_ext/shared/XmlResponses";
|
|
26
26
|
|
|
27
|
-
declare var
|
|
27
|
+
declare var faces: any;
|
|
28
28
|
|
|
29
29
|
describe('tests the addOnEvent and addOnError handling', function () {
|
|
30
30
|
|
|
@@ -70,7 +70,7 @@ describe('tests the addOnEvent and addOnError handling', function () {
|
|
|
70
70
|
let onEventCalled1 = 0;
|
|
71
71
|
let onEventCalled2 = 0;
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
faces.ajax.addOnEvent((data: any) => {
|
|
74
74
|
onEventCalled1++;
|
|
75
75
|
if (onEventCalled1 == 1 && data.status != "begin") {
|
|
76
76
|
throw ("Wrong status")
|
|
@@ -82,7 +82,7 @@ describe('tests the addOnEvent and addOnError handling', function () {
|
|
|
82
82
|
throw ("Wrong status")
|
|
83
83
|
}
|
|
84
84
|
});
|
|
85
|
-
|
|
85
|
+
faces.ajax.addOnEvent((data: any) => {
|
|
86
86
|
onEventCalled2++;
|
|
87
87
|
|
|
88
88
|
});
|
|
@@ -99,12 +99,12 @@ describe('tests the addOnEvent and addOnError handling', function () {
|
|
|
99
99
|
|
|
100
100
|
let errorTitle = '';
|
|
101
101
|
let errorMessage = '';
|
|
102
|
-
|
|
102
|
+
faces.ajax.addOnError((data: any) => {
|
|
103
103
|
errorTitle = data.errorName;
|
|
104
104
|
errorMessage = data.errorMessage;
|
|
105
105
|
onErrorCalled1++
|
|
106
106
|
});
|
|
107
|
-
|
|
107
|
+
faces.ajax.addOnError((data: any) => {
|
|
108
108
|
onErrorCalled2++;
|
|
109
109
|
});
|
|
110
110
|
|
|
@@ -126,10 +126,10 @@ describe('tests the addOnEvent and addOnError handling', function () {
|
|
|
126
126
|
expect(!!data?.source?.id).to.be.true;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
129
|
+
faces.ajax.addOnEvent((data: any) => {
|
|
130
130
|
assertSourceExists(data);
|
|
131
131
|
});
|
|
132
|
-
|
|
132
|
+
faces.ajax.addOnEvent((data: any) => {
|
|
133
133
|
onEventCalled2++;
|
|
134
134
|
|
|
135
135
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -33,12 +33,12 @@ import STD_XML = StandardInits.STD_XML;
|
|
|
33
33
|
import defaultFileForm = StandardInits.defaultFileForm;
|
|
34
34
|
import {Implementation} from "../../impl/AjaxImpl";
|
|
35
35
|
|
|
36
|
-
declare var
|
|
36
|
+
declare var faces: any;
|
|
37
37
|
declare var Impl
|
|
38
38
|
|
|
39
39
|
|
|
40
40
|
let issueStdReq = function (element) {
|
|
41
|
-
|
|
41
|
+
faces.ajax.request(element, null, {
|
|
42
42
|
execute: "input_1",
|
|
43
43
|
render: "@form",
|
|
44
44
|
pass1: "pass1",
|
|
@@ -95,7 +95,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
95
95
|
let button = DomQuery.byId("input_1");
|
|
96
96
|
|
|
97
97
|
button.addEventListener("click", (event: Event) => {
|
|
98
|
-
|
|
98
|
+
faces.ajax.request(event.target, event, {render: '@all', execute: '@form'})
|
|
99
99
|
}).click();
|
|
100
100
|
//this.resonse("ok");
|
|
101
101
|
|
|
@@ -126,7 +126,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
126
126
|
let button = DomQuery.byId("input_1");
|
|
127
127
|
|
|
128
128
|
button.addEventListener("click", (event: Event) => {
|
|
129
|
-
|
|
129
|
+
faces.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fíleupload'})
|
|
130
130
|
}).click();
|
|
131
131
|
//this.resonse("ok");
|
|
132
132
|
|
|
@@ -157,7 +157,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
157
157
|
let button = DomQuery.byId("input_1");
|
|
158
158
|
|
|
159
159
|
button.addEventListener("click", (event: Event) => {
|
|
160
|
-
|
|
160
|
+
faces.ajax.request(event.target, event, {render: '@all', execute: 'input_1 fileupload'});
|
|
161
161
|
}).click();
|
|
162
162
|
|
|
163
163
|
expect(this.requests.length).to.eq(1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -25,32 +25,32 @@ import { expect } from "chai";
|
|
|
25
25
|
describe("test for proper request param patterns identical to the old implementation", function () {
|
|
26
26
|
const DELETE_PATTERN = {
|
|
27
27
|
op: "delete1",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
28
|
+
"jakarta.faces.source": "cmd_delete",
|
|
29
|
+
"jakarta.faces.partial.event": "click",
|
|
30
|
+
"jakarta.faces.partial.ajax": "true",
|
|
31
|
+
"jakarta.faces.partial.execute": "cmd_delete",
|
|
32
32
|
"form1": "form1",
|
|
33
|
-
"
|
|
33
|
+
"jakarta.faces.ViewState": "blubbblubblubb"
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const UPDATE_INSERT_2 = {
|
|
37
37
|
"op": "updateinsert2",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"
|
|
38
|
+
"jakarta.faces.partial.event": "click",
|
|
39
|
+
"jakarta.faces.source": "cmd_update_insert2",
|
|
40
|
+
"jakarta.faces.partial.ajax": "true",
|
|
41
|
+
"jakarta.faces.partial.execute": "cmd_update_insert2",
|
|
42
42
|
"form1": "form1",
|
|
43
|
-
"
|
|
43
|
+
"jakarta.faces.ViewState": "blubbblubblubb"
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
const ERRORS = {
|
|
47
47
|
"op": "errors",
|
|
48
|
-
"
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"
|
|
48
|
+
"jakarta.faces.partial.event": "click",
|
|
49
|
+
"jakarta.faces.source": "cmd_error",
|
|
50
|
+
"jakarta.faces.partial.ajax": "true",
|
|
51
|
+
"jakarta.faces.partial.execute": "cmd_error",
|
|
52
52
|
"form1": "form1",
|
|
53
|
-
"
|
|
53
|
+
"jakarta.faces.ViewState": "blubbblubblubb"
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/**
|
|
@@ -83,7 +83,7 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
83
83
|
(<any>global).XMLHttpRequest = this.xhr;
|
|
84
84
|
(<any>window).XMLHttpRequest = this.xhr;
|
|
85
85
|
|
|
86
|
-
this.jsfAjaxResponse = sinon.stub((<any>global).
|
|
86
|
+
this.jsfAjaxResponse = sinon.stub((<any>global).faces.ajax, "response");
|
|
87
87
|
|
|
88
88
|
this.closeIt = () => {
|
|
89
89
|
(<any>global).XMLHttpRequest = (<any>window).XMLHttpRequest = this.xhr.restore();
|
|
@@ -111,37 +111,37 @@ describe("test for proper request param patterns identical to the old implementa
|
|
|
111
111
|
|
|
112
112
|
it("must handle base64 encoded strings properly as request data", function() {
|
|
113
113
|
let probe = "YWFhYWFhc1Rlc3RpdCDDpGtvNDU5NjczMDA9PSsrNDU5MGV3b3UkJiUmLyQmJQ==";
|
|
114
|
-
DQ.byId("
|
|
114
|
+
DQ.byId("jakarta.faces.ViewState").inputValue.value = probe;
|
|
115
115
|
DQ.byId("cmd_update_insert2").click();
|
|
116
116
|
let requestBody = this.requests[0].requestBody;
|
|
117
117
|
//We check if the base64 encoded string matches the original
|
|
118
118
|
let formData = new XhrFormData(requestBody);
|
|
119
119
|
|
|
120
|
-
expect(decodeURIComponent(formData.getIf("
|
|
120
|
+
expect(decodeURIComponent(formData.getIf("jakarta.faces.ViewState").value) == probe).to.be.true;
|
|
121
121
|
});
|
|
122
122
|
|
|
123
123
|
|
|
124
124
|
it("must handle empty parameters properly", function() {
|
|
125
125
|
let probe = "";
|
|
126
|
-
DQ.byId("
|
|
126
|
+
DQ.byId("jakarta.faces.ViewState").inputValue.value = probe;
|
|
127
127
|
DQ.byId("cmd_update_insert2").click();
|
|
128
128
|
let requestBody = this.requests[0].requestBody;
|
|
129
129
|
//We check if the base64 encoded string matches the original
|
|
130
130
|
let formData = new XhrFormData(requestBody);
|
|
131
131
|
|
|
132
|
-
expect(decodeURIComponent(formData.getIf("
|
|
132
|
+
expect(decodeURIComponent(formData.getIf("jakarta.faces.ViewState").value) == probe).to.be.true;
|
|
133
133
|
});
|
|
134
134
|
|
|
135
135
|
//KssbpZfCe+0lwDhgMRQ44wRFkaM1o1lbMMUO3lini5YhXWm6
|
|
136
136
|
|
|
137
137
|
it("must handle base64 special cases properly (+ in encoding)", function() {
|
|
138
138
|
let probe = "KssbpZfCe+0lwDhgMRQ44wRFkaM1o1lbMMUO3lini5YhXWm6";
|
|
139
|
-
DQ.byId("
|
|
139
|
+
DQ.byId("jakarta.faces.ViewState").inputValue.value = probe;
|
|
140
140
|
DQ.byId("cmd_update_insert2").click();
|
|
141
141
|
let requestBody = this.requests[0].requestBody;
|
|
142
142
|
//We check if the base64 encoded string matches the original
|
|
143
143
|
let formData = new XhrFormData(requestBody);
|
|
144
144
|
|
|
145
|
-
expect(decodeURIComponent(formData.getIf("
|
|
145
|
+
expect(decodeURIComponent(formData.getIf("jakarta.faces.ViewState").value) == probe).to.be.true;
|
|
146
146
|
});
|
|
147
147
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
2
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
3
3
|
* this work for additional information regarding copyright ownership.
|
|
4
4
|
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
@@ -32,11 +32,11 @@ import {
|
|
|
32
32
|
import defaultMyFaces = StandardInits.defaultMyFaces;
|
|
33
33
|
import STD_XML = StandardInits.STD_XML;
|
|
34
34
|
|
|
35
|
-
declare var
|
|
35
|
+
declare var faces: any;
|
|
36
36
|
declare var Implementation: any;
|
|
37
37
|
|
|
38
38
|
let issueStdReq = function (element) {
|
|
39
|
-
|
|
39
|
+
faces.ajax.request(element, null, {
|
|
40
40
|
execute: "input_1",
|
|
41
41
|
render: "@form",
|
|
42
42
|
pass1: "pass1",
|
|
@@ -62,7 +62,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
62
62
|
(<any>global).XMLHttpRequest = this.xhr;
|
|
63
63
|
(<any>window).XMLHttpRequest = this.xhr;
|
|
64
64
|
|
|
65
|
-
this.jsfAjaxResponse = sinon.spy((<any>global).
|
|
65
|
+
this.jsfAjaxResponse = sinon.spy((<any>global).faces.ajax, "response");
|
|
66
66
|
|
|
67
67
|
this.closeIt = () => {
|
|
68
68
|
(<any>global).XMLHttpRequest = (<any>window).XMLHttpRequest = this.xhr.restore();
|
|
@@ -78,7 +78,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
78
78
|
});
|
|
79
79
|
|
|
80
80
|
it('must have the standard parameters all in', function (done) {
|
|
81
|
-
//issue a standard
|
|
81
|
+
//issue a standard faces.ajax.request upon the standard simple form case and check the passed parameters
|
|
82
82
|
//and whether send was called
|
|
83
83
|
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
84
84
|
|
|
@@ -92,7 +92,7 @@ describe('Tests on the xhr core when it starts to call the request', function ()
|
|
|
92
92
|
expect(send.called).to.be.true;
|
|
93
93
|
expect(send.callCount).to.eq(1);
|
|
94
94
|
|
|
95
|
-
//sent params
|
|
95
|
+
//sent params jakarta.faces.ViewState=null&execute=input_1&render=%40form&pass1=pass1&pass2=pass2&jakarta.faces.windowId=null&jakarta.faces.source=input_2&jakarta.faces.partial.ajax=input_2&blarg=blarg&jakarta.faces.partial.execute=input_1%20input_2&jakarta.faces.partial.render=blarg
|
|
96
96
|
|
|
97
97
|
} finally {
|
|
98
98
|
|
|
@@ -167,7 +167,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
167
167
|
(<any>global).XMLHttpRequest = this.xhr = sinon.useFakeXMLHttpRequest();
|
|
168
168
|
(<any>window).XMLHttpRequest = this.xhr = sinon.useFakeXMLHttpRequest();
|
|
169
169
|
|
|
170
|
-
this.jsfAjaxResponse = sinon.spy((<any>global).
|
|
170
|
+
this.jsfAjaxResponse = sinon.spy((<any>global).faces.ajax, "response");
|
|
171
171
|
|
|
172
172
|
this.closeIt = () => {
|
|
173
173
|
(<any>global).XMLHttpRequest = (<any>window).XMLHttpRequest = this.xhr.restore();
|
|
@@ -189,10 +189,10 @@ describe('Tests after core when it hits response', function () {
|
|
|
189
189
|
let localCnt = 0;
|
|
190
190
|
try {
|
|
191
191
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
192
|
-
|
|
192
|
+
faces.ajax.addOnEvent(() => {
|
|
193
193
|
globalCnt++;
|
|
194
194
|
});
|
|
195
|
-
|
|
195
|
+
faces.ajax.request(element, null, {
|
|
196
196
|
execute: "input_1",
|
|
197
197
|
render: "@form",
|
|
198
198
|
pass1: "pass1",
|
|
@@ -227,12 +227,12 @@ describe('Tests after core when it hits response', function () {
|
|
|
227
227
|
|
|
228
228
|
try {
|
|
229
229
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
230
|
-
|
|
230
|
+
faces.ajax.addOnEvent(() => {
|
|
231
231
|
globalCnt++;
|
|
232
232
|
});
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
|
|
235
|
+
faces.ajax.request(element, null, {
|
|
236
236
|
execute: "input_1",
|
|
237
237
|
render: "@form",
|
|
238
238
|
pass1: "pass1",
|
|
@@ -292,7 +292,7 @@ describe('Tests after core when it hits response', function () {
|
|
|
292
292
|
try {
|
|
293
293
|
let errorCnt = 0;
|
|
294
294
|
let element = DomQuery.byId("input_2").getAsElem(0).value;
|
|
295
|
-
|
|
295
|
+
faces.ajax.request(element, null, {
|
|
296
296
|
execute: "input_1",
|
|
297
297
|
render: "@form",
|
|
298
298
|
pass1: "pass1",
|