New JS implementation
Mark Childerson <[email protected]>
| Newsgroups | gmane.comp.web.httpunit.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Russell,
I started with the new JS implementation by looking at
FormScriptingTest.testElementsProperty, which failed because it could
not find listElements when the link was clicked.
The reason it failed was that the interpreter in rhino was looking
for listElements in the scope of the HTMLAnchorElementImpl, not that
of the document. This was because the HTMLAnchorElementImpl had no
parent scope.
I fixed this by modifying NamespaceAwareNodeImpl.initialize(), as follows:
protected void initialize( DocumentImpl owner, String
namespaceURI, String qualifiedName ) {
initialize( owner );
_tagName = qualifiedName;
_namespaceUri = namespaceURI;
if (qualifiedName.indexOf(':') < 0) {
_localName = qualifiedName;
} else {
_localName = qualifiedName.substring(
qualifiedName.indexOf(':') + 1 );
}
setParentScope(owner); //added
}
The test still didn't run, because the control was not being updated.
I fixed that by changing ScriptingSupport.isConvertableTo(), as follows:
public static boolean isConvertableTo( Class valueType, Class
parameterType ) {
if (valueType.equals( parameterType )) return true;
if (parameterType.equals( String.class )) return true;
if (valueType.equals( String.class ) && isNumericParameter(
parameterType )) return true;
if (Number.class.isAssignableFrom( valueType ) &&
isNumericParameter( parameterType )) return true;
if(valueType.equals(Boolean.class)&¶meterType.equals(boolean.class))
return true; //added
return valueType.equals( String.class ) &&
parameterType.equals( Boolean.class );
}
Now the test runs. FormScriptingTest as a whole gets 13 errors and
8 failures, instead of 27 errors and 6 failures.
Thanks,
Mark
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Httpunit-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/httpunit-develop