jsf.js_next_gen 4.0.0-beta-4 → 4.0.0-beta-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/window/faces-development.js +1952 -2468
- package/dist/window/faces-development.js.br +0 -0
- package/dist/window/faces-development.js.gz +0 -0
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.br +0 -0
- package/dist/window/faces.js.gz +0 -0
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +1926 -2469
- package/dist/window/jsf-development.js.br +0 -0
- package/dist/window/jsf-development.js.gz +0 -0
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.br +0 -0
- package/dist/window/jsf.js.gz +0 -0
- package/dist/window/jsf.js.map +1 -1
- package/package.json +2 -2
- package/src/main/typescript/api/_api.ts +258 -0
- package/src/main/typescript/api/faces.ts +17 -245
- package/src/main/typescript/api/jsf.ts +24 -7
- package/src/main/typescript/impl/AjaxImpl.ts +1 -0
- package/src/main/typescript/impl/core/Const.ts +10 -29
- package/src/main/typescript/impl/util/ExtDomQuery.ts +89 -16
- package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +4 -4
- package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +5 -3
- package/src/main/typescript/impl/xhrCore/Response.ts +8 -6
- package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +14 -13
- package/src/main/typescript/impl/xhrCore/XhrFormData.ts +2 -1
- package/src/main/typescript/myfaces/OamSubmit.ts +6 -5
- package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +6 -4
- package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +14 -23
- package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +362 -0
- package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +372 -0
- package/src/main/typescript/tsconfig-typedoc.json +17 -1
- package/src/main/typescript/tsconfig.json +17 -2
- package/src/test/resources/jsf-development.js +1 -1
- package/target/api/Jsf.js +24 -10
- package/target/api/Jsf.js.map +1 -1
- package/target/api/_api.js +246 -0
- package/target/api/_api.js.map +1 -0
- package/target/api/_faces.js +251 -0
- package/target/api/_faces.js.map +1 -0
- package/target/api/faces.js +20 -247
- package/target/api/faces.js.map +1 -1
- package/target/impl/AjaxImpl.js +53 -61
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/PushImpl.js +38 -41
- package/target/impl/PushImpl.js.map +1 -1
- package/target/impl/core/Const.js +10 -33
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/core/ImplTypes.js +9 -14
- package/target/impl/core/ImplTypes.js.map +1 -1
- package/target/impl/i18n/Messages.js +3 -4
- package/target/impl/i18n/Messages.js.map +1 -1
- package/target/impl/util/Assertions.js +9 -18
- package/target/impl/util/Assertions.js.map +1 -1
- package/target/impl/util/AsyncQueue.js +28 -36
- package/target/impl/util/AsyncQueue.js.map +1 -1
- package/target/impl/util/ExtDomQuery.js +153 -133
- package/target/impl/util/ExtDomQuery.js.map +1 -1
- package/target/impl/util/Lang.js +21 -28
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/ErrorData.js +36 -61
- package/target/impl/xhrCore/ErrorData.js.map +1 -1
- package/target/impl/xhrCore/EventData.js +10 -13
- package/target/impl/xhrCore/EventData.js.map +1 -1
- package/target/impl/xhrCore/RequestDataResolver.js +16 -19
- package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
- package/target/impl/xhrCore/ResonseDataResolver.js +17 -16
- package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
- package/target/impl/xhrCore/Response.js +21 -20
- package/target/impl/xhrCore/Response.js.map +1 -1
- package/target/impl/xhrCore/ResponseProcessor.js +126 -140
- package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
- package/target/impl/xhrCore/XhrFormData.js +68 -97
- package/target/impl/xhrCore/XhrFormData.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +81 -91
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/myfaces/OamSubmit.js +20 -18
- package/target/myfaces/OamSubmit.js.map +1 -1
- package/target/test/frameworkBase/LangTest.spec.js +46 -32
- package/target/test/frameworkBase/LangTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +160 -82
- package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js +45 -31
- package/target/test/frameworkBase/_ext/monadish/LangTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js +24 -33
- package/target/test/frameworkBase/_ext/monadish/MappingProbes.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js +8 -8
- package/target/test/frameworkBase/_ext/monadish/MappingTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js +31 -31
- package/target/test/frameworkBase/_ext/monadish/MonadTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js +50 -48
- package/target/test/frameworkBase/_ext/monadish/StreamTest.spec.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/StandardInits.js +235 -132
- package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js +162 -18
- package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
- package/target/test/impl/ImplTest.spec.js +34 -61
- package/target/test/impl/ImplTest.spec.js.map +1 -1
- package/target/test/impl/ImplTest_23.spec.js +35 -64
- package/target/test/impl/ImplTest_23.spec.js.map +1 -1
- package/target/test/impl/SeparatorCharsTest.spec.js +19 -19
- package/target/test/impl/SeparatorCharsTest.spec.js.map +1 -1
- package/target/test/myfaces/OamSubmit.spec.js +34 -41
- package/target/test/myfaces/OamSubmit.spec.js.map +1 -1
- package/target/test/queue/AsynchronousProbe.js +23 -29
- package/target/test/queue/AsynchronousProbe.js.map +1 -1
- package/target/test/queue/AsynchronousQueueTest.spec.js +39 -70
- package/target/test/queue/AsynchronousQueueTest.spec.js.map +1 -1
- package/target/test/xhrCore/EventTests.spec.js +47 -78
- package/target/test/xhrCore/EventTests.spec.js.map +1 -1
- package/target/test/xhrCore/FakeWebsocket.js +14 -16
- package/target/test/xhrCore/FakeWebsocket.js.map +1 -1
- package/target/test/xhrCore/FileUploadTest.spec.js +49 -80
- package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestParamsTest.spec.js +39 -70
- package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest.spec.js +76 -113
- package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
- package/target/test/xhrCore/RequestTest_23.spec.js +332 -0
- package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -0
- package/target/test/xhrCore/ResponseTest.spec.js +118 -87
- package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
- package/target/test/xhrCore/ResponseTest23.spec.js +314 -0
- package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -0
- package/target/test/xhrCore/ShadowDomTest.spec.js +31 -62
- package/target/test/xhrCore/ShadowDomTest.spec.js.map +1 -1
- package/target/test/xhrCore/WebsocketTest.js +60 -93
- package/target/test/xhrCore/WebsocketTest.js.map +1 -1
- package/target/test/xhrCore/XhrFormDataTest.spec.js +41 -15
- package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
- package/webpack.config.js +71 -0
- package/webpack.config.js.map +1 -0
|
@@ -0,0 +1,372 @@
|
|
|
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 {describe} from "mocha";
|
|
18
|
+
import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
|
|
19
|
+
import * as sinon from "sinon";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
import {XmlResponses} from "../frameworkBase/_ext/shared/XmlResponses";
|
|
23
|
+
import {expect} from "chai";
|
|
24
|
+
import protocolPage = StandardInits.protocolPage;
|
|
25
|
+
import {DQ} from "mona-dish";
|
|
26
|
+
import {$nsp} from "../../impl/core/Const";
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
declare var jsf: any;
|
|
30
|
+
declare var Implementation: any;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* response test
|
|
34
|
+
* the idea is simply to pass in a dom
|
|
35
|
+
* the context and a response xml and then check what happens
|
|
36
|
+
* we do not need to to through the entire ajax cyle for that.
|
|
37
|
+
*/
|
|
38
|
+
describe('Tests of the various aspects of the response protocol functionality', function () {
|
|
39
|
+
|
|
40
|
+
beforeEach(async function () {
|
|
41
|
+
let waitForResult = protocolPage(true, false);
|
|
42
|
+
return waitForResult.then((close) => {
|
|
43
|
+
|
|
44
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
45
|
+
this.requests = [];
|
|
46
|
+
|
|
47
|
+
this.respond = (response: string): XMLHttpRequest => {
|
|
48
|
+
response = $nsp(response);
|
|
49
|
+
let xhrReq = this.requests.shift();
|
|
50
|
+
xhrReq.responsetype = "text/xml";
|
|
51
|
+
xhrReq.respond(200, {'Content-Type': 'text/xml'}, response);
|
|
52
|
+
return xhrReq;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
this.xhr.onCreate = (xhr) => {
|
|
56
|
+
this.requests.push(xhr);
|
|
57
|
+
};
|
|
58
|
+
(<any>global).XMLHttpRequest = this.xhr;
|
|
59
|
+
(<any>window).XMLHttpRequest = this.xhr;
|
|
60
|
+
|
|
61
|
+
this.closeIt = () => {
|
|
62
|
+
(<any>global).XMLHttpRequest = (<any>window).XMLHttpRequest = this.xhr.restore();
|
|
63
|
+
Implementation.reset();
|
|
64
|
+
close();
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
afterEach(function () {
|
|
70
|
+
this.closeIt();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it("must have a simple field updated as well as the viewstate", function (done) {
|
|
74
|
+
//DQ.byId("cmd_update_insert").click();
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
let issuer = DQ.byId("cmd_update_insert").click();
|
|
78
|
+
|
|
79
|
+
this.respond(XmlResponses.UPDATE_INSERT_1);
|
|
80
|
+
|
|
81
|
+
expect(DQ.byId("changesArea")
|
|
82
|
+
.html()
|
|
83
|
+
.orElse("fail")
|
|
84
|
+
.value.indexOf("update succeeded 1") != -1)
|
|
85
|
+
.to.be.true;
|
|
86
|
+
|
|
87
|
+
let pos1 = (<string>DQ.byId(document.body).html()
|
|
88
|
+
.value).indexOf("insert before succeeded should display before test1");
|
|
89
|
+
let pos3 = (<string>DQ.byId(document.body).html()
|
|
90
|
+
.value).indexOf("insert after succeeded should display after test1");
|
|
91
|
+
let pos2 = (<string>DQ.byId(document.body).html()
|
|
92
|
+
.value).indexOf("update succeeded 1");
|
|
93
|
+
|
|
94
|
+
expect(pos1 != -1).to.be.true;
|
|
95
|
+
|
|
96
|
+
expect(pos1 < pos2 && pos2 < pos3).to.be.true;
|
|
97
|
+
|
|
98
|
+
let pos4 = (<string>DQ.byId(document.body).html()
|
|
99
|
+
.value).indexOf("embedded script at update succeed");
|
|
100
|
+
|
|
101
|
+
expect(pos4 != -1).to.be.true;
|
|
102
|
+
|
|
103
|
+
done();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
it("must have a simple field updated with the second before update rendering path", function (done) {
|
|
108
|
+
//DQ.byId("cmd_update_insert").click();
|
|
109
|
+
let issuer = DQ.byId("cmd_update_insert").click();
|
|
110
|
+
|
|
111
|
+
this.respond(XmlResponses.UPDATE_INSERT_2);
|
|
112
|
+
|
|
113
|
+
expect(DQ.byId("changesArea")
|
|
114
|
+
.html()
|
|
115
|
+
.orElse("fail")
|
|
116
|
+
.value.indexOf("update succeeded 2") != -1)
|
|
117
|
+
.to.be.true;
|
|
118
|
+
|
|
119
|
+
let pos1 = (<string>DQ.byId(document.body).html()
|
|
120
|
+
.value).indexOf("insert before succeeded should display before test1");
|
|
121
|
+
let pos3 = (<string>DQ.byId(document.body).html()
|
|
122
|
+
.value).indexOf("insert after succeeded should display after test1");
|
|
123
|
+
let pos2 = (<string>DQ.byId(document.body).html()
|
|
124
|
+
.value).indexOf("update succeeded 2");
|
|
125
|
+
|
|
126
|
+
expect(pos1 != -1).to.be.true;
|
|
127
|
+
|
|
128
|
+
expect(pos1 < pos2 && pos2 < pos3).to.be.true;
|
|
129
|
+
|
|
130
|
+
let pos4 = (<string>DQ.byId(document.body).html()
|
|
131
|
+
.value).indexOf("embedded script at update succeed");
|
|
132
|
+
|
|
133
|
+
expect(pos4 != -1).to.be.true;
|
|
134
|
+
|
|
135
|
+
done();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("must have a full body update", function () {
|
|
139
|
+
DQ.byId("cmd_replace").click();
|
|
140
|
+
this.respond(XmlResponses.BODY_REPLACEMENT);
|
|
141
|
+
|
|
142
|
+
//basic replacement
|
|
143
|
+
let newBody = DQ.byId(document.body);
|
|
144
|
+
let newContent = <string>newBody.html().value;
|
|
145
|
+
//standard replacement successful
|
|
146
|
+
expect(newContent.indexOf("<h3>Body replacement test successful</h3>") != -1,
|
|
147
|
+
"elements must be updated").to.be.true;
|
|
148
|
+
//script eval
|
|
149
|
+
expect(newContent.indexOf(">hello from embedded script in replacement body<") != -1,
|
|
150
|
+
"embedded scripts must be executed").to.be.true;
|
|
151
|
+
|
|
152
|
+
//body attributes
|
|
153
|
+
expect(newBody.hasClass("tundra"),
|
|
154
|
+
"attributes must be updated").to.be.true;
|
|
155
|
+
expect(newBody.id.value == "the_id",
|
|
156
|
+
"id must be updated").to.be.true;
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
it("must have a proper workiung head replace", function () {
|
|
161
|
+
DQ.byId("cmd_replace").click();
|
|
162
|
+
this.respond(XmlResponses.HEAD_REPLACEMENT);
|
|
163
|
+
|
|
164
|
+
//basic replacement
|
|
165
|
+
let newHead = DQ.byId(document.head);
|
|
166
|
+
let newBody = DQ.byId(document.body);
|
|
167
|
+
let newContent = <string>newBody.html().value;
|
|
168
|
+
|
|
169
|
+
//standard replacement successful
|
|
170
|
+
//script eval
|
|
171
|
+
//modern browsers block head replacement but you still can eval
|
|
172
|
+
expect(newContent.indexOf(">hello from embedded script in replacement head") != -1,
|
|
173
|
+
"embedded scripts must be executed").to.be.true;
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
it("must have a proper workiung root replace", function () {
|
|
178
|
+
DQ.byId("cmd_replace").click();
|
|
179
|
+
this.respond(XmlResponses.VIEW_ROOT_REPLACEMENT);
|
|
180
|
+
|
|
181
|
+
//basic replacement
|
|
182
|
+
let newHead = DQ.byId(document.head);
|
|
183
|
+
let newBody = DQ.byId(document.body);
|
|
184
|
+
let newContent = <string>newBody.html().value;
|
|
185
|
+
|
|
186
|
+
expect(newHead.isPresent(), " head must exist ").to.be.true;
|
|
187
|
+
|
|
188
|
+
//standard replacement successful
|
|
189
|
+
expect(newContent.indexOf("<h3>Body replacement test successful</h3>") != -1,
|
|
190
|
+
"elements must be updated").to.be.true;
|
|
191
|
+
//script eval
|
|
192
|
+
expect(newContent.indexOf(">hello from embedded script in replacement body<") != -1,
|
|
193
|
+
"embedded scripts must be executed").to.be.true;
|
|
194
|
+
|
|
195
|
+
//body attributes
|
|
196
|
+
expect(newBody.hasClass("tundra"),
|
|
197
|
+
"attributes must be updated").to.be.true;
|
|
198
|
+
expect(newBody.id.value == "the_id",
|
|
199
|
+
"id must be updated").to.be.true;
|
|
200
|
+
|
|
201
|
+
//standard replacement successful
|
|
202
|
+
//script eval
|
|
203
|
+
//modern browsers block head replacement but you still can eval
|
|
204
|
+
expect(newContent.indexOf(">hello from embedded script in replacement head") != -1,
|
|
205
|
+
"embedded scripts must be executed").to.be.true;
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
it("must have a viewstate update to be peformed", function () {
|
|
209
|
+
DQ.byId("cmd_viewstate").click();
|
|
210
|
+
|
|
211
|
+
this.respond(XmlResponses.VIEWSTATE_1);
|
|
212
|
+
let viewStateElem = DQ.byId('javax.faces.ViewState');
|
|
213
|
+
expect(viewStateElem.inputValue.value == "hello world").to.be.true;
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it("must have processed a proper delete", function () {
|
|
217
|
+
DQ.byId("cmd_delete").click();
|
|
218
|
+
|
|
219
|
+
this.respond(XmlResponses.DELETE_1);
|
|
220
|
+
|
|
221
|
+
expect(DQ.byId("deletable").isAbsent()).to.be.true;
|
|
222
|
+
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it("must have processed a proper eval of a script given in the eval tag", function () {
|
|
226
|
+
let issuer = DQ.byId("cmd_eval").click();
|
|
227
|
+
|
|
228
|
+
this.respond(XmlResponses.EVAL_1);
|
|
229
|
+
|
|
230
|
+
let resultHTML: string = <string>DQ.byId(document.body).html().value;
|
|
231
|
+
expect(resultHTML.indexOf('eval test succeeded') != -1).to.be.true;
|
|
232
|
+
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it("must have updated the viewstates properly", function () {
|
|
236
|
+
|
|
237
|
+
let issuer = DQ.byId("cmd_eval").click();
|
|
238
|
+
|
|
239
|
+
/*js full submit form, coming from the integration tests*/
|
|
240
|
+
window.document.body.innerHTML = `<form id="j_id__v_0" name="j_id__v_0" method="post" action="/IntegrationJSTest/integrationtestsjasmine/test7-eventtest.jsf"
|
|
241
|
+
enctype="application/x-www-form-urlencoded"><span id="updatePanel">hello world</span><a href="#"
|
|
242
|
+
onclick="return (faces || jsf).util.chain(this, event,'return false;', 'return myfaces.ab(\'j_id_1l\',\'updateTrigger\');');"
|
|
243
|
+
id="updateTrigger"
|
|
244
|
+
name="updateTrigger"
|
|
245
|
+
class="updateTrigger">[Press
|
|
246
|
+
me for Update]</a><input type="hidden" name="j_id_1l_SUBMIT" value="1">
|
|
247
|
+
</form>`;
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
jsf.ajax.request(window.document.getElementById("updateTrigger"), null, {
|
|
251
|
+
render: "updatePanel",
|
|
252
|
+
execute: "updatePanel updateTrigger"
|
|
253
|
+
});
|
|
254
|
+
(global as any)["MF_23"] = true;
|
|
255
|
+
// language=XML
|
|
256
|
+
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
257
|
+
<partial-response id="j_id__v_0">
|
|
258
|
+
<changes>
|
|
259
|
+
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
|
|
260
|
+
<update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]></update>
|
|
261
|
+
</changes>
|
|
262
|
+
</partial-response>`);
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
expect(DQ.byId("javax.faces.ViewState").isAbsent()).to.be.false;
|
|
266
|
+
|
|
267
|
+
expect((<HTMLInputElement>document.getElementsByName("javax.faces.ViewState")[0]).value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
268
|
+
expect(DQ.byId("javax.faces.ViewState").inputValue.value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
it("must have updated the viewstates properly with lenient update block", function () {
|
|
273
|
+
|
|
274
|
+
let issuer = DQ.byId("cmd_eval").click();
|
|
275
|
+
|
|
276
|
+
/*js full submit form, coming from the integration tests*/
|
|
277
|
+
window.document.body.innerHTML = `<form id="j_id__v_0" name="j_id__v_0" method="post" action="/IntegrationJSTest/integrationtestsjasmine/test7-eventtest.jsf"
|
|
278
|
+
enctype="application/x-www-form-urlencoded"><span id="updatePanel">hello world</span><a href="#"
|
|
279
|
+
onclick="return jsf.util.chain(this, event,'return false;', 'return myfaces.ab(\'j_id_1l\',\'updateTrigger\');');"
|
|
280
|
+
id="updateTrigger"
|
|
281
|
+
name="updateTrigger"
|
|
282
|
+
class="updateTrigger">[Press
|
|
283
|
+
me for Update]</a><input type="hidden" name="j_id_1l_SUBMIT" value="1">
|
|
284
|
+
</form>`;
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
jsf.ajax.request(window.document.getElementById("updateTrigger"), null, {
|
|
288
|
+
render: "updatePanel",
|
|
289
|
+
execute: "updatePanel updateTrigger"
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// language=XML
|
|
293
|
+
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
294
|
+
<partial-response id="j_id__v_0">
|
|
295
|
+
<changes>
|
|
296
|
+
<update id="updatePanel"><![CDATA[<span id="updatePanel">hello world</span>]]></update>
|
|
297
|
+
<update id="j_id__v_0:javax.faces.ViewState:1"><![CDATA[RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD]]><!--
|
|
298
|
+
Some random junk which is sent by the server
|
|
299
|
+
--></update>
|
|
300
|
+
</changes>
|
|
301
|
+
</partial-response>`);
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
expect(DQ.byId("javax.faces.ViewState").isAbsent()).to.be.false;
|
|
305
|
+
|
|
306
|
+
expect((<HTMLInputElement>document.getElementById("javax.faces.ViewState")).value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
307
|
+
expect(DQ.byId("javax.faces.ViewState").inputValue.value == "RTUyRDI0NzE4QzAxM0E5RDAwMDAwMDVD").to.be.true;
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* The body innerHTML is based on a Tobago page. View state and client window id is rendered within a
|
|
313
|
+
* jsf-state-container.
|
|
314
|
+
* Beside the tobago-out tag, the view state and the client window id must be updated properly.
|
|
315
|
+
*/
|
|
316
|
+
it("must have updated the client window tag properly", function () {
|
|
317
|
+
window.document.body.innerHTML = `<tobago-page locale='en' class='container-fluid' id='page'>
|
|
318
|
+
<form action='/IntegrationJSTest/integrationtestsjasmine/tobago-jfwid-test.jsf' id='page::form' method='post' accept-charset='UTF-8' data-tobago-context-path=''>
|
|
319
|
+
<input type='hidden' name='javax.faces.source' id='javax.faces.source' disabled='disabled'>
|
|
320
|
+
<tobago-focus id='page::lastFocusId'>
|
|
321
|
+
<input type='hidden' name='page::lastFocusId' id='page::lastFocusId::field'>
|
|
322
|
+
</tobago-focus>
|
|
323
|
+
<input type='hidden' name='org.apache.myfaces.tobago.webapp.Secret' id='org.apache.myfaces.tobago.webapp.Secret' value='SLrPlxqLEaR/oYFLSu4wgg=='>
|
|
324
|
+
<tobago-in id='page:input' class='tobago-margin-bottom'>
|
|
325
|
+
<input type='text' name='page:input' id='page:input::field' class='tobago-in form-control' value='Alice'>
|
|
326
|
+
<tobago-behavior event='change' client-id='page:input' field-id='page:input::field' execute='page:input' render='page:output'></tobago-behavior>
|
|
327
|
+
</tobago-in>
|
|
328
|
+
<div id='page:output' class='tobago-margin-bottom'>
|
|
329
|
+
<tobago-out class='form-control-plaintext'></tobago-out>
|
|
330
|
+
</div>
|
|
331
|
+
<div class='tobago-page-menuStore'></div>
|
|
332
|
+
<span id='page::jsf-state-container'>
|
|
333
|
+
<input type='hidden' name='javax.faces.ViewState' id='j_id__v_0:javax.faces.ViewState:1' value='RkExQ0Q1NTYzOTNCNzg0RjAwMDAwMDE4' autocomplete='off'>
|
|
334
|
+
<input type='hidden' name='javax.faces.RenderKitId' value='tobago'>
|
|
335
|
+
<input type='hidden' id='j_id__v_0:javax.faces.ClientWindow:1' name='javax.faces.ClientWindow' value='5m10kooxi'>
|
|
336
|
+
</span>
|
|
337
|
+
</form>
|
|
338
|
+
</tobago-page>`;
|
|
339
|
+
|
|
340
|
+
expect(DQ.querySelectorAll("#page\\:output tobago-out").textContent() === "").to.be.true;
|
|
341
|
+
expect(DQ.byId("j_id__v_0:javax.faces.ViewState:1").isAbsent()).to.be.false;
|
|
342
|
+
expect(DQ.byId("j_id__v_0:javax.faces.ClientWindow:1").isAbsent()).to.be.false;
|
|
343
|
+
|
|
344
|
+
jsf.ajax.request(window.document.getElementById("page:input"), "change", {
|
|
345
|
+
"javax.faces.behavior.event": "change",
|
|
346
|
+
execute: "page:input",
|
|
347
|
+
render: "page:output"
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
this.respond(`<?xml version="1.0" encoding="UTF-8"?>
|
|
351
|
+
<partial-response id='j_id__v_0'>
|
|
352
|
+
<changes>
|
|
353
|
+
<update id='page:output'><![CDATA[
|
|
354
|
+
<div id='page:output' class='tobago-margin-bottom'>
|
|
355
|
+
<tobago-out class='form-control-plaintext'>Alice</tobago-out>
|
|
356
|
+
</div>]]>
|
|
357
|
+
</update>
|
|
358
|
+
<update id='j_id__v_0:javax.faces.ViewState:1'><![CDATA[MDQwQzkxNkU0MTg0RTQxRjAwMDAwMDE3]]>
|
|
359
|
+
</update>
|
|
360
|
+
<update id='j_id__v_0:javax.faces.ClientWindow:1'><![CDATA[5m10kooxg]]>
|
|
361
|
+
</update>
|
|
362
|
+
</changes>
|
|
363
|
+
</partial-response>`);
|
|
364
|
+
|
|
365
|
+
expect(DQ.querySelectorAll("#page\\:output tobago-out").textContent() === "Alice").to.be.true;
|
|
366
|
+
expect(DQ.byId("j_id__v_0:javax.faces.ViewState:1").isAbsent()).to.be.false;
|
|
367
|
+
expect(DQ.byId("j_id__v_0:javax.faces.ClientWindow:1").isAbsent()).to.be.false;
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
//TODO update head all and redirect
|
|
372
|
+
});
|
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright ownership.
|
|
5
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
6
|
+
* (the "License"); you may not use this file except in compliance with
|
|
7
|
+
* the License. You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
/*
|
|
2
18
|
Special config to generate the tsdocs
|
|
3
19
|
*/
|
|
@@ -8,7 +24,7 @@ Special config to generate the tsdocs
|
|
|
8
24
|
|
|
9
25
|
},
|
|
10
26
|
"typedocOptions": {
|
|
11
|
-
"entryPoints": ["api/
|
|
27
|
+
"entryPoints": ["api/_api.ts"],
|
|
12
28
|
"out": "../../../dist/docs",
|
|
13
29
|
"externalPattern": "**/node_modules/**",
|
|
14
30
|
"exclude": "**/{node_modules,test,doc,impl,myfaces}/**/*",
|
|
@@ -1,8 +1,23 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
3
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
4
|
+
* this work for additional information regarding copyright ownership.
|
|
5
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
6
|
+
* (the "License"); you may not use this file except in compliance with
|
|
7
|
+
* the License. You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
1
17
|
{
|
|
2
18
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
19
|
+
"target": "es2015",
|
|
4
20
|
"lib": [
|
|
5
|
-
"es5",
|
|
6
21
|
"es2015.collection",
|
|
7
22
|
"dom"
|
|
8
23
|
],
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
|
|
15
15
|
/***/ "./src/main/typescript/api/Jsf.ts":
|
|
16
16
|
/*!****************************************!*\
|
|
17
|
-
!*** ./src/main/typescript/api/
|
|
17
|
+
!*** ./src/main/typescript/api/_api.ts ***!
|
|
18
18
|
\****************************************/
|
|
19
19
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
20
20
|
|
package/target/api/Jsf.js
CHANGED
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var _a;
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.jsf = void 0;
|
|
5
1
|
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
6
2
|
* contributor license agreements. See the NOTICE file distributed with
|
|
7
3
|
* this work for additional information regarding copyright ownership.
|
|
@@ -17,16 +13,34 @@ exports.jsf = void 0;
|
|
|
17
13
|
* See the License for the specific language governing permissions and
|
|
18
14
|
* limitations under the License.
|
|
19
15
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
///<reference types='../../types/typedefs'/>
|
|
17
|
+
"use strict";
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.myfaces = exports.jsf = void 0;
|
|
22
21
|
/**
|
|
23
|
-
* jsf.js
|
|
24
|
-
*
|
|
22
|
+
* jsf.js init layer which provides as per spec the proper
|
|
23
|
+
* window namespace if it does not exist already
|
|
24
|
+
* if this file is included then the code falls back with its namespaces
|
|
25
|
+
* on jsf2.3 or earlier level, for 4.0+ please include faces.js
|
|
25
26
|
*/
|
|
26
27
|
if (!window.jsf) {
|
|
27
|
-
|
|
28
|
+
const faces = require("./_api").faces;
|
|
29
|
+
window['jsf'] = (_a = window === null || window === void 0 ? void 0 : window.jsf) !== null && _a !== void 0 ? _a : faces;
|
|
28
30
|
window.jsf.specversion = 230000;
|
|
29
|
-
(0, Const_1.remapNamespacesFor23)();
|
|
30
31
|
}
|
|
32
|
+
if (!((_b = window === null || window === void 0 ? void 0 : window.myfaces) === null || _b === void 0 ? void 0 : _b.ab)) {
|
|
33
|
+
const myfaces = require("./_api").myfaces;
|
|
34
|
+
//namespace might be extended is not exclusively reserved so we merge
|
|
35
|
+
window["myfaces"] = (_c = window === null || window === void 0 ? void 0 : window.myfaces) !== null && _c !== void 0 ? _c : {};
|
|
36
|
+
if (!((_d = window === null || window === void 0 ? void 0 : window.myfaces) === null || _d === void 0 ? void 0 : _d.ab)) {
|
|
37
|
+
const myfaces = require("./_api").myfaces;
|
|
38
|
+
//namespace might be extended is not exclusively reserved so we merge
|
|
39
|
+
window["myfaces"] = (_e = window === null || window === void 0 ? void 0 : window.myfaces) !== null && _e !== void 0 ? _e : {};
|
|
40
|
+
Object.keys(myfaces).forEach(key => { var _a, _b; return window.myfaces[key] = (_b = (_a = window.myfaces) === null || _a === void 0 ? void 0 : _a[key]) !== null && _b !== void 0 ? _b : myfaces[key]; });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
alert("init");
|
|
31
44
|
exports.jsf = window.jsf;
|
|
45
|
+
exports.myfaces = window.myfaces;
|
|
32
46
|
//# sourceMappingURL=jsf.js.map
|
package/target/api/Jsf.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsf.js","sourceRoot":"","sources":["../../src/main/typescript/api/jsf.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jsf.js","sourceRoot":"","sources":["../../src/main/typescript/api/jsf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,4CAA4C;AAC5C,YAAY,CAAC;;;;AAGb;;;;;GAKG;AACH,IAAG,CAAC,MAAM,CAAC,GAAG,EAAE;IACZ,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC;IACtC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAC,MAAc,aAAd,MAAM,uBAAN,MAAM,CAAU,GAAG,mCAAI,KAAK,CAAC;IAC9C,MAAM,CAAC,GAAG,CAAC,WAAW,GAAG,MAAM,CAAC;CACnC;AACD,IAAG,CAAC,CAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,0CAAE,EAAE,CAAA,EAAE;IACrB,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;IAC1C,qEAAqE;IACrE,MAAM,CAAC,SAAS,CAAC,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,EAAE,CAAC;IAC1C,IAAG,CAAC,CAAA,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,0CAAE,EAAE,CAAA,EAAE;QACrB,MAAM,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC;QAE1C,qEAAqE;QACrE,MAAM,CAAC,SAAS,CAAC,GAAG,MAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,mCAAI,EAAE,CAAC;QAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,eAAC,OAAA,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,MAAA,MAAA,MAAM,CAAC,OAAO,0CAAG,GAAG,CAAC,mCAAI,OAAO,CAAC,GAAG,CAAC,CAAA,EAAA,CAAC,CAAC;KACpG;CAEJ;AACD,KAAK,CAAC,MAAM,CAAC,CAAA;AAEF,QAAA,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;AACjB,QAAA,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC"}
|