0
在我的javascript文件中提到的代码存在。但是,当我运行通过Qunit.js和Blanket.js 我得到这个错误在Chrome的JavaScript测试用例:“无法读取的未定义的属性‘子’ - {}”无法读取Qunit测试用例中未定义问题的属性'substring'
if ($("label[for=ReservationInformation]").text().substring(0, 1) != "*") {
$("label[for=ReservationInformation]").text("*" + $("label[for=ReservationInformation]").text());
}
我已经定义的测试情况下, :
test("validationChecker test", 1, function() {
var div = $('<div>').appendTo("body");
$('<input>', { id: "ReservationInformation" }).appendTo(div);
$('<label>', { "for": "ReservationInformation" }).appendTo(div);
var result = validationChecker(null);
equal(undefined, result, "passed");
$("div").remove();
});
'SUBSTR()MA男人' – madalinivascu
是$ (“label [for = ReservationInformation]”)。text()在控制台中返回任何东西? –