jsf.js_next_gen 4.1.0-beta.8 → 4.1.0-beta.9

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 (62) hide show
  1. package/package.json +1 -1
  2. package/src/main/typescript/test/api/MyFacesABTest.spec.ts +117 -0
  3. package/src/main/typescript/test/frameworkBase/LangTest.spec.ts +145 -0
  4. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +798 -0
  5. package/src/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.ts +130 -0
  6. package/src/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.ts +148 -0
  7. package/src/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.ts +46 -0
  8. package/src/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.ts +170 -0
  9. package/src/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.ts +0 -0
  10. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/blank.css +15 -0
  11. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/test.js +16 -0
  12. package/src/main/typescript/test/frameworkBase/_ext/monadish/fixtures/test2.js +16 -0
  13. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.ts +921 -0
  14. package/src/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.ts +108 -0
  15. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +761 -0
  16. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +313 -0
  17. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/css/bootstrap-icons.css +15 -0
  18. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/css/tobago.css +15 -0
  19. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/jakarta.faces.resource/faces.js.jsf +15 -0
  20. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +15 -0
  21. package/src/main/typescript/test/impl/ImplTest.spec.ts +232 -0
  22. package/src/main/typescript/test/impl/ImplTest_23.spec.ts +125 -0
  23. package/src/main/typescript/test/impl/SeparatorCharsTest.spec.ts +82 -0
  24. package/src/main/typescript/test/impl/util/ExtDomQueryTest.spec.ts +68 -0
  25. package/src/main/typescript/test/myfaces/OamSubmit.spec.ts +155 -0
  26. package/src/main/typescript/test/myfaces/OnLoad.spec.ts +52 -0
  27. package/src/main/typescript/test/myfaces/ReserveNamespace.spec.ts +69 -0
  28. package/src/main/typescript/test/queue/AsynchronousProbe.ts +105 -0
  29. package/src/main/typescript/test/queue/AsynchronousQueueTest.spec.ts +108 -0
  30. package/src/main/typescript/test/xhrCore/ClientWindow.spec.ts +79 -0
  31. package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +148 -0
  32. package/src/main/typescript/test/xhrCore/EventTests.spec.ts +164 -0
  33. package/src/main/typescript/test/xhrCore/FakeWebsocket.ts +39 -0
  34. package/src/main/typescript/test/xhrCore/FileUploadTest.spec.ts +162 -0
  35. package/src/main/typescript/test/xhrCore/NamespacesRequestTest.spec.ts +208 -0
  36. package/src/main/typescript/test/xhrCore/OamSubmitTest.spec.ts +185 -0
  37. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +566 -0
  38. package/src/main/typescript/test/xhrCore/RequestTest.spec.ts +920 -0
  39. package/src/main/typescript/test/xhrCore/RequestTest_23.spec.ts +405 -0
  40. package/src/main/typescript/test/xhrCore/ResponseTest.spec.ts +769 -0
  41. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +413 -0
  42. package/src/main/typescript/test/xhrCore/ShadowDomTest.spec.ts +102 -0
  43. package/src/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.ts +117 -0
  44. package/src/main/typescript/test/xhrCore/WebsocketTest.ts +221 -0
  45. package/src/main/typescript/test/xhrCore/XhrFormDataTest.spec.ts +119 -0
  46. package/src/main/typescript/test/xhrCore/XhrRequestProgress.spec.ts +95 -0
  47. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead1.js +16 -0
  48. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead2.css +18 -0
  49. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead2.js +16 -0
  50. package/src/main/typescript/test/xhrCore/fixtures/addedViewHead3.js +16 -0
  51. package/src/main/typescript/test/xhrCore/fixtures/nonce_script.js +16 -0
  52. package/src/test/java/com/example/jsfs_js_ts/JsfsJsTsApplicationTests.java +15 -0
  53. package/src/test/resources/.gz +0 -0
  54. package/src/test/resources/fileuploadtest.html +24 -0
  55. package/src/test/resources/jsf-development.js +3559 -0
  56. package/src/test/resources/jsf-development.js.br +0 -0
  57. package/src/test/resources/jsf-development.js.gz +0 -0
  58. package/src/test/resources/jsf-development.js.map +1 -0
  59. package/src/test/resources/jsf.js +3 -0
  60. package/src/test/resources/jsf.js.br +0 -0
  61. package/src/test/resources/jsf.js.gz +0 -0
  62. package/test/register-swc.cjs +21 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsf.js_next_gen",
3
- "version": "4.1.0-beta.8",
3
+ "version": "4.1.0-beta.9",
4
4
  "description": "A next generation typescript reimplementation of jsf.js",
5
5
  "main": "dist/window/faces.js",
6
6
  "scripts": {
@@ -0,0 +1,117 @@
1
+ import {describe} from "mocha";
2
+ import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
3
+ const defaultMyFaces = StandardInits.defaultMyFaces;
4
+ import {expect} from "chai";
5
+
6
+ describe('API tests', () => {
7
+
8
+ beforeEach(() => {
9
+ return defaultMyFaces();
10
+ });
11
+
12
+ it("must pass into ajax.request properly with user parameters", () => {
13
+ let passedSource = null;
14
+ let passedEvent = null;
15
+ let passedOptions = null;
16
+ let oldRequest = (window?.faces ?? window.jsf).ajax.request;
17
+ try {
18
+ (window?.faces ?? window.jsf).ajax.request = function(source, event, options) {
19
+ passedSource = source;
20
+ passedEvent = event;
21
+ passedOptions = options;
22
+ }
23
+ myfaces.ab(null, null, null, null, null, {}, {booga: "foobaz"});
24
+
25
+ expect(passedSource).to.eq(null);
26
+ expect(passedEvent).to.eq(null);
27
+ expect(passedOptions).to.deep.eq({params:{booga: "foobaz"}});
28
+ } finally {
29
+ (window?.faces ?? window.jsf).ajax.request = oldRequest;
30
+ }
31
+ })
32
+
33
+ it("must pass into ajax.request properly without user parameters", () => {
34
+ let passedSource = null;
35
+ let passedEvent = null;
36
+ let passedOptions = null;
37
+ let oldRequest = (window?.faces ?? window.jsf).ajax.request;
38
+ try {
39
+ (window?.faces ?? window.jsf).ajax.request = function(source, event, options) {
40
+ passedSource = source;
41
+ passedEvent = event;
42
+ passedOptions = options;
43
+ }
44
+ myfaces.ab(null, null, null, null, null, {});
45
+
46
+ expect(passedSource).to.eq(null);
47
+ expect(passedEvent).to.eq(null);
48
+ expect(passedOptions).to.deep.eq({params:{}});
49
+ } finally {
50
+ (window?.faces ?? window.jsf).ajax.request = oldRequest;
51
+ }
52
+ });
53
+
54
+ it("must pass into ajax.request properly with null options", () => {
55
+ let passedSource = null;
56
+ let passedEvent = null;
57
+ let passedOptions = null;
58
+ let oldRequest = (window?.faces ?? window.jsf).ajax.request;
59
+ try {
60
+ (window?.faces ?? window.jsf).ajax.request = function(source, event, options) {
61
+ passedSource = source;
62
+ passedEvent = event;
63
+ passedOptions = options;
64
+ }
65
+ myfaces.ab(null, null, null, null, null, null);
66
+
67
+ expect(passedSource).to.eq(null);
68
+ expect(passedEvent).to.eq(null);
69
+ expect(passedOptions).to.deep.eq({params:{}});
70
+ } finally {
71
+ (window?.faces ?? window.jsf).ajax.request = oldRequest;
72
+ }
73
+ });
74
+
75
+ it("must pass into ajax.request properly with null options and null user options", () => {
76
+ let passedSource = null;
77
+ let passedEvent = null;
78
+ let passedOptions = null;
79
+ let oldRequest = (window?.faces ?? window.jsf).ajax.request;
80
+ try {
81
+ (window?.faces ?? window.jsf).ajax.request = function(source, event, options) {
82
+ passedSource = source;
83
+ passedEvent = event;
84
+ passedOptions = options;
85
+ }
86
+ myfaces.ab(null, null, null, null, null, null, null);
87
+
88
+ expect(passedSource).to.eq(null);
89
+ expect(passedEvent).to.eq(null);
90
+ expect(passedOptions).to.deep.eq({params:{}});
91
+ } finally {
92
+ (window?.faces ?? window.jsf).ajax.request = oldRequest;
93
+ }
94
+ });
95
+
96
+ it("must pass into ajax.request properly without options and user params", () => {
97
+ let passedSource = null;
98
+ let passedEvent = null;
99
+ let passedOptions = null;
100
+ let oldRequest = (window?.faces ?? window.jsf).ajax.request;
101
+ try {
102
+ (window?.faces ?? window.jsf).ajax.request = function(source, event, options) {
103
+ passedSource = source;
104
+ passedEvent = event;
105
+ passedOptions = options;
106
+ }
107
+ myfaces.ab(null, null, null, null, null);
108
+
109
+ expect(passedSource).to.eq(null);
110
+ expect(passedEvent).to.eq(null);
111
+ expect(passedOptions).to.deep.eq({params:{}});
112
+ } finally {
113
+ (window?.faces ?? window.jsf).ajax.request = oldRequest;
114
+ }
115
+ });
116
+
117
+ });
@@ -0,0 +1,145 @@
1
+ import {expect} from 'chai';
2
+ import {describe, it} from 'mocha';
3
+ import {Lang} from "mona-dish";
4
+
5
+ const equalsIgnoreCase = Lang.equalsIgnoreCase;
6
+ const assertType = Lang.assertType;
7
+ const objToArray = Lang.objToArray;
8
+ const isFunc = Lang.isFunc;
9
+ const isString = Lang.isString;
10
+ const trim = Lang.trim;
11
+ const strToArray = Lang.strToArray;
12
+ import {ExtLang} from "../../impl/util/Lang";
13
+ const keyValToStr = ExtLang.keyValToStr;
14
+
15
+
16
+ const jsdom = require("jsdom");
17
+ const {JSDOM} = jsdom;
18
+ const dom = new JSDOM(`
19
+ <!DOCTYPE html>
20
+ <html lang="en">
21
+ <head>
22
+ <meta charset="UTF-8">
23
+ <title>Title</title>
24
+ </head>
25
+ <body>
26
+ <div />
27
+ <div />
28
+ <div />
29
+ <div />
30
+ </body>
31
+ </html>
32
+
33
+ `)
34
+
35
+ export const window = dom.window;
36
+
37
+
38
+ function hello_world() {
39
+ return "Hello World!"
40
+ }
41
+
42
+ describe('Hello World!', () => {
43
+ before(() => {
44
+ (global as any).window = window;
45
+ (global as any).document = window.document;
46
+
47
+ });
48
+ it('first test', () => {
49
+ const result = hello_world();
50
+ expect(result).to.equal('Hello World!');
51
+ });
52
+ });
53
+
54
+ class Probe {
55
+
56
+ val1 = 1;
57
+ val2 = 2;
58
+ val3 = 3;
59
+
60
+ constructor() {
61
+ }
62
+ }
63
+
64
+ describe('Lang tests', () => {
65
+ it('initializable', () => {
66
+ const lang = Lang;
67
+ expect(lang).to.exist;
68
+ });
69
+
70
+ it('strToArray working', () => {
71
+ let arr = strToArray("hello.world.from.me", /\./gi);
72
+
73
+ expect(arr).to.exist;
74
+ expect(arr.length).to.eq(4);
75
+ expect(arr[3]).to.eq("me");
76
+
77
+ });
78
+
79
+ it('trim working', () => {
80
+ let origStr = " hello world from me ";
81
+ let trimmed = trim(origStr);
82
+ expect(trimmed).to.exist;
83
+ expect(trimmed).to.eq("hello world from me");
84
+
85
+ });
86
+
87
+ it('isString working', () => {
88
+ expect(isString(" ")).to.be.true;
89
+ expect(isString('')).to.be.true;
90
+ expect(isString(null)).to.be.false;
91
+ expect(isString(undefined)).to.be.false;
92
+ expect(isString(function () {
93
+ return true;
94
+ })).to.be.false;
95
+ expect(isString(new Probe())).to.be.false;
96
+ });
97
+
98
+ it('isFunc working', () => {
99
+ expect(isFunc(() => {
100
+ })).to.be.true;
101
+ expect(isFunc(function () {
102
+ return true;
103
+ })).to.be.true;
104
+ expect(isFunc("blarg")).to.be.false;
105
+ expect(isFunc(new Probe())).to.be.false;
106
+ });
107
+
108
+ it('objToArray working', () => {
109
+ let obj_probe = new Probe();
110
+ let resultArr = objToArray(obj_probe);
111
+ expect(assertType(resultArr, Array)).to.be.true;
112
+ expect(resultArr.length).to.eq(0);
113
+ obj_probe = window.document.body.querySelectorAll("div");
114
+ resultArr = objToArray(obj_probe);
115
+ expect(resultArr.length).to.eq(4);
116
+ expect(assertType(resultArr, Array)).to.be.true;
117
+ });
118
+
119
+ it('keyval to string working', () => {
120
+ let keyval = keyValToStr("key", "val", ":")
121
+ expect(keyval).to.eq("key:val");
122
+
123
+ });
124
+
125
+ it('equals ignore case test', () => {
126
+ expect(equalsIgnoreCase(null, null as any)).to.be.true;
127
+ expect(equalsIgnoreCase("", "")).to.be.true;
128
+ expect(equalsIgnoreCase("null", "NuLL")).to.be.true;
129
+ expect(equalsIgnoreCase("null ", "NuLL")).to.be.false;
130
+ expect(equalsIgnoreCase("null", "NuLL2")).to.be.false;
131
+
132
+ });
133
+
134
+ /*it('form data test', () => {
135
+ const lang = Lang;
136
+ let sourceData: any = [1, 2, 3];
137
+ let formData: FormDataDecorator = createFormDataDecorator(sourceData);
138
+ expect(formData instanceof FormDataDecorator).to.be.true;
139
+ expect(formData.makeFinal()).to.eq("1&2&3");
140
+
141
+ formData.append("bla", "arg");
142
+ expect(formData.makeFinal()).to.eq("1&2&3&bla=arg");
143
+ });*/
144
+ });
145
+