[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript FormScriptingTest.java,1.8,1.
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-09-05 19:10:47
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv401/test/com/meterware/httpunit/javascript Modified Files: FormScriptingTest.java ScriptingTest.java Log Message: Add support for Javascript arrays with named indices Index: FormScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -r1.8 -r1.9 --- FormScriptingTest.java 5 Sep 2002 14:46:56 -0000 1.8 +++ FormScriptingTest.java 5 Sep 2002 19:10:44 -0000 1.9 @@ -58,7 +58,7 @@ "function listElements( form ) {\n" + " elements = form.elements;\n" + " alert( 'form has ' + elements.length + ' elements' );\n" + - " alert( 'value is ' + elements[0].value );\n" + + " alert( 'value is ' + elements['first'].value );\n" + " alert( 'index is ' + elements[1].selectedIndex );\n" + " elements[2].checked=true;\n" + "}" + @@ -140,6 +140,7 @@ "<form name=spectrum action='DoIt'>" + " <input type=text name=color value=green>" + " <input type=submit name=change value=color>" + + " <input type=submit name=keep value=nothing>" + "</form>" + "<a href='#' onClick='document.spectrum.submit(); return false;'>" + "</body></html>" ); Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.20 retrieving revision 1.21 diff -u -r1.20 -r1.21 --- ScriptingTest.java 5 Sep 2002 14:46:56 -0000 1.20 +++ ScriptingTest.java 5 Sep 2002 19:10:44 -0000 1.21 @@ -210,6 +210,7 @@ "function viewForms() { " + " alert( \"found \" + document.forms.length + \" form(s)\" );" + " alert( getFound( document.realform ) + \"form 'realform'\" );" + + " alert( getFound( document.forms[\"realform\"] ) + \"form 'forms[\'realform\']'\" );" + " alert( getFound( document.noform ) + \"form 'noform'\" ); }" + "</script></head>" + "<body onLoad='viewForms()'>" + @@ -219,6 +220,7 @@ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); assertEquals( "Alert message", "found 1 form(s)", wc.popNextAlert() ); assertEquals( "Alert message", "found form 'realform'", wc.popNextAlert() ); + assertEquals( "Alert message", "found form 'forms[\'realform\']'", wc.popNextAlert() ); assertEquals( "Alert message", "did not find form 'noform'", wc.popNextAlert() ); assertNull( "Alert should have been removed", wc.getNextAlert() ); } @@ -232,6 +234,7 @@ "function viewLinks() { " + " alert( \"found \" + document.links.length + \" link(s)\" );" + " alert( getFound( document.reallink ) + \"link 'reallink'\" );" + + " alert( getFound( document.links[\"reallink\"] ) + \"link 'links[reallink]'\" );" + " alert( getFound( document.nolink ) + \"link 'nolink'\" );" + "}" + "</script></head>" + @@ -243,6 +246,7 @@ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); assertEquals( "Alert message", "found 2 link(s)", wc.popNextAlert() ); assertEquals( "Alert message", "found link 'reallink'", wc.popNextAlert() ); + assertEquals( "Alert message", "found link 'links[reallink]'", wc.popNextAlert() ); assertEquals( "Alert message", "did not find link 'nolink'", wc.popNextAlert() ); assertNull( "Alert should have been removed", wc.getNextAlert() ); } @@ -349,6 +353,7 @@ "function viewImages() { \n" + " alert( \"found \" + document.images.length + \" images(s)\" );\n" + " alert( getFound( document.realimage ) + \"image 'realimage'\" )\n;" + + " alert( getFound( document.images['realimage'] ) + \"image 'images[realimage]'\" )\n;" + " alert( getFound( document.noimage ) + \"image 'noimage'\" );\n" + " alert( '2nd image is ' + document.images[1].src ); }\n" + "</script></head>\n" + @@ -360,6 +365,7 @@ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); assertEquals( "Alert message", "found 2 images(s)", wc.popNextAlert() ); assertEquals( "Alert message", "found image 'realimage'", wc.popNextAlert() ); + assertEquals( "Alert message", "found image 'images[realimage]'", wc.popNextAlert() ); assertEquals( "Alert message", "did not find image 'noimage'", wc.popNextAlert() ); assertEquals( "Alert message", "2nd image is pict2.gif", wc.popNextAlert() ); assertNull( "Alert should have been removed", wc.getNextAlert() ); |