[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.3,1.4
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-08-05 15:21:25
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv29000/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: Correct ordering of links array, support read of link.href Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ScriptingTest.java 2 Aug 2002 16:26:15 -0000 1.3 +++ ScriptingTest.java 5 Aug 2002 15:21:19 -0000 1.4 @@ -164,4 +164,31 @@ } + public void testLinkIndexes() throws Exception { + defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + + "function alertLinks() { " + + " for (var i=0; i < document.links.length; i++) {" + + " alert( document.links[i].href );" + + " }" + + "}" + + "</script></head>" + + "<body onLoad='alertLinks()'>" + + "<a href='demo.html'>green</a>" + + "<map name='map1'>" + + " <area href='guide.html' alt='Guide' shape='rect' coords='0,0,118,28'>" + + " <area href='search.html' alt='Search' shape='circle' coords='184,200,60'>" + + "</map>" + + "<a href='sample.html'>green</a>" + + "</body></html>" ); + WebConversation wc = new WebConversation(); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + JavaScript.run( response ); + assertEquals( "Alert message", getHostPath() + "/demo.html", response.popNextAlert() ); + assertEquals( "Alert message", getHostPath() + "/guide.html", response.popNextAlert() ); + assertEquals( "Alert message", getHostPath() + "/search.html", response.popNextAlert() ); + assertEquals( "Alert message", getHostPath() + "/sample.html", response.popNextAlert() ); + assertNull( "Alert should have been removed", response.getNextAlert() ); + } + + } |