我有以下代码块:
(function() {
QUnit.config.testTimeout = 10000;
var stringformat = QUnit.stringformat;
module('Web API GET Result has expected shape');
asyncTest('HomeData should return an array of Sets with their info as well as cards with their info, but no sides',
function () {
$.ajax({
url: '/sample/url',
dataType: 'json',
success: function (result) {
ok(
!!result.item, 'Got something');
start();
},
error: function(result) {
ok(false, 'Failed with: ' + result.responseText);
start();
}
}
);
}
);
return function () { asyncTest(); };
}我试着对不同结果的多个URL运行它,但是我不知道如何用不同的参数运行两次asyncTest。我尝试将函数(asyncTest的第二个参数)赋给一个变量并将其插入到asyncTest()中,但是这不起作用。如何定义多个“asyncTest”并运行它们?
发布于 2013-03-14 02:15:36
如果你在代码中使用jQuery,$.deferred(),$.when()和$.pipe()是你的朋友。上面的好教程是here、here
https://stackoverflow.com/questions/15393259
复制相似问题