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

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

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