[Httpunit-commit] CVS: httpunit/test/com/meterware/httpunit/javascript ScriptingTest.java,1.29,1.30
Brought to you by:
russgold
From: Russell G. <rus...@us...> - 2002-10-08 14:36:04
|
Update of /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript In directory usw-pr-cvs1:/tmp/cvs-serv11174/test/com/meterware/httpunit/javascript Modified Files: ScriptingTest.java Log Message: from Richard Harris: added support for the JavaScript screen object Index: ScriptingTest.java =================================================================== RCS file: /cvsroot/httpunit/httpunit/test/com/meterware/httpunit/javascript/ScriptingTest.java,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- ScriptingTest.java 8 Oct 2002 14:01:11 -0000 1.29 +++ ScriptingTest.java 8 Oct 2002 14:36:00 -0000 1.30 @@ -499,4 +499,21 @@ } + public void testScreenObject() throws Exception { + defineResource( "OnCommand.html", "<html><head><script language='JavaScript'>" + + "function viewProperties() { \n" + + " alert( 'dimensions=' + screen.availWidth + 'x' + screen.availHeight );\n" + + "}" + + "</script></head>\n" + + "<body onLoad='viewProperties()'>\n" + + "</body></html>" ); + HttpUnitOptions.setExceptionsThrownOnScriptError( true ); + WebConversation wc = new WebConversation(); + wc.getClientProperties().setAvailableScreenSize( 1024, 752 ); + WebResponse response = wc.getResponse( getHostPath() + "/OnCommand.html" ); + assertEquals( "Alert message 1", "dimensions=1024x752", wc.popNextAlert() ); + assertNull( "Alert should have been removed", wc.getNextAlert() ); + } + + } |