验证来自HTMl表单的输入字段。想要编写单元测试用例。需要帮助在Jasmine中实现jasmine单元测试用例
var object = {};
var myclass=function requiredFieldValidator(jQuery) {
object.utility = {
requiredFieldValidation : function validation() {
jQuery("#InsertQuestionAndAnswer").validate({
rules : {
Question : "required",
Answer : "required",
},
messages : {
Question : "Question Cannot be Blank",
Answer : "Answer Cannot be Blank",
},
submitHandler : function(form) {
form.submit();
}
});
}
}
jQuery(document).ready(function() {
object.utility.requiredFieldValidation();
});
}(jQuery);