UNPKG

@qooxdoo/framework

Version:

The JS Framework for Coders

67 lines (48 loc) 1.53 kB
/* ************************************************************************ qooxdoo - the new era of web development http://qooxdoo.org Copyright: 2004-2011 1&1 Internet AG, Germany, http://www.1und1.de License: MIT: https://opensource.org/licenses/MIT See the LICENSE file in the project's top-level directory for details. Authors: * Tristan Koch (tristankoch) ************************************************************************ */ /* ************************************************************************ ************************************************************************ */ /** * * @asset(qx/test/jsonp_primitive.php) */ qx.Class.define("qx.test.io.request.JsonpWithRemote", { extend: qx.dev.unit.TestCase, include: [qx.test.io.MRemoteTest, qx.dev.unit.MRequirements], members: { setUp() { this.require(["http", "php"]); }, tearDown() { this.req.dispose(); }, "test: fetch json"() { var req = (this.req = new qx.io.request.Jsonp()), url = this.noCache(this.getUrl("qx/test/jsonp_primitive.php")); req.addListener("load", e => { this.resume(function () { this.assertObject(req.getResponse()); this.assertTrue(req.getResponse()["boolean"]); }, this); }); req.setUrl(url); req.send(); this.wait(); }, noCache(url) { return qx.util.Uri.appendParamsToUrl( url, "nocache=" + new Date().valueOf() ); } } });