jsf.js_next_gen 4.0.1-beta.6 → 4.0.1-beta.8

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 (184) hide show
  1. package/dist/docs/assets/style.css +4 -5
  2. package/dist/window/faces-development.js +43 -54
  3. package/dist/window/faces-development.js.br +0 -0
  4. package/dist/window/faces-development.js.gz +0 -0
  5. package/dist/window/faces-development.js.map +1 -1
  6. package/dist/window/faces.js +1 -1
  7. package/dist/window/faces.js.br +0 -0
  8. package/dist/window/faces.js.gz +0 -0
  9. package/dist/window/faces.js.map +1 -1
  10. package/dist/window/jsf-development.js +43 -54
  11. package/dist/window/jsf-development.js.br +0 -0
  12. package/dist/window/jsf-development.js.gz +0 -0
  13. package/dist/window/jsf-development.js.map +1 -1
  14. package/dist/window/jsf.js +1 -1
  15. package/dist/window/jsf.js.br +0 -0
  16. package/dist/window/jsf.js.gz +0 -0
  17. package/dist/window/jsf.js.map +1 -1
  18. package/package.json +10 -10
  19. package/src/main/typescript/impl/AjaxImpl.ts +5 -5
  20. package/src/main/typescript/impl/util/ExtDomQuery.ts +17 -22
  21. package/src/main/typescript/impl/xhrCore/RequestDataResolver.ts +2 -2
  22. package/src/main/typescript/impl/xhrCore/XhrRequest.ts +1 -1
  23. package/src/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.ts +1 -1
  24. package/src/main/typescript/test/frameworkBase/_ext/shared/StandardInits.ts +86 -0
  25. package/src/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.ts +53 -0
  26. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/css/bootstrap-icons.css +15 -0
  27. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/css/tobago.css +15 -0
  28. package/src/main/typescript/test/frameworkBase/_ext/shared/fixtures/js/tobago.js +15 -0
  29. package/src/main/typescript/test/xhrCore/ErrorChainTest.spec.ts +23 -0
  30. package/src/main/typescript/test/xhrCore/RequestParamsTest.spec.ts +1 -1
  31. package/src/main/typescript/test/xhrCore/ResponseTest23.spec.ts +19 -0
  32. package/target/AssocArray.js +281 -0
  33. package/target/AssocArray.js.map +1 -0
  34. package/target/Config.js +235 -0
  35. package/target/Config.js.map +1 -0
  36. package/target/CryptoExtensions.js +112 -0
  37. package/target/CryptoExtensions.js.map +1 -0
  38. package/target/DomQuery.js +1963 -0
  39. package/target/DomQuery.js.map +1 -0
  40. package/target/Es2019Array.js +117 -0
  41. package/target/Es2019Array.js.map +1 -0
  42. package/target/Global.js +38 -0
  43. package/target/Global.js.map +1 -0
  44. package/target/IDomQuery.js +3 -0
  45. package/target/IDomQuery.js.map +1 -0
  46. package/target/Lang.js +183 -0
  47. package/target/Lang.js.map +1 -0
  48. package/target/Messaging.js +645 -0
  49. package/target/Messaging.js.map +1 -0
  50. package/target/Monad.js +330 -0
  51. package/target/Monad.js.map +1 -0
  52. package/target/Promise.js +296 -0
  53. package/target/Promise.js.map +1 -0
  54. package/target/PromiseShim.js +30 -0
  55. package/target/PromiseShim.js.map +1 -0
  56. package/target/SourcesCollectors.js +444 -0
  57. package/target/SourcesCollectors.js.map +1 -0
  58. package/target/Stream.js +562 -0
  59. package/target/Stream.js.map +1 -0
  60. package/target/TagBuilder.js +178 -0
  61. package/target/TagBuilder.js.map +1 -0
  62. package/target/XmlQuery.js +84 -0
  63. package/target/XmlQuery.js.map +1 -0
  64. package/target/impl/AjaxImpl.js +4 -4
  65. package/target/impl/AjaxImpl.js.map +1 -1
  66. package/target/impl/util/ExtDomQuery.js +13 -19
  67. package/target/impl/util/ExtDomQuery.js.map +1 -1
  68. package/target/impl/xhrCore/RequestDataResolver.js +1 -1
  69. package/target/impl/xhrCore/RequestDataResolver.js.map +1 -1
  70. package/target/index.js +80 -0
  71. package/target/index.js.map +1 -0
  72. package/target/index_core.js +76 -0
  73. package/target/index_core.js.map +1 -0
  74. package/target/test/frameworkBase/_ext/monadish/DomQueryTest.spec.js +1 -1
  75. package/target/test/frameworkBase/_ext/shared/StandardInits.js +85 -0
  76. package/target/test/frameworkBase/_ext/shared/StandardInits.js.map +1 -1
  77. package/target/test/frameworkBase/_ext/shared/XmlResponses.js +53 -1
  78. package/target/test/frameworkBase/_ext/shared/XmlResponses.js.map +1 -1
  79. package/target/test/xhrCore/ErrorChainTest.spec.js +21 -0
  80. package/target/test/xhrCore/ErrorChainTest.spec.js.map +1 -1
  81. package/target/test/xhrCore/RequestParamsTest.spec.js.map +1 -1
  82. package/target/test/xhrCore/ResponseTest23.spec.js +14 -0
  83. package/target/test/xhrCore/ResponseTest23.spec.js.map +1 -1
  84. package/target/types/main/typescript/AssocArray.d.ts +86 -0
  85. package/target/types/main/typescript/Config.d.ts +94 -0
  86. package/target/types/main/typescript/CryptoExtensions.d.ts +87 -0
  87. package/target/types/main/typescript/DomQuery.d.ts +587 -0
  88. package/target/types/main/typescript/Es2019Array.d.ts +30 -0
  89. package/target/types/main/typescript/Global.d.ts +23 -0
  90. package/target/types/main/typescript/IDomQuery.d.ts +480 -0
  91. package/target/types/main/typescript/Lang.d.ts +97 -0
  92. package/target/types/main/typescript/Messaging.d.ts +285 -0
  93. package/target/types/main/typescript/Monad.d.ts +161 -0
  94. package/target/types/main/typescript/Promise.d.ts +58 -0
  95. package/target/types/main/typescript/PromiseShim.d.ts +22 -0
  96. package/target/types/main/typescript/SourcesCollectors.d.ts +280 -0
  97. package/target/types/main/typescript/Stream.d.ts +284 -0
  98. package/target/types/main/typescript/TagBuilder.d.ts +50 -0
  99. package/target/types/main/typescript/XmlQuery.d.ts +31 -0
  100. package/target/types/main/typescript/api/_api.d.ts +182 -0
  101. package/target/types/main/typescript/api/faces.d.ts +17 -0
  102. package/target/types/main/typescript/api/jsf.d.ts +17 -0
  103. package/target/types/main/typescript/impl/AjaxImpl.d.ts +164 -0
  104. package/target/types/main/typescript/impl/PushImpl.d.ts +38 -0
  105. package/target/types/main/typescript/impl/core/Const.d.ts +138 -0
  106. package/target/types/main/typescript/impl/core/ImplTypes.d.ts +16 -0
  107. package/target/types/main/typescript/impl/i18n/Messages.d.ts +102 -0
  108. package/target/types/main/typescript/impl/util/Assertions.d.ts +46 -0
  109. package/target/types/main/typescript/impl/util/AsyncRunnable.d.ts +112 -0
  110. package/target/types/main/typescript/impl/util/ExtDomQuery.d.ts +100 -0
  111. package/target/types/main/typescript/impl/util/FileUtils.d.ts +25 -0
  112. package/target/types/main/typescript/impl/util/HiddenInputBuilder.d.ts +37 -0
  113. package/target/types/main/typescript/impl/util/IListener.d.ts +18 -0
  114. package/target/types/main/typescript/impl/util/Lang.d.ts +138 -0
  115. package/target/types/main/typescript/impl/util/XhrQueueController.d.ts +51 -0
  116. package/target/types/main/typescript/impl/xhrCore/ErrorData.d.ts +37 -0
  117. package/target/types/main/typescript/impl/xhrCore/EventData.d.ts +25 -0
  118. package/target/types/main/typescript/impl/xhrCore/IResponseProcessor.d.ts +136 -0
  119. package/target/types/main/typescript/impl/xhrCore/RequestDataResolver.d.ts +84 -0
  120. package/target/types/main/typescript/impl/xhrCore/ResonseDataResolver.d.ts +60 -0
  121. package/target/types/main/typescript/impl/xhrCore/Response.d.ts +29 -0
  122. package/target/types/main/typescript/impl/xhrCore/ResponseProcessor.d.ts +208 -0
  123. package/target/types/main/typescript/impl/xhrCore/XhrFormData.d.ts +83 -0
  124. package/target/types/main/typescript/impl/xhrCore/XhrRequest.d.ts +102 -0
  125. package/target/types/main/typescript/index.d.ts +34 -0
  126. package/target/types/main/typescript/index_core.d.ts +29 -0
  127. package/target/types/main/typescript/myfaces/OamSubmit.d.ts +53 -0
  128. package/target/types/main/typescript/test/frameworkBase/LangTest.spec.d.ts +1 -0
  129. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/DomQueryTest.spec.d.ts +1 -0
  130. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/LangTest.spec.d.ts +16 -0
  131. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MappingProbes.d.ts +39 -0
  132. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MappingTest.spec.d.ts +16 -0
  133. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/MonadTest.spec.d.ts +16 -0
  134. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/XmlQueryTest.spec.d.ts +0 -0
  135. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-with-header.d.ts +1 -0
  136. package/target/types/main/typescript/test/frameworkBase/_ext/monadish/markups/tobago-without-header.d.ts +1 -0
  137. package/target/types/main/typescript/test/frameworkBase/_ext/shared/StandardInits.d.ts +63 -0
  138. package/target/types/main/typescript/test/frameworkBase/_ext/shared/XmlResponses.d.ts +23 -0
  139. package/target/types/main/typescript/test/impl/ImplTest.spec.d.ts +16 -0
  140. package/target/types/main/typescript/test/impl/ImplTest_23.spec.d.ts +16 -0
  141. package/target/types/main/typescript/test/impl/SeparatorCharsTest.spec.d.ts +16 -0
  142. package/target/types/main/typescript/test/myfaces/OamSubmit.spec.d.ts +16 -0
  143. package/target/types/main/typescript/test/myfaces/OnLoad.spec.d.ts +16 -0
  144. package/target/types/main/typescript/test/queue/AsynchronousProbe.d.ts +38 -0
  145. package/target/types/main/typescript/test/queue/AsynchronousQueueTest.spec.d.ts +16 -0
  146. package/target/types/main/typescript/test/xhrCore/ClientWindow.spec.d.ts +1 -0
  147. package/target/types/main/typescript/test/xhrCore/ErrorChainTest.spec.d.ts +16 -0
  148. package/target/types/main/typescript/test/xhrCore/EventTests.spec.d.ts +16 -0
  149. package/target/types/main/typescript/test/xhrCore/FakeWebsocket.d.ts +24 -0
  150. package/target/types/main/typescript/test/xhrCore/FileUploadTest.spec.d.ts +1 -0
  151. package/target/types/main/typescript/test/xhrCore/NamespacesRequestTest.spec.d.ts +16 -0
  152. package/target/types/main/typescript/test/xhrCore/OamSubmitTest.spec.d.ts +16 -0
  153. package/target/types/main/typescript/test/xhrCore/RequestParamsTest.spec.d.ts +1 -0
  154. package/target/types/main/typescript/test/xhrCore/RequestTest.spec.d.ts +16 -0
  155. package/target/types/main/typescript/test/xhrCore/RequestTest_23.spec.d.ts +16 -0
  156. package/target/types/main/typescript/test/xhrCore/ResponseTest.spec.d.ts +16 -0
  157. package/target/types/main/typescript/test/xhrCore/ResponseTest23.spec.d.ts +16 -0
  158. package/target/types/main/typescript/test/xhrCore/ShadowDomTest.spec.d.ts +16 -0
  159. package/target/types/main/typescript/test/xhrCore/TobagoFileUploadTest.spec.d.ts +1 -0
  160. package/target/types/main/typescript/test/xhrCore/WebsocketTest.d.ts +1 -0
  161. package/target/types/main/typescript/test/xhrCore/XhrFormDataTest.spec.d.ts +16 -0
  162. package/target/types/test/typescript/AssocArrayTest.spec.d.ts +1 -0
  163. package/target/types/test/typescript/DomQueryTest.spec.d.ts +1 -0
  164. package/target/types/test/typescript/ExtendedArrayTest.spec.d.ts +1 -0
  165. package/target/types/test/typescript/LangTest.spec.d.ts +1 -0
  166. package/target/types/test/typescript/MappingProbes.d.ts +24 -0
  167. package/target/types/test/typescript/MappingTest.spec.d.ts +1 -0
  168. package/target/types/test/typescript/MessagingTest.spec.d.ts +1 -0
  169. package/target/types/test/typescript/MonadTest.spec.d.ts +16 -0
  170. package/target/types/test/typescript/PromiseTest.spec.d.ts +1 -0
  171. package/target/types/test/typescript/StreamTest.spec.d.ts +1 -0
  172. package/target/types/test/typescript/XmlQueryTest.spec.d.ts +1 -0
  173. package/target/types/test/typescript/markups/tobago-with-header.d.ts +1 -0
  174. package/target/types/test/typescript/markups/tobago-without-header.d.ts +1 -0
  175. package/webpack.config.js +1 -1
  176. package/webpack.config.js.map +1 -1
  177. package/.nyc_output/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +0 -1
  178. package/.nyc_output/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +0 -1
  179. package/.nyc_output/processinfo/09ca9ebc-2305-4357-8db9-48ddfc7dfde2.json +0 -1
  180. package/.nyc_output/processinfo/7c496a14-166e-4aa5-85b9-47b22b055ad8.json +0 -1
  181. package/.nyc_output/processinfo/index.json +0 -1
  182. package/src/test.html +0 -75
  183. package/src/tmp/test.html +0 -16
  184. package/tmp.xml +0 -36
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsf.js_next_gen",
3
- "version": "4.0.1-beta.6",
3
+ "version": "4.0.1-beta.8",
4
4
  "description": "A next generation typescript reimplementation of jsf.js",
5
5
  "main": "dist/window/faces.js",
6
6
  "scripts": {
@@ -23,7 +23,7 @@
23
23
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
24
24
  "@types/chai": "^4.3.4",
25
25
  "@types/mocha": "^10.0.1",
26
- "@types/node": "^18.14.6",
26
+ "@types/node": "^18.15.11",
27
27
  "@types/sinon": "^10.0.13",
28
28
  "babel-plugin-syntax-dynamic-import": "^6.18.0",
29
29
  "chai": "^4.3.7",
@@ -31,24 +31,24 @@
31
31
  "cross-env": "^7.0.3",
32
32
  "html-webpack-plugin": "^5.5.0",
33
33
  "http-server": "^14.1.1",
34
- "jsdom": "^21.1.0",
34
+ "jsdom": "^21.1.1",
35
35
  "jsdom-global": "^3.0.2",
36
36
  "mocha": "^10.2.0",
37
- "npm-check-updates": "^16.7.10",
37
+ "npm-check-updates": "^16.9.0",
38
38
  "nyc": "^15.1.0",
39
39
  "replace-in-file": "^6.3.5",
40
40
  "rxjs": "^7.8.0",
41
- "sinon": "^15.0.1",
41
+ "sinon": "^15.0.3",
42
42
  "terser-webpack-plugin": "^5.3.7",
43
43
  "ts-loader": "^9.4.2",
44
44
  "ts-node": "^10.9.1",
45
- "typedoc": "^0.23.26",
46
- "typescript": "^4.9.5",
47
- "webpack": "^5.76.0",
45
+ "typedoc": "^0.23.28",
46
+ "typescript": "^5.0.3",
47
+ "webpack": "^5.77.0",
48
48
  "webpack-cli": "^5.0.1",
49
- "webpack-dev-server": "^4.11.1"
49
+ "webpack-dev-server": "^4.13.1"
50
50
  },
51
51
  "dependencies": {
52
- "mona-dish": "0.28.3"
52
+ "mona-dish": "0.28.9"
53
53
  }
54
54
  }
@@ -480,18 +480,18 @@ export module Implementation {
480
480
  /*
481
481
  * lazy helper to fetch the window id from the included faces.js
482
482
  */
483
- let fetchWindowIdFromJSFJS = () => ExtDomQuery.searchJsfJsFor(/jfwid=([^&;]*)/).orElse(null).value;
483
+ let fetchWindowIdFromJSFJS = (): Optional<string> => ExtDomQuery.searchJsfJsFor(/jfwid=([^&;]*)/).orElse(null);
484
484
 
485
485
  /*
486
486
  * fetch window id from the url
487
487
  */
488
- let fetchWindowIdFromURL = function () {
488
+ let fetchWindowIdFromURL = function (): Optional<string> {
489
489
  const href = window.location.href, windowId = "jfwid";
490
490
  const regex = new RegExp("[\\?&]" + windowId + "=([^&#\\;]*)");
491
491
  const results = regex.exec(href);
492
492
  //initial trial over the url and a regexp
493
- if (results != null) return results[1];
494
- return null;
493
+ if (results != null) return Optional.fromNullable(results[1]);
494
+ return Optional.fromNullable(null);
495
495
  };
496
496
 
497
497
  /*
@@ -532,7 +532,7 @@ export module Implementation {
532
532
  /*
533
533
  * return the window id or null
534
534
  */
535
- return formWindowId != INIT ? formWindowId : (fetchWindowIdFromURL() || fetchWindowIdFromJSFJS());
535
+ return formWindowId != INIT ? formWindowId : (fetchWindowIdFromURL() || fetchWindowIdFromJSFJS()).value;
536
536
  }
537
537
 
538
538
  /**
@@ -67,15 +67,15 @@ const ATTR_SRC = 'src';
67
67
  */
68
68
  export class ExtDomQuery extends DQ {
69
69
 
70
- static get windowId() {
70
+ static get windowId(): Optional<string> {
71
71
  return new ExtDomQuery(document.body).windowId;
72
72
  }
73
73
 
74
- static get nonce(): string {
74
+ static get nonce(): Optional<string> {
75
75
  return new ExtDomQuery(document.body).nonce;
76
76
  }
77
77
 
78
- get windowId(): string | null {
78
+ get windowId(): Optional<string> {
79
79
 
80
80
  const fetchWindowIdFromURL = function (): string | null {
81
81
  let href = window.location.href;
@@ -94,9 +94,9 @@ export class ExtDomQuery extends DQ {
94
94
  throw Error("Multiple different windowIds found in document");
95
95
  }
96
96
 
97
- return (result.isPresent()) ? (<HTMLInputElement>result.getAsElem(0).value).value : fetchWindowIdFromURL();
97
+ return Optional.fromNullable((result.isPresent()) ? (<HTMLInputElement>result.getAsElem(0).value).value : fetchWindowIdFromURL());
98
98
  } else {
99
- return fetchWindowIdFromURL();
99
+ return Optional.fromNullable(fetchWindowIdFromURL());
100
100
  }
101
101
  }
102
102
 
@@ -104,31 +104,29 @@ export class ExtDomQuery extends DQ {
104
104
  * determines the faces.js nonce and adds them to the namespace
105
105
  * this is done once and only lazily
106
106
  */
107
- get nonce(): string | null {
107
+ get nonce(): Optional<string> {
108
108
  //already processed
109
109
  let myfacesConfig = new ExtConfig(window.myfaces);
110
- let nonce: IValueHolder<string> = myfacesConfig.getIf("config", "cspMeta", "nonce");
111
- if (nonce.value) {
112
- return <string>nonce.value;
110
+ let globalNonce: IValueHolder<string> = myfacesConfig.getIf("config", "cspMeta", "nonce");
111
+ if (!!globalNonce.value) {
112
+ return Optional.fromNullable(globalNonce.value as string) as Optional<string>;
113
113
  }
114
114
 
115
115
  let curScript = new DQ(document.currentScript);
116
116
  //since our baseline atm is ie11 we cannot use document.currentScript globally
117
- if (!!this.extractNonce(curScript)) {
117
+ let nonce = curScript.nonce;
118
+ if (nonce.isPresent()) {
118
119
  // fast-path for modern browsers
119
- return this.extractNonce(curScript);
120
+ return nonce;
120
121
  }
121
122
  // fallback if the currentScript method fails, we just search the jsf tags for nonce, this is
122
123
  // the last possibility
123
- let nonceScript = Optional.fromNullable(DQ
124
+ let nonceScript: Optional<DomQuery> = Optional.fromNullable(DQ
124
125
  .querySelectorAll("script[src], link[src]").asArray
125
- .filter((item) => this.extractNonce(item) && item.attr(ATTR_SRC) != null)
126
+ .filter((item) => item.nonce.isPresent() && item.attr(ATTR_SRC) != null)
126
127
  .filter(item => IS_FACES_SOURCE(item.attr(ATTR_SRC).value))?.[0]);
127
128
 
128
- if (nonceScript.isPresent()) {
129
- return this.extractNonce(nonceScript.value);
130
- }
131
- return null;
129
+ return Optional.fromNullable(nonceScript.value?.nonce?.value);
132
130
  }
133
131
 
134
132
  static searchJsfJsFor(item: RegExp): Optional<String> {
@@ -152,13 +150,13 @@ export class ExtDomQuery extends DQ {
152
150
  }
153
151
 
154
152
  globalEval(code: string, nonce ?: string): DQ {
155
- return new ExtDomQuery(super.globalEval(code, nonce ?? this.nonce));
153
+ return new ExtDomQuery(super.globalEval(code, nonce ?? this.nonce.value));
156
154
  }
157
155
 
158
156
  // called from base class runScripts, do not delete
159
157
  // noinspection JSUnusedGlobalSymbols
160
158
  globalEvalSticky(code: string, nonce ?: string): DQ {
161
- return new ExtDomQuery(super.globalEvalSticky(code, nonce ?? this.nonce));
159
+ return new ExtDomQuery(super.globalEvalSticky(code, nonce ?? this.nonce.value));
162
160
  }
163
161
 
164
162
  /**
@@ -238,9 +236,6 @@ export class ExtDomQuery extends DQ {
238
236
  return new ExtDomQuery(ret);
239
237
  }
240
238
 
241
- private extractNonce(curScript: DomQuery) {
242
- return (curScript.getAsElem(0).value as HTMLElement)?.nonce ?? curScript.attr("nonce").value;
243
- }
244
239
 
245
240
  filter(func: (item: DomQuery) => boolean): ExtDomQuery {
246
241
  return new ExtDomQuery(super.filter(func));
@@ -143,8 +143,8 @@ export function resolveDelay(options: Config): number {
143
143
  *
144
144
  * @param options
145
145
  */
146
- export function resolveWindowId(options: Config) {
147
- return options?.value?.windowId ?? ExtDomQuery.windowId;
146
+ export function resolveWindowId(options: Config): string | null {
147
+ return options?.value?.windowId ?? ExtDomQuery.windowId.value;
148
148
  }
149
149
 
150
150
  /**
@@ -41,7 +41,7 @@ import {
41
41
  STATE_EVT_TIMEOUT,
42
42
  STD_ACCEPT,
43
43
  URL_ENCODED,
44
- VAL_AJAX, IDENT_NONE, CTX_PARAM_SRC_FRM_ID, CTX_PARAM_SRC_CTL_ID, CTX_PARAM_PPS, SERVER_ERROR
44
+ VAL_AJAX, IDENT_NONE, CTX_PARAM_SRC_FRM_ID, CTX_PARAM_SRC_CTL_ID, CTX_PARAM_PPS
45
45
  } from "../core/Const";
46
46
  import {
47
47
  resolveFinalUrl,
@@ -567,7 +567,7 @@ describe('DOMQuery tests', function () {
567
567
  expect(content.byId("third").innerHTML).to.eq("hello world");
568
568
  expect(content.byId("fourth").innerHTML).to.eq("hello world");
569
569
 
570
- expect(DomQuery.byTagName("head")
570
+ expect(DomQuery.byTagName("body")
571
571
  .querySelectorAll("link[rel='stylesheet'][href='./fixtures/blank.css']").length).to.eq(1);
572
572
  done();
573
573
 
@@ -145,6 +145,92 @@ export module StandardInits {
145
145
  </body>
146
146
  </html>`;
147
147
 
148
+ export const HTML_TOBAGO_SHEET_WITH_STYLE = `<!DOCTYPE html>
149
+ <html lang='de'>
150
+ <head>
151
+ <meta charset='UTF-8'>
152
+ <meta name='viewport' content='width=device-width, initial-scale=1.0'>
153
+ <title>Test
154
+ </title>
155
+ <link rel='stylesheet' href='./fixtures/css/tobago.css' type='text/css'>
156
+ <link rel='stylesheet' href='./fixtures/css/bootstrap-icons.css' type='text/css'>
157
+ <script src='./fixtures/jakarta.faces.resource/faces.js.jsf' type='text/javascript'></script>
158
+ <script src='./fixtures/js/tobago.js' type='module'></script>
159
+ </head>
160
+ <body>
161
+ <tobago-page locale='de' class='container-fluid' id='page' focus-on-error='true' wait-overlay-delay-full='1000'
162
+ wait-overlay-delay-ajax='1000'>
163
+ <form action='/content/080-sheet/30-event/Sheet_Event.xhtml' id='page::form' method='post'
164
+ accept-charset='UTF-8' data-tobago-context-path=''>
165
+ <input type='hidden' name='javax.faces.source' id='javax.faces.source' disabled='disabled'>
166
+ <tobago-focus id='page::lastFocusId'>
167
+ <input type='hidden' name='page::lastFocusId' id='page::lastFocusId::field'>
168
+ </tobago-focus>
169
+ <input type='hidden' name='org.apache.myfaces.tobago.webapp.Secret' id='org.apache.myfaces.tobago.webapp.Secret'
170
+ value='secretValue'>
171
+ <div class='tobago-page-menuStore'>
172
+ </div>
173
+ <span id='page::jsf-state-container'><input type='hidden' name='javax.faces.ViewState'
174
+ id='j_id__v_0:javax.faces.ViewState:1'
175
+ value='viewStateValue' autocomplete='off'><input
176
+ type='hidden' name='javax.faces.RenderKitId' value='tobago'><input type='hidden'
177
+ id='j_id__v_0:javax.faces.ClientWindow:1'
178
+ name='javax.faces.ClientWindow'
179
+ value='clientWindowValue'></span>
180
+ <button type='button' id='page:ajaxButton' name='page:ajaxButton'
181
+ class='tobago-button btn btn-secondary tobago-auto-spacing'>
182
+ <tobago-behavior event='click' client-id='page:ajaxButton' execute='page:ajaxButton'
183
+ render='page:s1'></tobago-behavior>
184
+ <span>Ajax</span></button>
185
+ <tobago-sheet id='page:s1' data-tobago-selection-mode='multi' data-tobago-first='0' rows='0' row-count='2'>
186
+ <style nonce='nonceValue' id='page:s1:j_id_4'>#page\\:s1 {
187
+ max-height: 500px;
188
+ }
189
+ </style>
190
+ <input id='page:s1::scrollPosition' name='page:s1::scrollPosition' type='hidden' value='[0,0]'>
191
+ <input id='page:s1::selected' name='page:s1::selected' type='hidden' value='[]'>
192
+ <div class='tobago-body'>
193
+ <table cellspacing='0' cellpadding='0' summary='' class='table'>
194
+ <thead>
195
+ <tr>
196
+ <th>
197
+ <span><tobago-out id='page:s1:_col0'><span class='form-control-plaintext'>Name</span></tobago-out></span>
198
+ </th>
199
+ </tr>
200
+ </thead>
201
+ <tbody>
202
+ <tr row-index='0'>
203
+ <td>
204
+ <tobago-out id='page:s1:0:t_name'><span class='form-control-plaintext'>Earth</span></tobago-out>
205
+ </td>
206
+ <td>
207
+ <div>
208
+ </div>
209
+ </td>
210
+ </tr>
211
+ <tr row-index='1'>
212
+ <td>
213
+ <tobago-out id='page:s1:1:t_name'><span class='form-control-plaintext'>Moon</span></tobago-out>
214
+ </td>
215
+ <td>
216
+ <div>
217
+ </div>
218
+ </td>
219
+ </tr>
220
+ </tbody>
221
+ </table>
222
+ </div>
223
+ </tobago-sheet>
224
+ </form>
225
+ <noscript>
226
+ <div class='tobago-page-noscript'>Diese Seite benötigt JavaScript, allerdings ist JavaScript in Ihrem Browser
227
+ derzeit deaktiviert. Um JavaScript zu aktivieren, lesen Sie ggf. die Anleitung Ihres Browsers.
228
+ </div>
229
+ </noscript>
230
+ </tobago-page>
231
+ </body>
232
+ </html>`;
233
+
148
234
  /**
149
235
  * a page simulating basically a simple faces form
150
236
  */
@@ -26,6 +26,59 @@ export class XmlResponses {
26
26
  </partial-response>
27
27
  `;
28
28
 
29
+ static UPDATE_TOBAGO_SHEET_WITH_STYLE = `<?xml version="1.0" encoding="UTF-8"?>
30
+ <partial-response id='j_id__v_0'>
31
+ <changes>
32
+ <update id='page:s1'><![CDATA[
33
+ <tobago-sheet id='page:s1' data-tobago-selection-mode='multi' data-tobago-first='0' rows='0' row-count='2'>
34
+ <style nonce='nonceValue' id='page:s1:j_id_4'>#page\\:s1 {
35
+ max-height: 500px;
36
+ }
37
+ </style>
38
+ <input id='page:s1::scrollPosition' name='page:s1::scrollPosition' type='hidden' value='[0,0]'/>
39
+ <input id='page:s1::selected' name='page:s1::selected' type='hidden' value='[]'/>
40
+ <div class='tobago-body'>
41
+ <table cellspacing='0' cellpadding='0' summary='' class='table'>
42
+ <thead>
43
+ <tr>
44
+ <th>
45
+ <span><tobago-out id='page:s1:_col0'><span
46
+ class='form-control-plaintext'>Name</span></tobago-out></span>
47
+ </th>
48
+ </tr>
49
+ </thead>
50
+ <tbody>
51
+ <tr row-index='0'>
52
+ <td>
53
+ <tobago-out id='page:s1:0:t_name'><span class='form-control-plaintext'>Earth</span></tobago-out>
54
+ </td>
55
+ <td>
56
+ <div>
57
+ </div>
58
+ </td>
59
+ </tr>
60
+ <tr row-index='1'>
61
+ <td>
62
+ <tobago-out id='page:s1:1:t_name'><span class='form-control-plaintext'>Moon</span></tobago-out>
63
+ </td>
64
+ <td>
65
+ <div>
66
+ </div>
67
+ </td>
68
+ </tr>
69
+ </tbody>
70
+ </table>
71
+ </div>
72
+ </tobago-sheet>
73
+ ]]>
74
+ </update>
75
+ <update id='j_id__v_0:javax.faces.ViewState:1'><![CDATA[viewStateValue]]>
76
+ </update>
77
+ <update id='j_id__v_0:javax.faces.ClientWindow:1'><![CDATA[clientWindowValue]]>
78
+ </update>
79
+ </changes>
80
+ </partial-response>`;
81
+
29
82
  static SHADOW_DOM_UPDATE=`
30
83
  <partial-response>
31
84
  <changes><update id="shadowContent"><![CDATA[<div id="shadowContent">after update</div>]]></update></changes>
@@ -0,0 +1,15 @@
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
+ */
@@ -0,0 +1,15 @@
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
+ */
@@ -0,0 +1,15 @@
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
+ */
@@ -109,5 +109,28 @@ describe('Tests of the various aspects of the response protocol functionality',
109
109
  expect(DQ.byId("form1:out1").innerHTML).to.eq("5");
110
110
  done();
111
111
  })
112
+
113
+
114
+ it("must process the error chain properly with a standard Ajax Error", function (done) {
115
+ DQ.byId("form1:button1").click();
116
+ expect(Implementation.requestQueue.queue.length >= 4).to.be.true;
117
+
118
+ for (let cnt = 1; cnt <= 5; cnt++) {
119
+ if(!Implementation.requestQueue.queue.length) {
120
+ this.respond(XmlResponses.ERROR_CHAIN_RESPOND_OK(cnt));
121
+ break;
122
+ }
123
+ if (cnt == 3) {
124
+ //any error suffices
125
+ this.respond(XmlResponses.ERROR_1);
126
+ } else {
127
+ this.respond(XmlResponses.ERROR_CHAIN_RESPOND_OK(cnt))
128
+ }
129
+ }
130
+ expect(Implementation.requestQueue.queue.length).to.eq(0);
131
+ expect(DQ.byId("errorCalled").innerHTML).to.eq("1");
132
+ expect(DQ.byId("form1:out1").innerHTML).to.eq("5");
133
+ done();
134
+ })
112
135
  });
113
136
 
@@ -18,7 +18,7 @@ import {Implementation} from "../../impl/AjaxImpl";
18
18
  import {StandardInits} from "../frameworkBase/_ext/shared/StandardInits";
19
19
 
20
20
  import protocolPage = StandardInits.protocolPage;
21
- import {Config, DQ, Stream} from "mona-dish";
21
+ import {Config, DQ} from "mona-dish";
22
22
  import {expect} from "chai";
23
23
  import HTML_PREFIX_EMBEDDED_BODY = StandardInits.HTML_PREFIX_EMBEDDED_BODY;
24
24
  import {it} from "mocha";
@@ -359,6 +359,25 @@ describe('Tests of the various aspects of the response protocol functionality',
359
359
  expect(DQ.byId("j_id__v_0:javax.faces.ClientWindow:1").isAbsent()).to.be.false;
360
360
  });
361
361
 
362
+ it("<style> element must be in <tobago-sheet> instead of <head>", function () {
363
+ window.document.documentElement.innerHTML = StandardInits.HTML_TOBAGO_SHEET_WITH_STYLE;
364
+
365
+ expect(DQ.querySelectorAll("head > style").length).to.be.eq(0);
366
+ expect(DQ.querySelectorAll("body tobago-page tobago-sheet > style").length).to.be.eq(1);
367
+
368
+ jsf.ajax.request(window.document.getElementById("page:ajaxButton"), null, {
369
+ "jakarta.faces.behavior.event": "click",
370
+ execute: "page:ajaxButton",
371
+ render: "page:s1"
372
+ });
373
+
374
+ this.respond(XmlResponses.UPDATE_TOBAGO_SHEET_WITH_STYLE);
375
+
376
+ expect(DQ.querySelectorAll("head > style").length).to.be.eq(0);
377
+ expect(DQ.querySelectorAll("body tobago-page tobago-sheet > style").length).to.be.eq(1);
378
+ expect(DQ.querySelectorAll("body tobago-page tobago-sheet > style").nonce.value).to.be.eq("nonceValue");
379
+ });
380
+
362
381
 
363
382
  it("must pass named params properly (tobago testcase)", function(done) {
364
383
  window.document.body.innerHTML = HTML_PREFIX_EMBEDDED_BODY;