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

发表于:2013-01-11来源:web开发社区作者:Hazem Saleh点击数: 标签:JavaScript
04 /*:DOC += FORM action=tabletrtdUsername/tdtd 05 input type=text id=username//tdtdspan id=usernameMessage 06 /span/td/trtrtdPassword/tdtd 07 input type=password id=password//tdtdspan id=passwordMess
04 /*:DOC += <FORM action=""><table><tr><td>Username</td><td>
05 <input type="text" id="username"/></td><td><span id="usernameMessage">
06 </span></td></tr><tr><td>Password</td><td>
07 <input type="password" id="password"/></td><td><span id="passwordMessage"
08 ></span></td></tr></table></FORM>*/
09 };
10  
11 ApplicationUtilTest.prototype.testValidateLoginFormBothEmpty = function () {
12     var applicationUtil = new appnamespace.ApplicationUtil();
13  
14     /* Simulate empty user name and password */
15     document.getElementById("username").value = "";
16     document.getElementById("password").value = "";    
17     applicationUtil.validateLoginForm ();
18     assertEquals ("Username is not validated correctly!", "This field is required"

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