jsf.js_next_gen 4.0.3-beta.4 → 4.0.4-beta.1
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/README.md +12 -1
- package/dist/window/faces-development.js +44 -7
- package/dist/window/faces-development.js.map +1 -1
- package/dist/window/faces.js +1 -1
- package/dist/window/faces.js.map +1 -1
- package/dist/window/jsf-development.js +44 -7
- package/dist/window/jsf-development.js.map +1 -1
- package/dist/window/jsf.js +1 -1
- package/dist/window/jsf.js.map +1 -1
- package/package.json +1 -1
- package/src/main/typescript/impl/AjaxImpl.ts +7 -1
- package/src/main/typescript/impl/core/Const.ts +1 -0
- package/src/main/typescript/impl/util/AsyncRunnable.ts +19 -0
- package/src/main/typescript/impl/util/Lang.ts +7 -1
- package/src/main/typescript/impl/xhrCore/XhrRequest.ts +17 -3
- package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +63 -0
- package/target/impl/AjaxImpl.js +7 -2
- package/target/impl/AjaxImpl.js.map +1 -1
- package/target/impl/core/Const.js +3 -2
- package/target/impl/core/Const.js.map +1 -1
- package/target/impl/util/AsyncRunnable.js +16 -0
- package/target/impl/util/AsyncRunnable.js.map +1 -1
- package/target/impl/util/Lang.js +6 -1
- package/target/impl/util/Lang.js.map +1 -1
- package/target/impl/xhrCore/XhrRequest.js +12 -2
- package/target/impl/xhrCore/XhrRequest.js.map +1 -1
- package/target/test/xhrCore/XhrRequestProgress.spec.js +91 -0
- package/target/test/xhrCore/XhrRequestProgress.spec.js.map +1 -0
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
const StandardInits_1 = require("../frameworkBase/_ext/shared/StandardInits");
|
|
36
|
+
const sinon = __importStar(require("sinon"));
|
|
37
|
+
const AjaxImpl_1 = require("../../impl/AjaxImpl");
|
|
38
|
+
const chai_1 = require("chai");
|
|
39
|
+
var protocolPage = StandardInits_1.StandardInits.protocolPage;
|
|
40
|
+
const jsdom = require("jsdom");
|
|
41
|
+
const { JSDOM } = jsdom;
|
|
42
|
+
describe("Should trigger the progress on xhr request", function () {
|
|
43
|
+
beforeEach(function () {
|
|
44
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
let waitForResult = protocolPage();
|
|
46
|
+
//build up the test fixture
|
|
47
|
+
return waitForResult.then((close) => {
|
|
48
|
+
//we generate an xhr mock class replacement
|
|
49
|
+
this.xhr = sinon.useFakeXMLHttpRequest();
|
|
50
|
+
this.requests = [];
|
|
51
|
+
//we store the requests to have access to them later
|
|
52
|
+
this.xhr.onCreate = (xhr) => {
|
|
53
|
+
this.requests.push(xhr);
|
|
54
|
+
};
|
|
55
|
+
//we anchchor the mock into the fake dom
|
|
56
|
+
global.XMLHttpRequest = this.xhr;
|
|
57
|
+
window.XMLHttpRequest = this.xhr;
|
|
58
|
+
//general cleanup of overloaded resources
|
|
59
|
+
this.closeIt = () => {
|
|
60
|
+
global.XMLHttpRequest = window.XMLHttpRequest = this.xhr.restore();
|
|
61
|
+
AjaxImpl_1.Implementation.reset();
|
|
62
|
+
close();
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
afterEach(function () {
|
|
68
|
+
this.closeIt();
|
|
69
|
+
});
|
|
70
|
+
it("must trigger progress on xhr request", function () {
|
|
71
|
+
let caughtProgressEvents = [];
|
|
72
|
+
faces.ajax.request(document.getElementById("cmd_eval"), null, {
|
|
73
|
+
render: '@form',
|
|
74
|
+
execute: '@form',
|
|
75
|
+
myfaces: {
|
|
76
|
+
onProgress: (event) => {
|
|
77
|
+
caughtProgressEvents.push(event);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
let progressEvent = {};
|
|
82
|
+
let progressEvent2 = {};
|
|
83
|
+
let xhr = this.requests.shift();
|
|
84
|
+
xhr.onprogress(progressEvent);
|
|
85
|
+
xhr.onprogress(progressEvent2);
|
|
86
|
+
(0, chai_1.expect)(caughtProgressEvents.length).to.eq(2);
|
|
87
|
+
(0, chai_1.expect)(caughtProgressEvents[0] === progressEvent).to.eq(true);
|
|
88
|
+
(0, chai_1.expect)(caughtProgressEvents[1] === progressEvent2).to.eq(true);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=XhrRequestProgress.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XhrRequestProgress.spec.js","sourceRoot":"","sources":["../../../src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8EAAyE;AACzE,6CAA+B;AAC/B,kDAAmD;AACnD,+BAA4B;AAC5B,IAAO,YAAY,GAAG,6BAAa,CAAC,YAAY,CAAC;AAEjD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,CAAC;AAGtB,QAAQ,CAAC,4CAA4C,EAAE;IACnD,UAAU,CAAC;;YACP,IAAI,aAAa,GAAG,YAAY,EAAE,CAAC;YAEnC,2BAA2B;YAC3B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;gBAChC,2CAA2C;gBAC3C,IAAI,CAAC,GAAG,GAAG,KAAK,CAAC,qBAAqB,EAAE,CAAC;gBACzC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;gBAEnB,oDAAoD;gBACpD,IAAI,CAAC,GAAG,CAAC,QAAQ,GAAG,CAAC,GAAG,EAAE,EAAE;oBACxB,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAC5B,CAAC,CAAC;gBACF,wCAAwC;gBAClC,MAAO,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC;gBACxC,MAAM,CAAC,cAAc,GAAG,IAAI,CAAC,GAAG,CAAC;gBAEjC,yCAAyC;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