谁能给我一个关于如何在 QUnit 中测试以下代码的指针?
function ChooseBranch()
{
var BranchPromise = getBranches();
BranchPromise.then(function (BranchData) {
var BranchOptions = [];
$.each(BranchData, function (i, d) {
BranchOptions.push(d.BranchDescription)
});
swal({
title: 'Delivery Branch',
text: 'Please choose the branch below where the customer would like the order delivered',
showCancelButton: false,
input: 'select',
inputOptions: BranchOptions
}).then(function (result) {
DeliveryType = "Other";
DeliverToBranch = BranchData[result].BranchCode;
ItemOrder();
});
});
}
我尝试让 sweetalert2 对话框选择第一个选项,但直到测试失败后它才会出现在 dom 中?我基本上想测试 swal 是否可见。