@qooxdoo/framework 7.0.0-beta.2 → 7.0.0-beta.6

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 (143) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/Manifest.json +2 -3
  3. package/README.md +7 -3
  4. package/bin/deploy/qx +0 -0
  5. package/lib/compiler/compile-info.json +44 -45
  6. package/lib/compiler/index.js +1971 -8371
  7. package/lib/resource/qx/tool/cli/templates/loader/loader-node.tmpl.js +3 -1
  8. package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css +1 -1
  9. package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css.map +1 -1
  10. package/lib/resource/qx/tool/cli/templates/template_vars.js +1 -1
  11. package/lib/resource/qx/tool/loadsass.js +6 -12
  12. package/lib/resource/qx/tool/schema/Manifest-1-0-0.json +1 -2
  13. package/lib/resource/qx/tool/schema/Manifest-2-0-0.json +1 -2
  14. package/lib/resource/qx/tool/schema/compile-1-0-0.json +3 -7
  15. package/package.json +25 -12
  16. package/source/class/qx/io/__init__.js +5 -3
  17. package/source/class/qx/io/exception/Cancel.js +34 -0
  18. package/source/class/qx/io/exception/Exception.js +38 -0
  19. package/source/class/qx/{tool/compiler/Version.js → io/exception/Protocol.js} +13 -7
  20. package/source/class/qx/io/exception/Transport.js +39 -0
  21. package/source/class/qx/io/exception/__init__.js +4 -0
  22. package/source/class/qx/io/graphql/Client.js +112 -0
  23. package/source/class/qx/io/graphql/__init__.js +9 -0
  24. package/source/class/qx/io/graphql/protocol/Message.js +65 -0
  25. package/source/class/qx/io/graphql/protocol/Request.js +95 -0
  26. package/source/class/qx/io/graphql/protocol/Response.js +61 -0
  27. package/source/class/qx/io/graphql/protocol/__init__.js +6 -0
  28. package/source/class/qx/io/jsonrpc/Client.js +323 -0
  29. package/source/class/qx/io/jsonrpc/__init__.js +15 -0
  30. package/source/class/qx/io/jsonrpc/protocol/Batch.js +97 -0
  31. package/source/class/qx/io/jsonrpc/protocol/Error.js +63 -0
  32. package/source/class/qx/io/jsonrpc/protocol/Message.js +48 -0
  33. package/source/class/qx/io/jsonrpc/protocol/Notification.js +45 -0
  34. package/source/class/qx/io/jsonrpc/protocol/Parser.js +81 -0
  35. package/source/class/qx/io/jsonrpc/protocol/Request.js +93 -0
  36. package/source/class/qx/io/jsonrpc/protocol/Result.js +48 -0
  37. package/source/class/qx/io/jsonrpc/protocol/__init__.js +5 -0
  38. package/source/class/qx/io/request/authentication/Bearer.js +52 -0
  39. package/source/class/qx/io/transport/AbstractClient.js +100 -0
  40. package/source/class/qx/io/transport/AbstractTransport.js +41 -0
  41. package/source/class/qx/io/transport/Fetch.js +95 -0
  42. package/source/class/qx/io/transport/ITransport.js +40 -0
  43. package/source/class/qx/io/transport/PostMessage.js +55 -0
  44. package/source/class/qx/io/transport/Websocket.js +97 -0
  45. package/source/class/qx/io/transport/Xhr.js +139 -0
  46. package/source/class/qx/io/transport/__init__.js +18 -0
  47. package/source/class/qx/test/io/MAssert.js +46 -0
  48. package/source/class/qx/test/io/graphql/Client.js +169 -0
  49. package/source/class/qx/test/io/graphql/ClientFetch.js +34 -0
  50. package/source/class/qx/test/io/graphql/Request.js +42 -0
  51. package/source/class/qx/test/io/jsonrpc/Client.js +267 -0
  52. package/source/class/qx/test/io/jsonrpc/Protocol.js +80 -0
  53. package/source/class/qx/test/io/transport/PostMessage.js +56 -0
  54. package/source/class/qx/test/io/transport/Websocket.js +63 -0
  55. package/source/class/qx/test/ui/embed/Iframe.js +1 -0
  56. package/source/class/qx/test/ui/form/ComboBox.js +0 -42
  57. package/source/class/qx/test/util/DateFormat.js +45 -6
  58. package/source/class/qx/theme/manager/Decoration.js +0 -0
  59. package/source/class/qx/theme/tangible/ColorDark.js +0 -0
  60. package/source/class/qx/tool/cli/Cli.js +5 -3
  61. package/source/class/qx/tool/cli/api/CompilerApi.js +15 -5
  62. package/source/class/qx/tool/cli/commands/Command.js +7 -0
  63. package/source/class/qx/tool/cli/commands/Compile.js +4 -4
  64. package/source/class/qx/tool/cli/commands/Lint.js +30 -11
  65. package/source/class/qx/tool/cli/commands/Package.js +1 -2
  66. package/source/class/qx/tool/cli/commands/package/Publish.js +33 -10
  67. package/source/class/qx/tool/compiler/Analyser.js +21 -22
  68. package/source/class/qx/tool/compiler/app/WebFont.js +1 -1
  69. package/source/class/qx/tool/compiler/makers/AppMaker.js +15 -14
  70. package/source/class/qx/tool/compiler/targets/Target.js +2 -1
  71. package/source/class/qx/tool/compiler/targets/TypeScriptWriter.js +1 -2
  72. package/source/class/qx/tool/compiler/targets/meta/PolyfillJs.js +17 -9
  73. package/source/class/qx/tool/config/Abstract.js +3 -3
  74. package/source/class/qx/tool/config/Utils.js +10 -1
  75. package/source/class/qx/tool/utils/Json.js +1 -1
  76. package/source/class/qx/ui/container/SlideBar.js +3 -0
  77. package/source/class/qx/ui/core/Widget.js +70 -0
  78. package/source/class/qx/ui/core/scroll/NativeScrollBar.js +3 -0
  79. package/source/class/qx/ui/core/scroll/ScrollBar.js +3 -0
  80. package/source/class/qx/ui/form/AbstractSelectBox.js +38 -6
  81. package/source/class/qx/ui/form/Button.js +3 -0
  82. package/source/class/qx/ui/form/CheckBox.js +25 -1
  83. package/source/class/qx/ui/form/ComboBox.js +41 -27
  84. package/source/class/qx/ui/form/DateField.js +16 -1
  85. package/source/class/qx/ui/form/List.js +3 -0
  86. package/source/class/qx/ui/form/MenuButton.js +28 -2
  87. package/source/class/qx/ui/form/RadioButton.js +7 -0
  88. package/source/class/qx/ui/form/RadioButtonGroup.js +3 -0
  89. package/source/class/qx/ui/form/RadioGroup.js +19 -0
  90. package/source/class/qx/ui/form/SelectBox.js +28 -1
  91. package/source/class/qx/ui/form/Slider.js +15 -0
  92. package/source/class/qx/ui/form/SplitButton.js +3 -0
  93. package/source/class/qx/ui/form/ToggleButton.js +8 -0
  94. package/source/class/qx/ui/menu/AbstractButton.js +28 -0
  95. package/source/class/qx/ui/menu/Button.js +3 -0
  96. package/source/class/qx/ui/menu/CheckBox.js +8 -0
  97. package/source/class/qx/ui/menu/Manager.js +2 -0
  98. package/source/class/qx/ui/menu/Menu.js +74 -2
  99. package/source/class/qx/ui/menu/RadioButton.js +10 -1
  100. package/source/class/qx/ui/menubar/Button.js +0 -27
  101. package/source/class/qx/ui/menubar/MenuBar.js +12 -0
  102. package/source/class/qx/ui/splitpane/Blocker.js +3 -0
  103. package/source/class/qx/ui/splitpane/Pane.js +3 -0
  104. package/source/class/qx/ui/table/Table.js +24 -2
  105. package/source/class/qx/ui/table/cellrenderer/Abstract.js +3 -1
  106. package/source/class/qx/ui/table/cellrenderer/AbstractImage.js +7 -3
  107. package/source/class/qx/ui/table/headerrenderer/HeaderCell.js +3 -0
  108. package/source/class/qx/ui/table/pane/Header.js +3 -0
  109. package/source/class/qx/ui/table/pane/Model.js +10 -4
  110. package/source/class/qx/ui/table/pane/Scroller.js +3 -7
  111. package/source/class/qx/ui/table/rowrenderer/Default.js +1 -1
  112. package/source/class/qx/ui/tabview/Page.js +26 -0
  113. package/source/class/qx/ui/tabview/TabView.js +3 -0
  114. package/source/class/qx/ui/toolbar/Button.js +2 -27
  115. package/source/class/qx/ui/toolbar/CheckBox.js +0 -27
  116. package/source/class/qx/ui/toolbar/RadioButton.js +21 -0
  117. package/source/class/qx/ui/toolbar/SplitButton.js +0 -28
  118. package/source/class/qx/ui/toolbar/ToolBar.js +3 -0
  119. package/source/class/qx/ui/window/Window.js +8 -0
  120. package/source/class/qx/util/format/DateFormat.js +44 -17
  121. package/source/class/qxWeb.js +2 -0
  122. package/source/resource/qx/decoration/Indigo/font/JosefinSlab-SemiBold.ttf +0 -0
  123. package/source/resource/qx/decoration/Indigo/font/SIL Open Font License 1.1.txt +0 -0
  124. package/source/resource/qx/iconfont/MaterialIcons/fetch-fonts.sh +0 -0
  125. package/source/resource/qx/tool/bin/build-devtools +0 -0
  126. package/source/resource/qx/tool/bin/build-website +0 -0
  127. package/source/resource/qx/tool/bin/download-assets +0 -0
  128. package/source/resource/qx/tool/cli/templates/loader/loader-node.tmpl.js +3 -1
  129. package/source/resource/qx/tool/cli/templates/template_vars.js +1 -1
  130. package/source/resource/qx/tool/loadsass.js +6 -12
  131. package/source/resource/qx/tool/schema/Manifest-1-0-0.json +1 -2
  132. package/source/resource/qx/tool/schema/Manifest-2-0-0.json +1 -2
  133. package/source/resource/qx/tool/schema/compile-1-0-0.json +3 -7
  134. package/source/translation/hr.po +297 -0
  135. package/lib/resource/qx/tool/website/.gitignore +0 -2
  136. package/source/class/qx/io/request/auth/.gitignore +0 -0
  137. package/source/class/qx/test/bom/client/.gitignore +0 -0
  138. package/source/class/qx/test/ui/control/.gitignore +0 -0
  139. package/source/resource/qx/decoration/Modern/treevirtual/.gitignore +0 -0
  140. package/source/resource/qx/mobile/css/.gitignore +0 -3
  141. package/source/resource/qx/tool/website/.gitignore +0 -2
  142. package/source/resource/qx/website/.gitignore +0 -1
  143. package/source/resource/qx/website/scss/.gitignore +0 -1
@@ -0,0 +1,267 @@
1
+ /* ************************************************************************
2
+
3
+ qooxdoo - the new era of web development
4
+
5
+ http://qooxdoo.org
6
+
7
+ Copyright:
8
+ 2004-2011 1&1 Internet AG, Germany, http://www.1und1.de & contributors
9
+
10
+ License:
11
+ MIT: https://opensource.org/licenses/MIT
12
+ See the LICENSE file in the project's top-level directory for details.
13
+
14
+ Authors:
15
+ * Tristan Koch (tristankoch)
16
+ * Christian Boulanger (cboulanger)
17
+
18
+ ************************************************************************ */
19
+
20
+ /**
21
+ * Tests for qx.io.jsonrpc.Client with a qx.test.io.request.Xhr transport
22
+ */
23
+ qx.Class.define("qx.test.io.jsonrpc.Client",
24
+ {
25
+ extend : qx.dev.unit.TestCase,
26
+
27
+ include : [
28
+ qx.dev.unit.MMock,
29
+ qx.test.io.MAssert
30
+ ],
31
+
32
+ members : {
33
+
34
+ setUp() {
35
+ this.sinon = qx.dev.unit.Sinon.getSinon();
36
+ this.setUpRequest();
37
+ this.setUpFakeTransport();
38
+ qx.io.jsonrpc.protocol.Request.resetId();
39
+ },
40
+
41
+ setUpRequest: function () {
42
+ this.req && this.req.dispose();
43
+ this.req = new qx.io.request.Xhr();
44
+ this.req.setUrl("url");
45
+ },
46
+
47
+ setUpFakeTransport: function () {
48
+ if (this.transport && this.transport.send.restore) {
49
+ return;
50
+ }
51
+ this.transport = this.injectStub(qx.io.request.Xhr.prototype, "_createTransport");
52
+ this.setUpRequest();
53
+ },
54
+
55
+ setUpFakeXhr: function () {
56
+ // Not fake transport
57
+ this.getSandbox().restore();
58
+ this.useFakeXMLHttpRequest();
59
+ this.setUpRequest();
60
+ },
61
+
62
+ /**
63
+ * Sets up the fake server and instructs it to send the given response(s)
64
+ * @param {String} response The server response to the first request
65
+ */
66
+ setUpFakeServer: function (response) {
67
+ // Not fake transport
68
+ this.getSandbox().restore();
69
+ this.useFakeServer();
70
+ this.setUpRequest();
71
+ this.getServer().respondWith(
72
+ "POST", /.*/,
73
+ [200, {"Content-Type": "application/json; charset=utf-8"}, response]
74
+ );
75
+ this.getServer().autoRespond = true;
76
+ },
77
+
78
+ /**
79
+ * Assert that the given exception is thrown on receiving the given result
80
+ * @param {String} response
81
+ * @param {Class|Number} exception If class, the exception class, which must
82
+ * be a subclass of qx.io.exception.Exception. If number, the error number
83
+ */
84
+ assertExceptionThrown: function (response, exception) {
85
+ if (!(qx.lang.Type.isNumber(exception) || qx.Class.isSubClassOf(exception, qx.io.exception.Exception))) {
86
+ throw new Error("Second argument must be a Number or a subclass of qx.io.exception.Exception");
87
+ }
88
+ this.setUpFakeServer(response);
89
+ const message_out = new qx.io.jsonrpc.protocol.Request("foo",[1,2,3]);
90
+ const client = new qx.io.jsonrpc.Client("http://jsonrpc");
91
+ const errorCallback = this.spy(err => {
92
+ //console.warn(err);
93
+ if (qx.lang.Type.isNumber(exception)) {
94
+ if (!(err instanceof qx.io.exception.Exception)) {
95
+ throw err;
96
+ }
97
+ this.assertEquals(exception, err.code,`Error code does not match`);
98
+ } else {
99
+ this.assertInstance(err, exception,
100
+ `Exception class does not match. Expected ${exception.classname}, got ${err}.`);
101
+ }
102
+ });
103
+ // check message promise
104
+ message_out.getPromise().catch(errorCallback);
105
+ // check event
106
+ client.addListener("error", evt => errorCallback(evt.getData()));
107
+ // check transport promise
108
+ client.send(message_out).catch(errorCallback);
109
+ this.wait(100, () => {
110
+ if (
111
+ // the request promise will not be called since the promise is already rejected
112
+ exception === qx.io.exception.Transport.DUPLICATE_ID
113
+ // or the send promise will not be rejected because we have a server-side error
114
+ || exception === qx.io.exception.Protocol) {
115
+ this.assertCalledTwice(errorCallback)
116
+ } else {
117
+ // the error handler will be called three times
118
+ this.assertCalledThrice(errorCallback)
119
+ }
120
+ });
121
+ },
122
+
123
+ tearDown: function () {
124
+ this.getSandbox().restore();
125
+ this.req.dispose();
126
+ },
127
+
128
+ resetId(){
129
+ qx.io.jsonrpc.protocol.Request.resetId();
130
+ },
131
+
132
+ //
133
+ // Auth, should be moved into qx.test.io.request.Xhr
134
+ //
135
+
136
+ "test: Bearer authentication": function () {
137
+ this.setUpFakeTransport();
138
+
139
+ var transport = this.transport, auth, call, key, credentials;
140
+
141
+ auth = new qx.io.request.authentication.Bearer("TOKEN");
142
+ this.req.setAuthentication(auth);
143
+ this.req.send();
144
+
145
+ call = transport.setRequestHeader.getCall(1);
146
+ key = "Authorization";
147
+ credentials = /Bearer\s(.*)/.exec(call.args[1])[1];
148
+ this.assertEquals(key, call.args[0]);
149
+ this.assertEquals("TOKEN", credentials);
150
+ },
151
+
152
+ //
153
+ // JSON-RPC
154
+ //
155
+
156
+ "test: throw on invalid response id" : function() {
157
+ this.resetId();
158
+ var response = qx.lang.Json.stringify({"jsonrpc": "2.0", "result": 19, "id": 2});
159
+ this.assertExceptionThrown(response, qx.io.exception.Transport.UNKNOWN_ID);
160
+ },
161
+
162
+ "test: throw on duplicate response id" : function() {
163
+ this.resetId();
164
+ var response = qx.lang.Json.stringify([
165
+ {"jsonrpc": "2.0", "result": 19, "id": 1},
166
+ {"jsonrpc": "2.0", "result": 19, "id": 1}
167
+ ]);
168
+ this.assertExceptionThrown(response, qx.io.exception.Transport.DUPLICATE_ID);
169
+ },
170
+
171
+ "test: call jsonrpc method and receive response with single result" : async function() {
172
+ this.resetId();
173
+ let message_out = new qx.io.jsonrpc.protocol.Request("foo", ["bar"]);
174
+ let result = "Hello World!";
175
+ let message_in = new qx.io.jsonrpc.protocol.Result(message_out.getId(), result);
176
+ this.setUpFakeServer(message_in.toString());
177
+ const client = new qx.io.jsonrpc.Client("http://jsonrpc");
178
+ let spy = this.spy(value => this.assertEquals(result, value));
179
+ message_out.getPromise().then(spy);
180
+ await client.send(message_out);
181
+ this.assertCalled(spy);
182
+ },
183
+
184
+ "test: call jsonrpc method and receive batched response" : async function() {
185
+ this.resetId();
186
+ let message_out = new qx.io.jsonrpc.protocol.Request("foo", ["bar"]);
187
+ let result = "Hello World!";
188
+ let response = (new qx.io.jsonrpc.protocol.Batch())
189
+ .add(new qx.io.jsonrpc.protocol.Result(message_out.getId(), result))
190
+ .addRequest("foo", ["bar"])
191
+ .addNotification("logout")
192
+ .toString();
193
+ this.setUpFakeServer(response);
194
+ const client = new qx.io.jsonrpc.Client("http://jsonrpc");
195
+ let spy = this.spy(value => this.assertEquals(result, value));
196
+ message_out.getPromise().then(spy);
197
+ await client.send(message_out);
198
+ this.assertCalled(spy);
199
+ },
200
+
201
+ "test: call jsonrpc method and expect error on invalid reponse "() {
202
+ this.assertExceptionThrown("helloworld!", qx.io.exception.Transport.INVALID_JSON);
203
+ },
204
+
205
+ "test: call jsonrpc method and expect error on invalid reponse - missing result" () {
206
+ this.assertExceptionThrown("null", qx.io.exception.Transport.NO_DATA);
207
+ },
208
+
209
+ "test: call jsonrpc method and expect error response"() {
210
+ this.resetId();
211
+ var response = qx.lang.Json.stringify({"jsonrpc": "2.0", "error" : {"code": -32600, "message": "Division by zero!"}, "id": 1});
212
+ this.assertExceptionThrown(response, qx.io.exception.Protocol);
213
+ },
214
+
215
+ "test: send batched requests"() {
216
+ this.resetId();
217
+ var response = qx.lang.Json.stringify([
218
+ {"jsonrpc": "2.0", "result": 7, "id": 1},
219
+ {"jsonrpc": "2.0", "result": "foo", "id": 2},
220
+ {"jsonrpc": "2.0", "error": {"code": -32600, "message": "Invalid Request"}, "id": 3},
221
+ {"jsonrpc": "2.0", "error": {"code": -32601, "message": "Method not found"}, "id": 4},
222
+ {"jsonrpc": "2.0", "result": ["hello", 5], "id": 5}]);
223
+ this.setUpFakeServer(response);
224
+ var client = new qx.io.jsonrpc.Client("http://jsonrpc");
225
+ var spies = [];
226
+ var batch = new qx.io.jsonrpc.protocol.Batch();
227
+ for( var i=1; i < 6; i++) {
228
+ spies[i] = { result: this.spy(), error: this.spy() };
229
+ let request = new qx.io.jsonrpc.protocol.Request("someMethod", []);
230
+ request.getPromise()
231
+ .then(spies[i].result)
232
+ .catch(spies[i].error);
233
+ batch.add(request);
234
+ }
235
+ client.sendBatch(batch).catch(err => {
236
+ this.assertInstance(err, qx.io.exception.Protocol);
237
+ });
238
+ this.wait(100, function(){
239
+ this.assertCalledWith(spies[1].result, 7);
240
+ this.assertCalledWith(spies[2].result, "foo");
241
+ this.assertCalled(spies[3].error);
242
+ this.assertCalled(spies[4].error);
243
+ this.assertCalledWith(spies[5].result, ["hello", 5]);
244
+ },this);
245
+ },
246
+
247
+ "test: receive jsonrpc requests from server" : function() {
248
+ this.resetId();
249
+ var response = [
250
+ {"jsonrpc": "2.0", "method": "clientMethod", "params": ["foo", "bar"], "id": 1},
251
+ {"jsonrpc": "2.0", "method": "clientNotification", "params": []}
252
+ ];
253
+ this.setUpFakeServer(qx.lang.Json.stringify(response));
254
+ var client = new qx.io.jsonrpc.Client("http://jsonrpc");
255
+ var spy = this.spy();
256
+ client.addListener("incomingRequest", evt => {
257
+ let message = evt.getData().toObject();
258
+ this.assertDeepEquals(response.shift(), message);
259
+ spy(message);
260
+ });
261
+ client.sendNotification("ping");
262
+ this.wait(100, function(){
263
+ this.assertCalledTwice(spy);
264
+ },this);
265
+ }
266
+ }
267
+ });
@@ -0,0 +1,80 @@
1
+ /* ************************************************************************
2
+
3
+ qooxdoo - the new era of web development
4
+
5
+ http://qooxdoo.org
6
+
7
+ Copyright:
8
+ 2020 Christian Boulanger
9
+
10
+ License:
11
+ MIT: https://opensource.org/licenses/MIT
12
+ See the LICENSE file in the project's top-level directory for details.
13
+
14
+ Authors:
15
+ * Christian Boulanger (cboulanger)
16
+
17
+ ************************************************************************ */
18
+
19
+ qx.Class.define("qx.test.io.jsonrpc.Protocol",
20
+ {
21
+ extend : qx.dev.unit.TestCase,
22
+ include : [qx.test.io.MAssert],
23
+ construct() {
24
+ this.base(arguments);
25
+ this.parser = new qx.io.jsonrpc.protocol.Parser();
26
+ },
27
+ members : {
28
+ "test: JSON-RPC request message object"() {
29
+ let message = new qx.io.jsonrpc.protocol.Request("foo", ["bar", 1, false]);
30
+ let expected = {
31
+ id: 1,
32
+ jsonrpc: "2.0",
33
+ method: "foo",
34
+ params: ["bar", 1, false]
35
+ };
36
+ this.assertDeepEquals(expected, message.toObject());
37
+ // test parser
38
+ this.assertDeepEquals(expected, this.parser.parse(JSON.stringify(expected)).toObject());
39
+ },
40
+
41
+ "test: JSON-RPC request notification object"() {
42
+ let message = new qx.io.jsonrpc.protocol.Notification("foo", ["bar", 1, false]);
43
+ let expected = {
44
+ jsonrpc: "2.0",
45
+ method: "foo",
46
+ params: ["bar", 1, false]
47
+ };
48
+ this.assertDeepEquals(expected, message.toObject());
49
+ // test parser
50
+ this.assertDeepEquals(expected, this.parser.parse(JSON.stringify(expected)).toObject());
51
+ },
52
+
53
+ "test: JSON-RPC error object"() {
54
+ let message = new qx.io.jsonrpc.protocol.Error(1, 5, "error!");
55
+ let expected = {
56
+ jsonrpc: "2.0",
57
+ id: 1,
58
+ error: {
59
+ code: 5,
60
+ message: "error!"
61
+ }
62
+ };
63
+ this.assertDeepEquals(expected, message.toObject());
64
+ // test parser
65
+ this.assertDeepEquals(expected, this.parser.parse(JSON.stringify(expected)).toObject());
66
+ },
67
+
68
+ "test: JSON-RPC result object"() {
69
+ let message = new qx.io.jsonrpc.protocol.Error(1, 5, "error!");
70
+ let expected = {
71
+ jsonrpc: "2.0", id: 1, error: {
72
+ code: 5, message: "error!"
73
+ }
74
+ };
75
+ this.assertDeepEquals(expected, message.toObject());
76
+ // test parser
77
+ this.assertDeepEquals(expected, this.parser.parse(JSON.stringify(expected)).toObject());
78
+ }
79
+ }
80
+ });
@@ -0,0 +1,56 @@
1
+ /* ************************************************************************
2
+
3
+ qooxdoo - the new era of web development
4
+
5
+ http://qooxdoo.org
6
+
7
+ Copyright:
8
+ 2004-2011 1&1 Internet AG, Germany, http://www.1und1.de & contributors
9
+
10
+ License:
11
+ MIT: https://opensource.org/licenses/MIT
12
+ See the LICENSE file in the project's top-level directory for details.
13
+
14
+ Authors:
15
+ * Tristan Koch (tristankoch)
16
+ * Christian Boulanger (cboulanger)
17
+
18
+ ************************************************************************ */
19
+
20
+ /**
21
+ * Tests for the postMessage transport
22
+ * @ignore(URL)
23
+ * @ignore(Worker)
24
+ * @ignore(self)
25
+ */
26
+ qx.Class.define("qx.test.io.transport.PostMessage", {
27
+ extend: qx.dev.unit.TestCase,
28
+
29
+ members: {
30
+
31
+ setUp() {
32
+ // see https://medium.com/@dee_bloo/make-multithreading-easier-with-inline-web-workers-a58723428a42
33
+ function createWorker(fn) {
34
+ let blob = new Blob(['self.onmessage = ', fn.toString()], { type: 'text/javascript' });
35
+ return new Worker(URL.createObjectURL(blob));
36
+ }
37
+ // create echo server
38
+ const worker = createWorker(evt => {
39
+ self.postMessage(evt.data);
40
+ });
41
+ this.transport = new qx.io.transport.PostMessage(worker);
42
+ },
43
+
44
+ async "test: send message to worker and check response"() {
45
+ let message = "Hello World!";
46
+ await new qx.Promise((resolve, reject) => {
47
+ this.transport.addListenerOnce("message", evt => {
48
+ this.assertEquals(message, evt.getData());
49
+ });
50
+ this.transport.send(message)
51
+ .then(resolve)
52
+ .catch(reject);
53
+ });
54
+ }
55
+ }
56
+ });
@@ -0,0 +1,63 @@
1
+ /* ************************************************************************
2
+
3
+ qooxdoo - the new era of web development
4
+
5
+ http://qooxdoo.org
6
+
7
+ Copyright:
8
+ 2004-2011 1&1 Internet AG, Germany, http://www.1und1.de & contributors
9
+
10
+ License:
11
+ MIT: https://opensource.org/licenses/MIT
12
+ See the LICENSE file in the project's top-level directory for details.
13
+
14
+ Authors:
15
+ * Tristan Koch (tristankoch)
16
+ * Christian Boulanger (cboulanger)
17
+
18
+ ************************************************************************ */
19
+
20
+ /**
21
+ * Tests for the websocket transport
22
+ */
23
+ qx.Class.define("qx.test.io.transport.Websocket", {
24
+ extend: qx.dev.unit.TestCase,
25
+
26
+ statics: {
27
+ TEST_ENDPOINT: "echo.websocket.events"
28
+ },
29
+
30
+ members: {
31
+
32
+ __hasEndpoint : false,
33
+ __skipMsg: "Skipping test as endpoint is not available.",
34
+
35
+ setUp() {
36
+ this.transport = new qx.io.transport.Websocket("wss://" + this.constructor.TEST_ENDPOINT);
37
+ },
38
+
39
+ async "test: check endpoint"() {
40
+ try {
41
+ await this.transport.send("test");
42
+ this.__hasEndpoint = true;
43
+ } catch(e) {
44
+ console.error(`Endpoint ${this.constructor.TEST_ENDPOINT} is not accessible: ${e.message}`);
45
+ }
46
+ },
47
+
48
+ async "test: send message to public websocket echo server and check response"() {
49
+ if (!this.__hasEndpoint) {
50
+ return this.skip(this.__skipMsg);
51
+ }
52
+ let message = "Hello World!";
53
+ await new qx.Promise((resolve, reject) => {
54
+ this.transport.addListenerOnce("message", evt => {
55
+ this.assertEquals(message, evt.getData());
56
+ });
57
+ this.transport.send(message)
58
+ .then(resolve)
59
+ .catch(reject);
60
+ });
61
+ }
62
+ }
63
+ });
@@ -88,6 +88,7 @@ qx.Class.define("qx.test.ui.embed.Iframe",
88
88
  this.wait(10000);
89
89
  },
90
90
 
91
+ /** @ignore(require) */
91
92
  testSyncSourceAfterDOMMove : function ()
92
93
  {
93
94
  // This breaks (very) frequently when run under headless chrome on Travis; we can't
@@ -87,48 +87,6 @@ qx.Class.define("qx.test.ui.form.ComboBox",
87
87
  this.flush();
88
88
  },
89
89
 
90
- testFocusTextOnClose: function() {
91
- var combobox = this.__createComboBox();
92
- this.getRoot().add(combobox);
93
- this.flush();
94
-
95
- // Open list popup
96
- combobox.open();
97
- this.flush();
98
-
99
- // Select item
100
- var list = combobox.getChildControl("list");
101
- var item = list.findItem("Item 0");
102
- list.setSelection([item]);
103
- this.flush();
104
-
105
- // Asssert focus on close
106
- this.spy(combobox, "tabFocus");
107
- combobox.close();
108
- this.assertCalled(combobox.tabFocus);
109
-
110
- this.getRoot().removeAll();
111
- combobox.dispose();
112
- },
113
-
114
- testNotFocusTextOnCloseWhenInvisibleBefore: function() {
115
- var combobox = this.__createComboBox();
116
- this.getRoot().add(combobox);
117
- this.flush();
118
-
119
- // Enter value
120
- combobox.setValue("Item 0");
121
- this.flush();
122
-
123
- // Assert not focus on close
124
- this.spy(combobox, "tabFocus");
125
- combobox.close();
126
- this.assertNotCalled(combobox.tabFocus);
127
-
128
- this.getRoot().removeAll();
129
- combobox.dispose();
130
- },
131
-
132
90
  __createComboBox : function(initValue)
133
91
  {
134
92
  var comboBox = new qx.ui.form.ComboBox();
@@ -805,15 +805,54 @@ qx.Class.define("qx.test.util.DateFormat",
805
805
  this._testIsoMasks(date, 'isoDate', 'yyyy-MM-dd');
806
806
  this._testIsoMasks(date, 'isoTime', 'HH:mm:ss');
807
807
  this._testIsoMasks(date, 'isoDateTime', "yyyy-MM-dd'T'HH:mm:ss");
808
-
809
- // var isodf = new qx.util.format.DateFormat('isoUtcDateTime');
810
- // var df = new qx.util.format.DateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
811
- // var isoDateFormatted = isodf.format(date);
812
- // var dateFormatted = df.format(date);
813
- // this.assertEquals(isodf.parse(isoDateFormatted).getTime(),df.parse(dateFormatted).getTime());
808
+ this._testIsoMasks(date, 'isoDateTimeTz', "yyyy-MM-dd'T'HH:mm:ssZ");
809
+ //this._testIsoMasks(date, 'isoUtcDateTime', "yyyy-MM-dd'T'HH:mm:ss'Z'");
814
810
  }
815
811
  },
816
812
 
813
+ testIsoTz : function() {
814
+ var isodf = new qx.util.format.DateFormat('isoDateTimeTz');
815
+ var parsedDate = isodf.parse("2013-01-01T00:00:00+0000");
816
+ this.assertEquals(parsedDate.getUTCFullYear(), 2013);
817
+ this.assertEquals(parsedDate.getUTCMonth(), 0);
818
+ this.assertEquals(parsedDate.getUTCDate(), 1);
819
+ this.assertEquals(parsedDate.getUTCHours(), 0);
820
+ this.assertEquals(parsedDate.getUTCMinutes(), 0);
821
+ this.assertEquals(parsedDate.getUTCSeconds(), 0);
822
+ this.assertEquals(parsedDate.getUTCMilliseconds(), 0);
823
+
824
+ parsedDate = isodf.parse("2004-04-04T04:04:04-0500")
825
+ this.assertEquals(parsedDate.getUTCFullYear(), 2004);
826
+ this.assertEquals(parsedDate.getUTCMonth(), 3);
827
+ this.assertEquals(parsedDate.getUTCDate(), 3);
828
+ this.assertEquals(parsedDate.getUTCHours(), 23);
829
+ this.assertEquals(parsedDate.getUTCMinutes(), 4);
830
+ this.assertEquals(parsedDate.getUTCSeconds(), 4);
831
+ this.assertEquals(parsedDate.getUTCMilliseconds(), 0);
832
+ },
833
+
834
+ testUtc : function () {
835
+ var isodf = new qx.util.format.DateFormat('isoUtcDateTime');
836
+ var parsedDate = isodf.parse("2013-01-01T00:00:00Z");
837
+ this.assertEquals(parsedDate.getUTCFullYear(), 2013);
838
+ this.assertEquals(parsedDate.getUTCMonth(), 0);
839
+ this.assertEquals(parsedDate.getUTCDate(), 1);
840
+ this.assertEquals(parsedDate.getUTCHours(), 0);
841
+ this.assertEquals(parsedDate.getUTCMinutes(), 0);
842
+ this.assertEquals(parsedDate.getUTCSeconds(), 0);
843
+ this.assertEquals(parsedDate.getUTCMilliseconds(), 0);
844
+
845
+ // checks that UTC hours are calculated correctly
846
+ parsedDate = isodf.parse("2004-04-04T04:04:04Z");
847
+ this.assertEquals(parsedDate.getUTCHours(), 4);
848
+
849
+ // checks that UTC format does not parse a date with a timezone
850
+ this.assertException(function() {
851
+ isodf.parse("2004-04-04T04:04:04+05:00");
852
+ }, Error);
853
+
854
+ },
855
+
817
856
  testChangingLocales : function()
818
857
  {
819
858
  var manager = qx.locale.Manager.getInstance();
File without changes
File without changes
@@ -239,7 +239,9 @@ Version: v${await qx.tool.config.Utils.getQxVersion()}
239
239
  this._compilerApi.setCommand(command);
240
240
  await this.__notifyLibraries();
241
241
  try {
242
- return await command.process();
242
+ const res = await command.process();
243
+ await this._compilerApi.afterProcessFinished(command, res);
244
+ return res;
243
245
  } catch (e) {
244
246
  qx.tool.compiler.Console.error("Error: " + (e.stack || e.message));
245
247
  process.exit(1);
@@ -420,8 +422,8 @@ Version: v${await qx.tool.config.Utils.getQxVersion()}
420
422
  if (config.libraries && needLibraries) {
421
423
  let neededLibraries = config.libraries.filter(libData => !fs.existsSync(libData + "/Manifest.json"));
422
424
  if (neededLibraries.length) {
423
- if (!fs.existsSync(qx.tool.config.Manifest.config.fileName)) {
424
- qx.tool.compiler.Console.error("Libraries are missing and there is no Manifest.json in the current directory so we cannot attempt to install them; the missing libraries are: \n " + neededLibraries.join("\n "));
425
+ if (!fs.existsSync(qx.tool.config.Manifest.config.fileName)) {
426
+ qx.tool.compiler.Console.error("Libraries are missing and there is no Manifest.json in the current directory so we cannot attempt to install them; the missing libraries are: \n " + neededLibraries.join("\n "));
425
427
  process.exit(1);
426
428
  }
427
429
  qx.tool.compiler.Console.info("One or more libraries not found - trying to install them from library repository...");
@@ -25,7 +25,7 @@ const fs = qx.tool.utils.Promisify.fs;
25
25
 
26
26
  /**
27
27
  * Provides an API for the compiler
28
- *
28
+ *
29
29
  */
30
30
  qx.Class.define("qx.tool.cli.api.CompilerApi", {
31
31
  extend: qx.tool.cli.api.AbstractApi,
@@ -75,7 +75,7 @@ qx.Class.define("qx.tool.cli.api.CompilerApi", {
75
75
 
76
76
  /**
77
77
  * called after deployment happens
78
- *
78
+ *
79
79
  * @param data {Object} contains deployment infos with the following properties:
80
80
  * targetDir : {String} The target dir of the build
81
81
  * deployDir : {String} The output dir for the deployment
@@ -89,7 +89,7 @@ qx.Class.define("qx.tool.cli.api.CompilerApi", {
89
89
 
90
90
  /**
91
91
  * Loads the configuration data
92
- *
92
+ *
93
93
  * @overridden
94
94
  */
95
95
  async load() {
@@ -102,6 +102,16 @@ qx.Class.define("qx.tool.cli.api.CompilerApi", {
102
102
  return this.base(arguments);
103
103
  },
104
104
 
105
+ /**
106
+ * runs after the whole process is finished
107
+ * @param cmd {qx.tool.cli.commands.Command} current command
108
+ * @param res {boolean} result of the just finished process
109
+ */
110
+ async afterProcessFinished(cmd, res) {
111
+ // Nothing
112
+ },
113
+
114
+
105
115
  /**
106
116
  * Called after all libraries have been loaded and added to the compilation data
107
117
  */
@@ -113,7 +123,7 @@ qx.Class.define("qx.tool.cli.api.CompilerApi", {
113
123
 
114
124
  /**
115
125
  * Adds a library configuration
116
- *
126
+ *
117
127
  * @param libraryApi {LibraryApi} the configuration for the library
118
128
  */
119
129
  addLibraryApi(libraryApi) {
@@ -123,7 +133,7 @@ qx.Class.define("qx.tool.cli.api.CompilerApi", {
123
133
 
124
134
  /**
125
135
  * Returns an array of library configurations
126
- *
136
+ *
127
137
  * @return {LibraryApi[]}
128
138
  */
129
139
  getLibraryApis() {
@@ -127,6 +127,13 @@ qx.Class.define("qx.tool.cli.commands.Command", {
127
127
  */
128
128
  getQxPath: qx.tool.config.Utils.getQxPath.bind(qx.tool.config.Utils),
129
129
 
130
+ /**
131
+ *
132
+ * @returns @see {@link qx.tool.config.Utils#getCompilerVersion}
133
+ */
134
+ getCompilerVersion() {
135
+ return qx.tool.config.Utils.getCompilerVersion();
136
+ },
130
137
 
131
138
  /**
132
139
  * Returns the qooxdoo version, either from the `--qx-version` command line