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
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
/*! Licensed to the Apache Software Foundation (ASF) under one or more
|
|
36
|
+
* contributor license agreements. See the NOTICE file distributed with
|
|
37
|
+
* this work for additional information regarding copyright ownership.
|
|
38
|
+
* The ASF licenses this file to you under the Apache License, Version 2.0
|
|
39
|
+
* (the "License"); you may not use this file except in compliance with
|
|
40
|
+
* the License. You may obtain a copy of the License at
|
|
41
|
+
*
|
|
42
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
43
|
+
*
|
|
44
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
45
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
46
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
47
|
+
* See the License for the specific language governing permissions and
|
|
48
|
+
* limitations under the License.
|
|
49
|
+
*/
|
|
50
|
+
const mocha_1 = require("mocha");
|
|
51
|
+
const sinon = __importStar(require("sinon"));
|
|
52
|
+
const chai_1 = require("chai");
|
|
53
|
+
const StandardInits_1 = require("../frameworkBase/_ext/shared/StandardInits");
|
|
54
|
+
const mona_dish_1 = require("mona-dish");
|
|
55
|
+
const AjaxImpl_1 = require("../../impl/AjaxImpl");
|
|
56
|
+
var defaultFileForm = StandardInits_1.StandardInits.tobagoFileForm;
|
|
57
|
+
/**
|
|
58
|
+
* specialized tests testing the xhr core behavior when it hits the xmlHttpRequest object
|
|
59
|
+
*/
|
|
60
|
+
(0, mocha_1.describe)('Tests on the xhr core when it starts to call the request', function () {
|
|
61
|
+
beforeEach(function () {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
let waitForResult = defaultFileForm();
|
|
64
|
+
return waitForResult.then((close) => {
|
|
65
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
66
|
+
this.requests = [];
|
|
67
|
+
this.respond = (response) => {
|
|
68
|
+
let xhrReq = this.requests.shift();
|
|
69
|
+
xhrReq.responsetype = "text/xml";
|
|
70
|
+
xhrReq.respond(200, { 'Content-Type': 'text/xml' }, response);
|
|
71
|
+
return xhrReq;
|
|
72
|
+
};
|
|
73
|
+
this.xhr.onCreate = (xhr) => {
|
|
74
|
+
this.requests.push(xhr);
|
|
75
|
+
};
|
|
76
|
+
global.XMLHttpRequest = this.xhr;
|
|
77
|
+
window.XMLHttpRequest = this.xhr;
|
|
78
|
+
this.closeIt = () => {
|
|
79
|
+
global.XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
80
|
+
AjaxImpl_1.Implementation.reset();
|
|
81
|
+
close();
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
afterEach(function () {
|
|
87
|
+
this.closeIt();
|
|
88
|
+
});
|
|
89
|
+
(0, mocha_1.it)('tobago file upload', function (done) {
|
|
90
|
+
let send = sinon.spy(XMLHttpRequest.prototype, "send");
|
|
91
|
+
const POST = "POST";
|
|
92
|
+
try {
|
|
93
|
+
let fileUploadField = mona_dish_1.DomQuery.byId("page:fileAjax::field");
|
|
94
|
+
let actionElement = mona_dish_1.DomQuery.byId("page:fileAjax");
|
|
95
|
+
fileUploadField.addEventListener("change", (event) => {
|
|
96
|
+
faces.ajax.request(actionElement, event, {
|
|
97
|
+
"javax.faces.behavior.event": "change",
|
|
98
|
+
execute: 'page:fileAjax',
|
|
99
|
+
render: null
|
|
100
|
+
});
|
|
101
|
+
}).dispatchEvent(new Event("change"));
|
|
102
|
+
(0, chai_1.expect)(this.requests.length).to.eq(1);
|
|
103
|
+
let request = this.requests[0];
|
|
104
|
+
(0, chai_1.expect)(request.method).to.eq(POST);
|
|
105
|
+
(0, chai_1.expect)(request.async).to.be.true;
|
|
106
|
+
(0, chai_1.expect)(send.called).to.be.true;
|
|
107
|
+
(0, chai_1.expect)(send.callCount).to.eq(1);
|
|
108
|
+
(0, chai_1.expect)(request.requestBody instanceof FormData).to.be.true;
|
|
109
|
+
let formData = request.requestBody;
|
|
110
|
+
(0, chai_1.expect)(formData.get("page::lastFocusId")).to.eq("");
|
|
111
|
+
(0, chai_1.expect)(formData.get("org.apache.myfaces.tobago.webapp.Secret")).to.eq("secretValue");
|
|
112
|
+
(0, chai_1.expect)(formData.get("javax.faces.ViewState")).to.eq("viewStateValue");
|
|
113
|
+
(0, chai_1.expect)(formData.get("javax.faces.RenderKitId")).to.eq("tobago");
|
|
114
|
+
(0, chai_1.expect)(formData.get("javax.faces.ClientWindow")).to.eq("clientWindowValue");
|
|
115
|
+
(0, chai_1.expect)(formData.get("javax.faces.behavior.event")).to.eq("change");
|
|
116
|
+
(0, chai_1.expect)(formData.get("jakarta.faces.partial.event")).to.eq("change");
|
|
117
|
+
(0, chai_1.expect)(formData.get("jakarta.faces.source")).to.eq("page:fileAjax");
|
|
118
|
+
(0, chai_1.expect)(formData.get("jakarta.faces.partial.ajax")).to.eq("true");
|
|
119
|
+
(0, chai_1.expect)(formData.get("page::form")).to.eq("page::form");
|
|
120
|
+
(0, chai_1.expect)(formData.get("jakarta.faces.partial.execute")).to.eq("page:fileAjax");
|
|
121
|
+
}
|
|
122
|
+
finally {
|
|
123
|
+
send.restore();
|
|
124
|
+
}
|
|
125
|
+
done();
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=TobagoFileUploadTest.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TobagoFileUploadTest.spec.js","sourceRoot":"","sources":["../../../src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;GAcG;AACH,iCAAmC;AACnC,6CAA+B;AAC/B,+BAA4B;AAC5B,8EAAyE;AACzE,yCAAmC;AACnC,kDAAmD;AACnD,IAAO,eAAe,GAAG,6BAAa,CAAC,cAAc,CAAC;AAItD;;GAEG;AACH,IAAA,gBAAQ,EAAC,0DAA0D,EAAE;IACnE,UAAU,CAAC;;YAET,IAAI,aAAa,GAAG,eAAe,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;gBAElC,IAA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;YACR,IAAI,CAAC,OAAO,EAAE,CAAC;SAChB;QACD,IAAI,EAAE,CAAC;IACT,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -37,52 +37,74 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
37
37
|
__setModuleDefault(result, mod);
|
|
38
38
|
return result;
|
|
39
39
|
};
|
|
40
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
41
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
42
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
43
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
44
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
45
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
46
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47
|
+
});
|
|
48
|
+
};
|
|
40
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
50
|
const mocha_1 = require("mocha");
|
|
42
51
|
const mona_dish_1 = require("mona-dish");
|
|
43
52
|
const sinon = __importStar(require("sinon"));
|
|
44
53
|
const XhrFormData_1 = require("../../impl/xhrCore/XhrFormData");
|
|
45
54
|
const chai_1 = require("chai");
|
|
55
|
+
const StandardInits_1 = require("../frameworkBase/_ext/shared/StandardInits");
|
|
56
|
+
var defaultMyFaces = StandardInits_1.StandardInits.defaultMyFaces;
|
|
57
|
+
const AjaxImpl_1 = require("../../impl/AjaxImpl");
|
|
46
58
|
const jsdom = require("jsdom");
|
|
47
59
|
const { JSDOM } = jsdom;
|
|
48
60
|
(0, mocha_1.describe)('XhrFormData tests', function () {
|
|
49
61
|
beforeEach(function () {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
let waitForResult = defaultMyFaces();
|
|
64
|
+
return waitForResult.then((close) => {
|
|
65
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
66
|
+
this.requests = [];
|
|
67
|
+
this.xhr.onCreate = (xhr) => {
|
|
68
|
+
this.requests.push(xhr);
|
|
69
|
+
};
|
|
70
|
+
global.XMLHttpRequest = this.xhr;
|
|
71
|
+
window.XMLHttpRequest = this.xhr;
|
|
72
|
+
this.jsfAjaxResponse = sinon.spy(global.faces.ajax, "response");
|
|
73
|
+
this.closeIt = () => {
|
|
74
|
+
global.XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
75
|
+
this.jsfAjaxResponse.restore();
|
|
76
|
+
AjaxImpl_1.Implementation.reset();
|
|
77
|
+
close();
|
|
78
|
+
};
|
|
79
|
+
});
|
|
68
80
|
});
|
|
69
|
-
let window = dom.window;
|
|
70
|
-
global.window = window;
|
|
71
|
-
global.body = window.document.body;
|
|
72
|
-
global.document = window.document;
|
|
73
|
-
global.navigator = {
|
|
74
|
-
language: "en-En"
|
|
75
|
-
};
|
|
76
|
-
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
77
|
-
this.requests = [];
|
|
78
|
-
this.xhr.onCreate = (xhr) => {
|
|
79
|
-
this.requests.push(xhr);
|
|
80
|
-
};
|
|
81
|
-
global.XMLHttpRequest = this.xhr;
|
|
82
|
-
window.XMLHttpRequest = this.xhr;
|
|
83
81
|
});
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
beforeEach(function () {
|
|
83
|
+
let waitForResult = defaultMyFaces();
|
|
84
|
+
return waitForResult.then((close) => {
|
|
85
|
+
global.window = window;
|
|
86
|
+
global.body = window.document.body;
|
|
87
|
+
global.document = window.document;
|
|
88
|
+
global.body.innerHTML = `
|
|
89
|
+
<div id="id_1"></div>
|
|
90
|
+
<div id="id_2" booga="blarg"></div>
|
|
91
|
+
<div id="id_3"></div>
|
|
92
|
+
<div id="id_4"></div>
|
|
93
|
+
`;
|
|
94
|
+
global.navigator = {
|
|
95
|
+
language: "en-En"
|
|
96
|
+
};
|
|
97
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
98
|
+
this.requests = [];
|
|
99
|
+
this.xhr.onCreate = (xhr) => {
|
|
100
|
+
this.requests.push(xhr);
|
|
101
|
+
};
|
|
102
|
+
global.XMLHttpRequest = this.xhr;
|
|
103
|
+
window.XMLHttpRequest = this.xhr;
|
|
104
|
+
});
|
|
105
|
+
this.afterEach(function () {
|
|
106
|
+
global.XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
107
|
+
});
|
|
86
108
|
});
|
|
87
109
|
(0, mocha_1.it)("must have multiple values for a name", function () {
|
|
88
110
|
window.document.body.innerHTML = `<form id="page::form">
|
|
@@ -98,6 +120,7 @@ const { JSDOM } = jsdom;
|
|
|
98
120
|
<span>Cat, Fox</span>
|
|
99
121
|
</div>
|
|
100
122
|
</form>`;
|
|
123
|
+
global.debugf2 = true;
|
|
101
124
|
const xhrFormData = new XhrFormData_1.XhrFormData(mona_dish_1.DQ.byId("page::form"));
|
|
102
125
|
const formData = xhrFormData.toString();
|
|
103
126
|
(0, chai_1.expect)(formData).to.contain("animals=Cat");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"XhrFormDataTest.spec.js","sourceRoot":"","sources":["../../../src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG
|
|
1
|
+
{"version":3,"file":"XhrFormDataTest.spec.js","sourceRoot":"","sources":["../../../src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;;;;;;;;;;;;;;;;;;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AAC,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,WAAW,CAAC,QAAQ,EAAE,CAAC;QAExC,IAAA,aAAM,EAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC3C,IAAA,aAAM,EAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
<head>
|
|
3
|
+
<script type="text/javascript" src="./jsf-development.js"></script>
|
|
4
|
+
</head>
|
|
5
|
+
<body>
|
|
6
|
+
|
|
7
|
+
<form id="form" enctype="multipart/form-data">
|
|
8
|
+
<input type="file" id="form:fileinput" name="form:fileinput"></input>
|
|
9
|
+
<input type="text" id="form:textinput" name="form:textinput"></input>
|
|
10
|
+
<div id="form:booga1">
|
|
11
|
+
<input type="button" id="form:booga1:sourceid" value="click me" onclick="clickIt(event)"></input>
|
|
12
|
+
</div>
|
|
13
|
+
</form>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
<script type="text/javascript">
|
|
17
|
+
function clickIt(evt) {
|
|
18
|
+
jsf.ajax.request(document.getElementById("form:booga1"), evt, {execute:"@this form:fileinput", render:"@form"})
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|