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.
Files changed (200) hide show
  1. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  2. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  3. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +1 -0
  4. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +1 -0
  5. package/.nyc_output/processinfo/index.json +1 -1
  6. package/README.md +7 -22
  7. package/dist/docs/assets/main.js +56 -52
  8. package/dist/docs/assets/search.js +1 -1
  9. package/dist/docs/assets/style.css +23 -0
  10. package/dist/docs/functions/faces.ajax.addOnError.html +6 -4
  11. package/dist/docs/functions/faces.ajax.addOnEvent.html +2 -0
  12. package/dist/docs/functions/faces.ajax.request.html +7 -7
  13. package/dist/docs/functions/faces.ajax.response.html +0 -1
  14. package/dist/docs/functions/faces.push.close.html +4 -2
  15. package/dist/docs/functions/faces.push.init.html +19 -7
  16. package/dist/docs/functions/faces.push.open.html +4 -2
  17. package/dist/docs/functions/faces.util.chain.html +3 -3
  18. package/dist/docs/functions/myfaces.ab.html +9 -4
  19. package/dist/docs/functions/myfaces.onOnDomReady.html +72 -0
  20. package/dist/docs/index.html +7 -18
  21. package/dist/docs/modules/myfaces.html +3 -1
  22. package/dist/docs/variables/myfaces.oam.html +2 -1
  23. package/dist/window/faces-development.js +2147 -1779
  24. package/dist/window/faces-development.js.br +0 -0
  25. package/dist/window/faces-development.js.gz +0 -0
  26. package/dist/window/faces-development.js.map +1 -1
  27. package/dist/window/faces.js +1 -1
  28. package/dist/window/faces.js.LICENSE.txt +17 -2
  29. package/dist/window/faces.js.br +0 -0
  30. package/dist/window/faces.js.gz +0 -0
  31. package/dist/window/faces.js.map +1 -1
  32. package/dist/window/jsf-development.js +2156 -1777
  33. package/dist/window/jsf-development.js.br +0 -0
  34. package/dist/window/jsf-development.js.gz +0 -0
  35. package/dist/window/jsf-development.js.map +1 -1
  36. package/dist/window/jsf.js +1 -1
  37. package/dist/window/jsf.js.LICENSE.txt +17 -2
  38. package/dist/window/jsf.js.br +0 -0
  39. package/dist/window/jsf.js.gz +0 -0
  40. package/dist/window/jsf.js.map +1 -1
  41. package/package.json +19 -18
  42. package/pom.xml +1 -1
  43. package/src/main/test.xml +23 -0
  44. package/src/main/typescript/@types/definitions/index.d.ts +24 -7
  45. package/src/main/typescript/api/_api.ts +79 -37
  46. package/src/main/typescript/api/jsf.ts +18 -0
  47. package/src/main/typescript/impl/AjaxImpl.ts +168 -78
  48. package/src/main/typescript/impl/PushImpl.ts +63 -38
  49. package/src/main/typescript/impl/core/Const.ts +52 -39
  50. package/src/main/typescript/impl/util/Assertions.ts +16 -8
  51. package/src/main/typescript/impl/util/AsyncQueue.ts +1 -1
  52. package/src/main/typescript/impl/util/AsyncRunnable.ts +4 -4
  53. package/src/main/typescript/impl/util/ExtDomQuery.ts +58 -45
  54. package/src/main/typescript/impl/util/FileUtils.ts +104 -0
  55. package/src/main/typescript/impl/util/HiddenInputBuilder.ts +89 -0
  56. package/src/main/typescript/impl/util/Lang.ts +30 -31
  57. package/src/main/typescript/impl/xhrCore/ErrorData.ts +15 -10
  58. package/src/main/typescript/impl/xhrCore/EventData.ts +2 -2
  59. package/src/main/typescript/impl/xhrCore/IResponseProcessor.ts +25 -11
  60. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +78 -32
  61. package/src/main/typescript/impl/xhrCore/ResonseDataResolver.ts +10 -10
  62. package/src/main/typescript/impl/xhrCore/Response.ts +66 -49
  63. package/src/main/typescript/impl/xhrCore/ResponseProcessor.ts +202 -131
  64. package/src/main/typescript/impl/xhrCore/XhrFormData.ts +79 -166
  65. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +80 -68
  66. package/src/main/typescript/myfaces/OamSubmit.ts +29 -13
  67. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +19 -22
  68. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +108 -1
  69. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +40 -1
  70. package/src/main/typescript/test/impl/ImplTest.spec.ts +3 -3
  71. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +3 -7
  72. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +1 -1
  73. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +5 -2
  74. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +203 -0
  75. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +177 -0
  76. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +158 -17
  77. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +242 -11
  78. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +39 -3
  79. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +373 -35
  80. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +43 -9
  81. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +109 -0
  82. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +67 -49
  83. package/src/main/typescript/test.xml +6 -0
  84. package/src/main/typescript/tsconfig.json +1 -1
  85. package/src/test/resources/jsf-development.js +1 -1
  86. package/src/tmp/test.html +12 -88
  87. package/target/api/_api.js +72 -31
  88. package/target/api/_api.js.map +1 -1
  89. package/target/api/jsf.js +11 -0
  90. package/target/api/jsf.js.map +1 -1
  91. package/target/classes/com/example/jsfs_js_ts/DecoratedFacesJS.class +0 -0
  92. package/target/classes/com/example/jsfs_js_ts/DecoratingResourceHandlerWrapper.class +0 -0
  93. package/target/classes/com/example/jsfs_js_ts/FacesJSMapFileResourceWrapper.class +0 -0
  94. package/target/classes/com/example/jsfs_js_ts/FacesJSMappingDecorator.class +0 -0
  95. package/target/impl/AjaxImpl.js +144 -59
  96. package/target/impl/AjaxImpl.js.map +1 -1
  97. package/target/impl/PushImpl.js +66 -35
  98. package/target/impl/PushImpl.js.map +1 -1
  99. package/target/impl/core/Const.js +51 -38
  100. package/target/impl/core/Const.js.map +1 -1
  101. package/target/impl/core/Context.js +10 -0
  102. package/target/impl/core/Context.js.map +1 -0
  103. package/target/impl/util/Assertions.js +12 -7
  104. package/target/impl/util/Assertions.js.map +1 -1
  105. package/target/impl/util/AsyncQueue.js.map +1 -1
  106. package/target/impl/util/ExtDomQuery.js +58 -40
  107. package/target/impl/util/ExtDomQuery.js.map +1 -1
  108. package/target/impl/util/FileUtils.js +96 -0
  109. package/target/impl/util/FileUtils.js.map +1 -0
  110. package/target/impl/util/HiddenElementBuilder.js +7 -0
  111. package/target/impl/util/HiddenElementBuilder.js.map +1 -0
  112. package/target/impl/util/HiddenInputBuilder.js +79 -0
  113. package/target/impl/util/HiddenInputBuilder.js.map +1 -0
  114. package/target/impl/util/Lang.js +29 -30
  115. package/target/impl/util/Lang.js.map +1 -1
  116. package/target/impl/util/URLCodec.js +77 -0
  117. package/target/impl/util/URLCodec.js.map +1 -0
  118. package/target/impl/util/XhrQueueController.js +82 -0
  119. package/target/impl/util/XhrQueueController.js.map +1 -0
  120. package/target/impl/xhrCore/ErrorData.js +10 -8
  121. package/target/impl/xhrCore/ErrorData.js.map +1 -1
  122. package/target/impl/xhrCore/EventData.js +1 -1
  123. package/target/impl/xhrCore/EventData.js.map +1 -1
  124. package/target/impl/xhrCore/RequestContext.js +11 -0
  125. package/target/impl/xhrCore/RequestContext.js.map +1 -0
  126. package/target/impl/xhrCore/RequestDataResolver.js +70 -23
  127. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  128. package/target/impl/xhrCore/ResonseDataResolver.js +9 -9
  129. package/target/impl/xhrCore/ResonseDataResolver.js.map +1 -1
  130. package/target/impl/xhrCore/Response.js +44 -29
  131. package/target/impl/xhrCore/Response.js.map +1 -1
  132. package/target/impl/xhrCore/ResponseProcessor.js +182 -116
  133. package/target/impl/xhrCore/ResponseProcessor.js.map +1 -1
  134. package/target/impl/xhrCore/XhrFormData.js +68 -156
  135. package/target/impl/xhrCore/XhrFormData.js.map +1 -1
  136. package/target/impl/xhrCore/XhrQueHandler.js +11 -0
  137. package/target/impl/xhrCore/XhrQueHandler.js.map +1 -0
  138. package/target/impl/xhrCore/XhrQueueController.js +62 -0
  139. package/target/impl/xhrCore/XhrQueueController.js.map +1 -0
  140. package/target/impl/xhrCore/XhrRequest.js +68 -59
  141. package/target/impl/xhrCore/XhrRequest.js.map +1 -1
  142. package/target/myfaces/OamSubmit.js +23 -14
  143. package/target/myfaces/OamSubmit.js.map +1 -1
  144. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +16 -16
  145. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js.map +1 -1
  146. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js +76 -0
  147. package/target/test/frameworkBase/_ext/monadish/ExtendedArrayTest.spec.js.map +1 -0
  148. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js +925 -0
  149. package/target/test/frameworkBase/_ext/monadish/markups/tobago-with-header.js.map +1 -0
  150. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js +112 -0
  151. package/target/test/frameworkBase/_ext/monadish/markups/tobago-without-header.js.map +1 -0
  152. package/target/test/frameworkBase/_ext/shared/StandardInits.js +100 -1
  153. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  154. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +37 -1
  155. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  156. package/target/test/impl/ImplTest.spec.js +2 -2
  157. package/target/test/impl/ImplTest.spec.js.map +1 -1
  158. package/target/test/impl/ImplTest_23.spec.js +2 -2
  159. package/target/test/impl/ImplTest_23.spec.js.map +1 -1
  160. package/target/test/myfaces/OnLoadSpec.js +57 -0
  161. package/target/test/myfaces/OnLoadSpec.js.map +1 -0
  162. package/target/test/xhrCore/EventTests.spec.js +1 -1
  163. package/target/test/xhrCore/EventTests.spec.js.map +1 -1
  164. package/target/test/xhrCore/FileUploadTest.spec.js +2 -1
  165. package/target/test/xhrCore/FileUploadTest.spec.js.map +1 -1
  166. package/target/test/xhrCore/NamespacesRequestTest.spec.js +204 -0
  167. package/target/test/xhrCore/NamespacesRequestTest.spec.js.map +1 -0
  168. package/target/test/xhrCore/OamSubmitTest.spec.js +180 -0
  169. package/target/test/xhrCore/OamSubmitTest.spec.js.map +1 -0
  170. package/target/test/xhrCore/RequestParamsTest.spec.js +142 -10
  171. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  172. package/target/test/xhrCore/RequestTest.spec.js +217 -9
  173. package/target/test/xhrCore/RequestTest.spec.js.map +1 -1
  174. package/target/test/xhrCore/RequestTest_23.spec.js +34 -2
  175. package/target/test/xhrCore/RequestTest_23.spec.js.map +1 -1
  176. package/target/test/xhrCore/ResponseTest.spec.js +308 -24
  177. package/target/test/xhrCore/ResponseTest.spec.js.map +1 -1
  178. package/target/test/xhrCore/ResponseTest23.spec.js +38 -8
  179. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  180. package/target/test/xhrCore/TobagoFileUploadTest.spec.js +128 -0
  181. package/target/test/xhrCore/TobagoFileUploadTest.spec.js.map +1 -0
  182. package/target/test/xhrCore/XhrFormDataTest.spec.js +57 -34
  183. package/target/test/xhrCore/XhrFormDataTest.spec.js.map +1 -1
  184. package/target/test-classes/.gz +0 -0
  185. package/target/test-classes/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.class +0 -0
  186. package/target/test-classes/fileuploadtest.html +24 -0
  187. package/target/test-classes/jsf-development.js +3559 -0
  188. package/target/test-classes/jsf-development.js.br +0 -0
  189. package/target/test-classes/jsf-development.js.gz +0 -0
  190. package/target/test-classes/jsf-development.js.map +1 -0
  191. package/target/test-classes/jsf.js +3 -0
  192. package/target/test-classes/jsf.js.br +0 -0
  193. package/target/test-classes/jsf.js.gz +0 -0
  194. package/tmp.xml +36 -0
  195. package/.nyc_output/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  196. package/.nyc_output/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  197. package/.nyc_output/processinfo/2303b649-59d9-485c-9228-73b0ec8787a7.json +0 -1
  198. package/.nyc_output/processinfo/756f2f03-c85b-4cdb-9b92-5799eb45ef1e.json +0 -1
  199. package/target/types/index.js +0 -18
  200. 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,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;gBACzC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;gBAEnB,IAAI,CAAC,OAAO,GAAG,CAAC,QAAgB,EAAkB,EAAE;oBAClD,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;oBACnC,MAAM,CAAC,YAAY,GAAG,UAAU,CAAC;oBACjC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,EAAC,cAAc,EAAE,UAAU,EAAC,EAAE,QAAQ,CAAC,CAAC;oBAC5D,OAAO,MAAM,CAAC;gBAChB,CAAC,CAAC;gBAEF,IAAI,CAAC,GAAG,CAAC,QAAQ,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C,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC;YAC5E,IAAA,aAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;YACnE,IAAA,aAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,6BAA6B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;YACpE,IAAA,aAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;YACpE,IAAA,aAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;YACjE,IAAA,aAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC;YACvD,IAAA,aAAM,EAAC,QAAQ,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;SAE9E;gBAAS;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
- let dom = new JSDOM(`
51
- <!DOCTYPE html>
52
- <html lang="en">
53
- <head>
54
- <meta charset="UTF-8">
55
- <title>Title</title>
56
- </head>
57
- <body>
58
- <div id="id_1"></div>
59
- <div id="id_2" booga="blarg"></div>
60
- <div id="id_3"></div>
61
- <div id="id_4"></div>
62
- </body>
63
- </html>
64
-
65
- `, {
66
- contentType: "text/html",
67
- runScripts: "dangerously"
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
- this.afterEach(function () {
85
- global.XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
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;;;;;;;;;;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AAE;gBACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,CAAC,CAAC;YACI,MAAO,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC;YACxC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC;QAErC,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,SAAS,CAAC;YACL,MAAO,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;QAC9E,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,IAAA,UAAE,EAAC,sCAAsC,EAAE;QACvC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,GAAG;;;;;;;;;;;;YAY7B,CAAC;QAEL,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC;QACtB,MAAM,WAAW,GAAG,IAAI,yBAAW,CAAC,cAAE,CAAC,IAAI,CAAC,YAAY,CAAC,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>