Fixes request test

This commit is contained in:
Raul Ochoa 2014-12-09 18:11:00 +01:00
parent 9f35092943
commit f7d81998fc
2 changed files with 8 additions and 8 deletions

View File

View File

@ -4,7 +4,7 @@ QUnit.module('request');
asyncTest("json", 6, function(assert) { asyncTest("json", 6, function(assert) {
var called = null; var called = null;
torque.net.jsonp('http://test.com?callback=?', function(test) { torque.net.jsonp('./data/foobar.jsonp.js?callback=?', function(test) {
called = arguments; called = arguments;
}); });
@ -13,19 +13,19 @@ asyncTest("json", 6, function(assert) {
var found = null; var found = null;
for (var i = 0 ; !found && i < scripts.length; ++i) { for (var i = 0 ; !found && i < scripts.length; ++i) {
var s = scripts[i]; var s = scripts[i];
if (s.getAttribute('src').indexOf('test.com') !== -1) { if (s.getAttribute('src').indexOf('foobar.jsonp.js') !== -1) {
found = s; found = s;
} }
} }
var src = found.getAttribute('src'); var src = found.getAttribute('src');
var fnName = src.match(/torque_.*/); var fnName = src.match(/torque_.*/);
window[fnName]('test1', 2, null); window[fnName]('test1', 2, null);
equal(src.indexOf('http://test.com?callback=torque_'), 0); assert.equal(src.indexOf('./data/foobar.jsonp.js?callback=torque_'), 0);
equal(called[0], 'test1'); assert.equal(called[0], 'test1');
equal(called[1], 2); assert.equal(called[1], 2);
equal(called[2], null); assert.equal(called[2], null);
equal(found.parent, null); assert.equal(found.parent, null);
equal(window[fnName], undefined); assert.equal(window[fnName], undefined);
QUnit.start(); QUnit.start();
}, 5); }, 5);