[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript FormScriptingTest.java,1.18,1
Brought to you by:
russgold
|
From: Russell G. <rus...@us...> - 2003-03-13 18:20:55
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript
In directory sc8-pr-cvs1:/tmp/cvs-serv16661/test/com/meterware/httpunit/javascript
Modified Files:
FormScriptingTest.java
Log Message:
Added support for select.value
Index: FormScriptingTest.java
===================================================================
RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/FormScriptingTest.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- FormScriptingTest.java 17 Feb 2003 23:54:42 -0000 1.18
+++ FormScriptingTest.java 13 Mar 2003 18:20:50 -0000 1.19
@@ -728,4 +728,31 @@
}
+ public void testSelectValueProperty() throws Exception {
+ defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" +
+ "function testProperty( form ) {\n" +
+ " elements = form.choices;\n" +
+ " alert( 'selected item is ' + elements.value );\n" +
+ "}" +
+ "</script></head>" +
+ "<body>" +
+ "<form name='the_form'>" +
+ " <select name='choices'>" +
+ " <option>red" +
+ " <option selected>blue" +
+ " </select>" +
+ "</form>" +
+ "<a href='#' onClick='testProperty( document.the_form )'>elements</a>" +
+ "</body></html>" );
+ WebConversation wc = new WebConversation();
+ WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" );
+ response.getLinks()[0].click();
+ assertEquals( "Message 1", "selected item is blue", wc.popNextAlert() );
+ response.getScriptableObject().doEvent( "document.the_form.choices.value='red'" );
+ response.getLinks()[0].click();
+ assertEquals( "Message 2", "selected item is red", wc.popNextAlert() );
+ }
+
+
+
}
|