高效的JavaScript代码单元测试方法(13)

发表于:2013-01-11来源:web开发社区作者:Hazem Saleh点击数: 标签:JavaScript
03 appnamespace.ApplicationUtil = function () {}; 04 05 appnamespace.ApplicationUtil.prototype.validateLoginForm = function (){ 06 var error = true ; 07 document.getElementById( usernameMessage ).inne
03 appnamespace.ApplicationUtil = function() {};
04  
05 appnamespace.ApplicationUtil.prototype.validateLoginForm = function(){
06     var error = true;
07     document.getElementById("usernameMessage").innerHTML = "";
08     document.getElementById("passwordMessage").innerHTML = "";    
09  
10     if (!document.getElementById("username").value) {
11         document.getElementById("usernameMessage").innerHTML = 
12         "This field is required";
13         error = false;
14     }
15  
16     if (!document.getElementById("password") .value) {

原文转自:http://www.ltesting.net