@qooxdoo/framework 7.0.0-beta.6 → 7.0.0-beta.7
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/Manifest.json +1 -1
- package/README.md +3 -1
- package/lib/compiler/compile-info.json +57 -55
- package/lib/compiler/index.js +2440 -1860
- package/lib/resource/qx/tool/cli/templates/skeleton/mobile/source/theme/custom/css/custom.css.map +1 -1
- package/lib/resource/qx/tool/schema/compile-1-0-0.json +6 -11
- package/package.json +3 -2
- package/source/class/qx/Bootstrap.js +22 -1
- package/source/class/qx/bom/Blocker.js +2 -1
- package/source/class/qx/core/Environment.js +3 -12
- package/source/class/qx/core/MProperty.js +1 -1
- package/source/class/qx/dev/unit/Sinon.js +1 -1
- package/source/class/qx/test/core/Assert.js +1 -1
- package/source/class/qx/test/core/Environment.js +0 -3
- package/source/class/qx/tool/cli/Cli.js +1 -0
- package/source/class/qx/tool/cli/commands/Compile.js +10 -0
- package/source/class/qx/tool/cli/commands/Es6ify.js +93 -0
- package/source/class/qx/tool/cli/commands/package/Install.js +1 -1
- package/source/class/qx/tool/compiler/ClassFile.js +67 -27
- package/source/class/qx/tool/compiler/Es6ify.js +368 -0
- package/source/class/qx/tool/compiler/targets/Target.js +56 -47
- package/source/class/qx/tool/compiler/targets/meta/AbstractJavascriptMeta.js +25 -18
- package/source/class/qx/tool/compiler/targets/meta/BootJs.js +16 -16
- package/source/class/qx/tool/compiler/targets/meta/Uglify.js +10 -10
- package/source/class/qx/ui/decoration/MLinearBackgroundGradient.js +2 -1
- package/source/resource/qx/tool/schema/compile-1-0-0.json +6 -11
- package/lib/resource/qx/static/blank.gif +0 -0
- package/source/class/qx/io/remote/Exchange.js +0 -1063
- package/source/class/qx/io/remote/Request.js +0 -1021
- package/source/class/qx/io/remote/RequestQueue.js +0 -521
- package/source/class/qx/io/remote/Response.js +0 -137
- package/source/class/qx/io/remote/Rpc.js +0 -1075
- package/source/class/qx/io/remote/RpcError.js +0 -198
- package/source/class/qx/io/remote/__init__.js +0 -88
- package/source/class/qx/io/remote/transport/Abstract.js +0 -513
- package/source/class/qx/io/remote/transport/Iframe.js +0 -652
- package/source/class/qx/io/remote/transport/Script.js +0 -475
- package/source/class/qx/io/remote/transport/XmlHttp.js +0 -1019
- package/source/class/qx/io/remote/transport/__init__.js +0 -3
- package/source/class/qx/test/io/remote/AbstractRequest.js +0 -150
- package/source/class/qx/test/io/remote/RequestIframe.js +0 -105
- package/source/class/qx/test/io/remote/RequestXhr.js +0 -151
- package/source/class/qx/test/io/remote/Rpc.js +0 -205
- package/source/class/qx/test/io/remote/__init__.js +0 -4
- package/source/class/qx/test/io/remote/transport/Iframe.js +0 -67
- package/source/class/qx/test/io/remote/transport/XmlHttp.js +0 -133
- package/source/class/qx/test/io/remote/transport/__init__.js +0 -4
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/* ************************************************************************
|
|
2
|
-
|
|
3
|
-
qooxdoo - the new era of web development
|
|
4
|
-
|
|
5
|
-
http://qooxdoo.org
|
|
6
|
-
|
|
7
|
-
Copyright:
|
|
8
|
-
2007-2008 1&1 Internet AG, Germany, http://www.1und1.de
|
|
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
|
-
* Fabian Jakobs (fjakobs)
|
|
16
|
-
* Tristan Koch (tristankoch)
|
|
17
|
-
|
|
18
|
-
************************************************************************ */
|
|
19
|
-
|
|
20
|
-
/*
|
|
21
|
-
*/
|
|
22
|
-
/**
|
|
23
|
-
*
|
|
24
|
-
* @asset(qx/test/*)
|
|
25
|
-
*/
|
|
26
|
-
|
|
27
|
-
qx.Class.define("qx.test.io.remote.AbstractRequest",
|
|
28
|
-
{
|
|
29
|
-
type : "abstract",
|
|
30
|
-
extend : qx.dev.unit.TestCase,
|
|
31
|
-
include : qx.test.io.MRemoteTest,
|
|
32
|
-
|
|
33
|
-
members :
|
|
34
|
-
{
|
|
35
|
-
_requests : null,
|
|
36
|
-
|
|
37
|
-
setUp : function()
|
|
38
|
-
{
|
|
39
|
-
this._requests = [];
|
|
40
|
-
|
|
41
|
-
for (var i = 0; i < 10 ; i++) {
|
|
42
|
-
var request = this._createRequest();
|
|
43
|
-
|
|
44
|
-
request.addListener("aborted", this.responseError, this);
|
|
45
|
-
request.addListener("failed", this.responseError, this);
|
|
46
|
-
request.addListener("timeout", this.responseError, this);
|
|
47
|
-
|
|
48
|
-
this._requests[i] = request;
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
_createRequest : function() {
|
|
54
|
-
throw new Error("Abstract method call");
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
_getRequests: function() {
|
|
58
|
-
return this._requests;
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
tearDown : function() {
|
|
62
|
-
this._disposeArray("_requests");
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
responseError : function(e)
|
|
67
|
-
{
|
|
68
|
-
var request = e;
|
|
69
|
-
var type = e.getType();
|
|
70
|
-
|
|
71
|
-
qx.event.Timer.once(function()
|
|
72
|
-
{
|
|
73
|
-
this.resume(function()
|
|
74
|
-
{
|
|
75
|
-
this.fail("Response error: " + type + " " +
|
|
76
|
-
request.getStatusCode()
|
|
77
|
-
);
|
|
78
|
-
}, this);
|
|
79
|
-
}, this);
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
testAsynchronous : function()
|
|
84
|
-
{
|
|
85
|
-
if (this.isLocal()) {
|
|
86
|
-
this.needsPHPWarning();
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
var completedCount = 0;
|
|
91
|
-
|
|
92
|
-
for (var i = 0; i < this._requests.length; i++)
|
|
93
|
-
{
|
|
94
|
-
var request = this._requests[i];
|
|
95
|
-
|
|
96
|
-
request.setParameter("test", "test" + i);
|
|
97
|
-
|
|
98
|
-
request.addListener("completed", function(e)
|
|
99
|
-
{
|
|
100
|
-
completedCount++;
|
|
101
|
-
|
|
102
|
-
var response = qx.lang.Json.parse(e.getContent());
|
|
103
|
-
request = e.getTarget();
|
|
104
|
-
this.assertEquals(request.getParameter("test"), response["test"]);
|
|
105
|
-
|
|
106
|
-
}, this);
|
|
107
|
-
|
|
108
|
-
request.send();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
var that = this;
|
|
112
|
-
this.wait(5000, function()
|
|
113
|
-
{
|
|
114
|
-
that.assertEquals(i, completedCount);
|
|
115
|
-
});
|
|
116
|
-
},
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
testAbortedOnException : function()
|
|
120
|
-
{
|
|
121
|
-
if (this.isLocal()) {
|
|
122
|
-
this.needsPHPWarning();
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
var url = this.getUrl("qx/test/xmlhttp/echo_get_request.php");
|
|
127
|
-
var request = new qx.io.remote.Request(url, "GET", "text/plain");
|
|
128
|
-
request.addListener("failed", this.responseError, this);
|
|
129
|
-
request.addListener("timeout", this.responseError, this);
|
|
130
|
-
|
|
131
|
-
request.addListener("completed", function(e)
|
|
132
|
-
{
|
|
133
|
-
throw new Error("Expected exception.");
|
|
134
|
-
}, this);
|
|
135
|
-
|
|
136
|
-
request.addListener("aborted", function(e)
|
|
137
|
-
{
|
|
138
|
-
this.resume(function()
|
|
139
|
-
{
|
|
140
|
-
this.assertEquals(request, e.getTarget());
|
|
141
|
-
request.dispose();
|
|
142
|
-
}, this);
|
|
143
|
-
}, this);
|
|
144
|
-
|
|
145
|
-
request.send();
|
|
146
|
-
|
|
147
|
-
this.wait(2000);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
});
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
/* ************************************************************************
|
|
2
|
-
|
|
3
|
-
qooxdoo - the new era of web development
|
|
4
|
-
|
|
5
|
-
http://qooxdoo.org
|
|
6
|
-
|
|
7
|
-
Copyright:
|
|
8
|
-
2007-2008 1&1 Internet AG, Germany, http://www.1und1.de
|
|
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
|
-
* Fabian Jakobs (fjakobs)
|
|
16
|
-
|
|
17
|
-
************************************************************************ */
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @asset(qx/test/*)
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
qx.Class.define("qx.test.io.remote.RequestIframe",
|
|
27
|
-
{
|
|
28
|
-
extend : qx.test.io.remote.AbstractRequest,
|
|
29
|
-
include: [qx.dev.unit.MRequirements],
|
|
30
|
-
|
|
31
|
-
members :
|
|
32
|
-
{
|
|
33
|
-
setUp: function() {
|
|
34
|
-
this.base(arguments);
|
|
35
|
-
this.require(["php"]);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// Overridden
|
|
39
|
-
_createRequest : function() {
|
|
40
|
-
var url = this.getUrl("qx/test/xmlhttp/echo_form_request.php");
|
|
41
|
-
return new qx.io.remote.Request(url, "GET", "text/plain").set({
|
|
42
|
-
fileUpload: true
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
testAsynchronous : function()
|
|
47
|
-
{
|
|
48
|
-
if (this.isLocal()) {
|
|
49
|
-
this.needsPHPWarning();
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
var completedCount = 0;
|
|
54
|
-
|
|
55
|
-
for (var i = 0; i < this._requests.length; i++)
|
|
56
|
-
{
|
|
57
|
-
var request = this._requests[i],
|
|
58
|
-
emptyContent;
|
|
59
|
-
|
|
60
|
-
request.setParameter("test", "test" + i);
|
|
61
|
-
|
|
62
|
-
request.addListener("completed", function(e)
|
|
63
|
-
{
|
|
64
|
-
completedCount++;
|
|
65
|
-
|
|
66
|
-
// Skip test when response is empty. Occuring seemingly randomly
|
|
67
|
-
// in IE when many requests are made.
|
|
68
|
-
//
|
|
69
|
-
// May be due to timing issue showing under rare and obscure
|
|
70
|
-
// circumstances (clean cache, build variant, fresh browser window).
|
|
71
|
-
if (qx.core.Environment.get("engine.name") === "mshtml" &&
|
|
72
|
-
e.getContent() === "" && !emptyContent) {
|
|
73
|
-
this.warn("Skipping test due to empty content in one of the request's response");
|
|
74
|
-
emptyContent = true;
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
if (!emptyContent) {
|
|
79
|
-
var response = qx.lang.Json.parse(e.getContent());
|
|
80
|
-
request = e.getTarget();
|
|
81
|
-
this.assertEquals(request.getParameter("test"), response["test"]);
|
|
82
|
-
}
|
|
83
|
-
}, this);
|
|
84
|
-
|
|
85
|
-
request.send();
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
var that = this;
|
|
89
|
-
this.wait(5000, function()
|
|
90
|
-
{
|
|
91
|
-
that.assertEquals(i, completedCount);
|
|
92
|
-
});
|
|
93
|
-
},
|
|
94
|
-
|
|
95
|
-
testAsynchronousSingle: function() {
|
|
96
|
-
var request = this._requests[0];
|
|
97
|
-
request.setParameter("test", "affe");
|
|
98
|
-
request.addListener("completed", function(e) {
|
|
99
|
-
var response = qx.lang.Json.parse(e.getContent());
|
|
100
|
-
this.assertEquals("affe", response["test"]);
|
|
101
|
-
}, this);
|
|
102
|
-
request.send();
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
});
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
/* ************************************************************************
|
|
2
|
-
|
|
3
|
-
qooxdoo - the new era of web development
|
|
4
|
-
|
|
5
|
-
http://qooxdoo.org
|
|
6
|
-
|
|
7
|
-
Copyright:
|
|
8
|
-
2007-2008 1&1 Internet AG, Germany, http://www.1und1.de
|
|
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
|
-
* Fabian Jakobs (fjakobs)
|
|
16
|
-
|
|
17
|
-
************************************************************************ */
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @asset(qx/test/*)
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
qx.Class.define("qx.test.io.remote.RequestXhr",
|
|
27
|
-
{
|
|
28
|
-
extend : qx.test.io.remote.AbstractRequest,
|
|
29
|
-
include: [qx.dev.unit.MRequirements],
|
|
30
|
-
|
|
31
|
-
members :
|
|
32
|
-
{
|
|
33
|
-
setUp: function() {
|
|
34
|
-
this.base(arguments);
|
|
35
|
-
this.require(["php"]);
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
// Overridden
|
|
39
|
-
_createRequest : function() {
|
|
40
|
-
var url = this.getUrl("qx/test/xmlhttp/echo_get_request.php");
|
|
41
|
-
return new qx.io.remote.Request(url, "GET", "text/plain");
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
testSynchronous : function()
|
|
46
|
-
{
|
|
47
|
-
if (this.isLocal()) {
|
|
48
|
-
this.needsPHPWarning();
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
var completedCount = 0;
|
|
53
|
-
|
|
54
|
-
for (var i = 0; i < this._getRequests().length; i++)
|
|
55
|
-
{
|
|
56
|
-
var request = this._getRequests()[i];
|
|
57
|
-
|
|
58
|
-
request.setAsynchronous(false);
|
|
59
|
-
request.setParameter("test", "test" + i);
|
|
60
|
-
|
|
61
|
-
request.addListener("completed", function(e)
|
|
62
|
-
{
|
|
63
|
-
completedCount++;
|
|
64
|
-
|
|
65
|
-
var response = qx.lang.Json.parse(e.getContent());
|
|
66
|
-
request = e.getTarget();
|
|
67
|
-
this.assertEquals(request.getParameter("test"), response["test"]);
|
|
68
|
-
}, this);
|
|
69
|
-
|
|
70
|
-
request.send();
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
this.assertEquals(i, completedCount, "Test doesn't run synchronous!");
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
testSynchronousAndAsynchronousMix : function()
|
|
78
|
-
{
|
|
79
|
-
if (this.isLocal()) {
|
|
80
|
-
this.needsPHPWarning();
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
var asynchronousRequest = this._getRequests()[0];
|
|
85
|
-
var synchronousRequest = this._getRequests()[1];
|
|
86
|
-
|
|
87
|
-
asynchronousRequest.setParameter("test", "asynchronousRequest");
|
|
88
|
-
asynchronousRequest.setParameter("sleep", 1);
|
|
89
|
-
synchronousRequest.setParameter("test", "synchronousRequest");
|
|
90
|
-
synchronousRequest.setAsynchronous(false);
|
|
91
|
-
|
|
92
|
-
var asynchronousRequestFinished = false;
|
|
93
|
-
var synchronousRequestFinished = false;
|
|
94
|
-
|
|
95
|
-
asynchronousRequest.addListener("completed", function(e)
|
|
96
|
-
{
|
|
97
|
-
//this.resume(function()
|
|
98
|
-
//{
|
|
99
|
-
asynchronousRequestFinished = true;
|
|
100
|
-
|
|
101
|
-
var response = qx.lang.Json.parse(e.getContent());
|
|
102
|
-
var request = e.getTarget();
|
|
103
|
-
this.assertEquals(request.getParameter("test"), response["test"]);
|
|
104
|
-
//}, this);
|
|
105
|
-
}, this);
|
|
106
|
-
|
|
107
|
-
synchronousRequest.addListener("completed", function(e)
|
|
108
|
-
{
|
|
109
|
-
synchronousRequestFinished = true;
|
|
110
|
-
|
|
111
|
-
var response = qx.lang.Json.parse(e.getContent());
|
|
112
|
-
var request = e.getTarget();
|
|
113
|
-
this.assertEquals(request.getParameter("test"), response["test"]);
|
|
114
|
-
}, this);
|
|
115
|
-
|
|
116
|
-
asynchronousRequest.send();
|
|
117
|
-
synchronousRequest.send();
|
|
118
|
-
|
|
119
|
-
var that = this;
|
|
120
|
-
this.wait(5000, function()
|
|
121
|
-
{
|
|
122
|
-
that.assertTrue(asynchronousRequestFinished);
|
|
123
|
-
that.assertTrue(synchronousRequestFinished);
|
|
124
|
-
});
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
testGetResponseHeader : function()
|
|
128
|
-
{
|
|
129
|
-
if (this.isLocal()) {
|
|
130
|
-
this.needsPHPWarning();
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
var request = new qx.io.remote.Request();
|
|
135
|
-
|
|
136
|
-
// Response header is "juhu"
|
|
137
|
-
request.setUrl(this.getUrl("qx/test/xmlhttp/send_known_header.php"));
|
|
138
|
-
|
|
139
|
-
request.addListener("completed", function(e) { this.resume(function() {
|
|
140
|
-
this.assertEquals("kinners", e.getResponseHeader("juhu"), "Exact case match");
|
|
141
|
-
this.assertEquals("kinners", e.getResponseHeader("Juhu"), "Case insensitive match");
|
|
142
|
-
}, this); }, this);
|
|
143
|
-
|
|
144
|
-
var that = this;
|
|
145
|
-
window.setTimeout(function() {
|
|
146
|
-
request.send();
|
|
147
|
-
}, 1000);
|
|
148
|
-
this.wait(5000);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
});
|
|
@@ -1,205 +0,0 @@
|
|
|
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
|
|
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
|
-
|
|
17
|
-
************************************************************************ */
|
|
18
|
-
|
|
19
|
-
qx.Class.define("qx.test.io.remote.Rpc",
|
|
20
|
-
{
|
|
21
|
-
extend : qx.dev.unit.TestCase,
|
|
22
|
-
|
|
23
|
-
include : qx.dev.unit.MMock,
|
|
24
|
-
|
|
25
|
-
members :
|
|
26
|
-
{
|
|
27
|
-
setUpFakeRequest : function() {
|
|
28
|
-
var req = this.request = new qx.io.remote.Request();
|
|
29
|
-
|
|
30
|
-
// In prototype chain
|
|
31
|
-
req.setState = req.getSequenceNumber =
|
|
32
|
-
req.setData = req.send = function() {};
|
|
33
|
-
|
|
34
|
-
// Stub
|
|
35
|
-
this.stub(req);
|
|
36
|
-
req.addListener.restore();
|
|
37
|
-
req.dispatchEvent.restore();
|
|
38
|
-
req.getSequenceNumber.returns(undefined);
|
|
39
|
-
|
|
40
|
-
// Inject
|
|
41
|
-
this.injectStub(qx.io.remote, "Request", req);
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
tearDown: function() {
|
|
45
|
-
this.getSandbox().restore();
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
"test: send request": function() {
|
|
49
|
-
this.setUpFakeRequest();
|
|
50
|
-
var rpc = new qx.io.remote.Rpc("/foo");
|
|
51
|
-
|
|
52
|
-
rpc.callAsync();
|
|
53
|
-
this.assertCalledOnce(this.request.send);
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
"test: request data for params with date contains date literal when convert dates": function() {
|
|
57
|
-
this.setUpFakeRequest();
|
|
58
|
-
var obj = { date: new Date(Date.UTC(2020,0,1,0,0,0,123)) },
|
|
59
|
-
msg,
|
|
60
|
-
data;
|
|
61
|
-
|
|
62
|
-
var rpc = new qx.io.remote.Rpc();
|
|
63
|
-
this.stub(rpc, "_isConvertDates").returns(true);
|
|
64
|
-
this.stub(rpc, "createRpcData").returns({"params": obj});
|
|
65
|
-
rpc.callAsync();
|
|
66
|
-
|
|
67
|
-
data = this.request.setData.getCall(0).args[0];
|
|
68
|
-
msg = "Must contain converted date literal";
|
|
69
|
-
this.assertMatch(data, /"new Date\(Date.UTC\(2020,0,1,0,0,0,123\)\)"/, msg);
|
|
70
|
-
},
|
|
71
|
-
|
|
72
|
-
"test: request data for params with nested date contains date literal when convert dates": function() {
|
|
73
|
-
this.setUpFakeRequest();
|
|
74
|
-
var obj = {nested: {date: new Date(Date.UTC(2020,0,1,0,0,0,123))} },
|
|
75
|
-
msg,
|
|
76
|
-
data;
|
|
77
|
-
|
|
78
|
-
var rpc = new qx.io.remote.Rpc();
|
|
79
|
-
this.stub(rpc, "_isConvertDates").returns(true);
|
|
80
|
-
this.stub(rpc, "createRpcData").returns({"params": obj});
|
|
81
|
-
rpc.callAsync();
|
|
82
|
-
|
|
83
|
-
data = this.request.setData.getCall(0).args[0];
|
|
84
|
-
msg = "Must contain converted date literal";
|
|
85
|
-
this.assertMatch(data, /"new Date\(Date.UTC\(2020,0,1,0,0,0,123\)\)"/, msg);
|
|
86
|
-
},
|
|
87
|
-
|
|
88
|
-
"test: response contains date from literal when convert dates": function() {
|
|
89
|
-
this.setUpFakeRequest();
|
|
90
|
-
var rpc = new qx.io.remote.Rpc(),
|
|
91
|
-
req = this.request,
|
|
92
|
-
evt = qx.event.Registration.createEvent("completed", qx.io.remote.Response),
|
|
93
|
-
str = '{"result": {"date": new Date(Date.UTC(2020,0,1,0,0,0,123))} }',
|
|
94
|
-
that = this;
|
|
95
|
-
|
|
96
|
-
this.stub(rpc, "_isConvertDates").returns(true);
|
|
97
|
-
|
|
98
|
-
var callback = this.spy(function(result) {
|
|
99
|
-
var msg = "Expected value to be date but found " + typeof result.date;
|
|
100
|
-
that.assertTrue(qx.lang.Type.isDate(result.date), msg);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
rpc.callAsync(callback);
|
|
104
|
-
|
|
105
|
-
// Fake JSON-like (JavaScript) response
|
|
106
|
-
evt.setContent(str);
|
|
107
|
-
req.dispatchEvent(evt);
|
|
108
|
-
|
|
109
|
-
this.assertCalled(callback);
|
|
110
|
-
},
|
|
111
|
-
|
|
112
|
-
"test: response contains date from literal when convert dates and json response": function() {
|
|
113
|
-
this.setUpFakeRequest();
|
|
114
|
-
var rpc = new qx.io.remote.Rpc(),
|
|
115
|
-
req = this.request,
|
|
116
|
-
evt = qx.event.Registration.createEvent("completed", qx.io.remote.Response),
|
|
117
|
-
str = '{"result": {"date": "new Date(Date.UTC(2020,0,1,0,0,0,123))"} }',
|
|
118
|
-
that = this;
|
|
119
|
-
|
|
120
|
-
this.stub(rpc, "_isConvertDates").returns(true);
|
|
121
|
-
this.stub(rpc, "_isResponseJson").returns(true);
|
|
122
|
-
this.spy(qx.lang.Json, "parse");
|
|
123
|
-
|
|
124
|
-
var callback = this.spy(function(result) {
|
|
125
|
-
var msg;
|
|
126
|
-
|
|
127
|
-
that.assertCalled(qx.lang.Json.parse);
|
|
128
|
-
|
|
129
|
-
msg = "Expected value to be date but found " + typeof result.date;
|
|
130
|
-
that.assertTrue(qx.lang.Type.isDate(result.date), msg);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
rpc.callAsync(callback);
|
|
134
|
-
|
|
135
|
-
// Fake JSON (String) response
|
|
136
|
-
evt.setContent(str);
|
|
137
|
-
req.dispatchEvent(evt);
|
|
138
|
-
|
|
139
|
-
this.assertCalled(callback);
|
|
140
|
-
},
|
|
141
|
-
|
|
142
|
-
"test: response is parsed as JSON": function() {
|
|
143
|
-
this.setUpFakeRequest();
|
|
144
|
-
var rpc = new qx.io.remote.Rpc(),
|
|
145
|
-
req = this.request,
|
|
146
|
-
evt = qx.event.Registration.createEvent("completed", qx.io.remote.Response),
|
|
147
|
-
str = '{"result": { "json" : true} }',
|
|
148
|
-
that = this;
|
|
149
|
-
|
|
150
|
-
this.stub(rpc, "_isConvertDates").returns(false);
|
|
151
|
-
this.spy(qx.lang.Json, "parse");
|
|
152
|
-
|
|
153
|
-
var callback = this.spy(function(result) {
|
|
154
|
-
that.assertCalledWith(qx.lang.Json.parse, str);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
rpc.callAsync(callback);
|
|
158
|
-
|
|
159
|
-
// Fake JSON (String) response
|
|
160
|
-
evt.setContent(str);
|
|
161
|
-
req.dispatchEvent(evt);
|
|
162
|
-
|
|
163
|
-
this.assertCalled(callback);
|
|
164
|
-
},
|
|
165
|
-
|
|
166
|
-
"test: response is not parsed when already object": function() {
|
|
167
|
-
this.setUpFakeRequest();
|
|
168
|
-
var rpc = new qx.io.remote.Rpc(),
|
|
169
|
-
req = this.request,
|
|
170
|
-
evt = qx.event.Registration.createEvent("completed", qx.io.remote.Response),
|
|
171
|
-
obj = {"result": { "json" : true} },
|
|
172
|
-
that = this;
|
|
173
|
-
|
|
174
|
-
this.stub(rpc, "_isConvertDates").returns(false);
|
|
175
|
-
this.spy(qx.lang.Json, "parse");
|
|
176
|
-
|
|
177
|
-
var callback = this.spy(function(result) {
|
|
178
|
-
that.assertNotCalled(qx.lang.Json.parse);
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
rpc.callAsync(callback);
|
|
182
|
-
|
|
183
|
-
// Object response
|
|
184
|
-
evt.setContent(obj);
|
|
185
|
-
req.dispatchEvent(evt);
|
|
186
|
-
|
|
187
|
-
this.assertCalled(callback);
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
//
|
|
191
|
-
// isConvertDates()
|
|
192
|
-
//
|
|
193
|
-
|
|
194
|
-
"test: isConvertDates() returns true when Rpc true": function() {
|
|
195
|
-
var rpc = new qx.io.remote.Rpc();
|
|
196
|
-
this.stub(qx.io.remote.Rpc, "CONVERT_DATES", true);
|
|
197
|
-
this.assertEquals(true, rpc._isConvertDates());
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
skip: function(msg) {
|
|
202
|
-
throw new qx.dev.unit.RequirementError(null, msg);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/* ************************************************************************
|
|
2
|
-
|
|
3
|
-
qooxdoo - the new era of web development
|
|
4
|
-
|
|
5
|
-
http://qooxdoo.org
|
|
6
|
-
|
|
7
|
-
Copyright:
|
|
8
|
-
2010 1&1 Internet AG, Germany, http://www.1und1.de
|
|
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
|
-
|
|
17
|
-
************************************************************************ */
|
|
18
|
-
|
|
19
|
-
/*
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
*
|
|
23
|
-
* @asset(qx/test/xmlhttp/echo_get_request.php)
|
|
24
|
-
*/
|
|
25
|
-
|
|
26
|
-
qx.Class.define("qx.test.io.remote.transport.Iframe",
|
|
27
|
-
{
|
|
28
|
-
extend : qx.dev.unit.TestCase,
|
|
29
|
-
include : [
|
|
30
|
-
qx.test.io.MRemoteTest,
|
|
31
|
-
qx.dev.unit.MRequirements
|
|
32
|
-
],
|
|
33
|
-
|
|
34
|
-
members :
|
|
35
|
-
{
|
|
36
|
-
setUp: function() {
|
|
37
|
-
this.request = new qx.io.remote.transport.Iframe();
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
testGetIframeHtmlContent : function() {
|
|
42
|
-
if (this.isLocal()) {
|
|
43
|
-
this.needsPHPWarning();
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
this.require(["php"]);
|
|
47
|
-
|
|
48
|
-
this.request.addListener("completed", function() {
|
|
49
|
-
this.resume(function() {
|
|
50
|
-
var response = this.request.getIframeHtmlContent();
|
|
51
|
-
this.assertNotNull(response, "Response is 'null'!");
|
|
52
|
-
this.assertNotEquals("", response, "Response is empty!");
|
|
53
|
-
|
|
54
|
-
response = qx.lang.Json.parse(response);
|
|
55
|
-
this.assertEquals("my_param=expected", response["_data_"], "Response is wrong!");
|
|
56
|
-
}, this);
|
|
57
|
-
}, this);
|
|
58
|
-
|
|
59
|
-
// Send request
|
|
60
|
-
this.request.setUrl(this.getUrl("qx/test/xmlhttp/echo_get_request.php"));
|
|
61
|
-
this.request.setParameters({my_param: "expected"});
|
|
62
|
-
this.request.send();
|
|
63
|
-
|
|
64
|
-
this.wait();
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
});
|