engine.getClassResolver();
enginec.setReturnValue(getClassResolver());
MockControl supportc = newControl(PageRenderSupport.class);
PageRenderSupport support = (PageRenderSupport) supportc.getMock();
trainGetPageRenderSupport(cyclec, cycle, support);
replayControls();
final FormSupport fs = new FormSupportImpl(writer, cycle, form);
verifyControls();
final IFormComponent barney1 = newFormComponent("barney", "barney");
final IFormComponent wilma = newFormComponent("wilma", "wilma");
final IFormComponent barney2 = newFormComponent("barney", "barney$0");
IRender body = newComponentsRenderBody(fs, new IFormComponent[]
{ barney1, wilma, barney2 }, nested);
form.setBody(body);
MockControl linkc = newControl(ILink.class);
ILink link = (ILink) linkc.getMock();
IRender render = (IRender) newMock(IRender.class);
support.addExternalScript(new ClasspathResource(getClassResolver(),
"/org/apache/tapestry/form/Form.js"));
support
.addInitializationScript("var myform_events = new FormEventManager(document.myform);");
link.getParameterNames();
linkc.setReturnValue(new String[]
{ "service" });
link.getParameterValues("service");
linkc.setReturnValue(new String[]
{ "fred" });
writer.getNestedWriter();
writerc.setReturnValue(nested);
link.getURL(null, false);
linkc.setReturnValue("/app");
writer.begin("form");
writer.attribute("method", "post");
writer.attribute("action", "/app");
writer.attribute("name", "myform");
render.render(writer, cycle);
writer.println();
trainHidden(writer, "formids", "barney,wilma,barney$0");
trainHidden(writer, "service", "fred");
trainHidden(writer, "submitmode", "");
nested.close();
writer.end();
trainGetFocusField(delegatec, delegate, "wilma");
trainGetFieldFocus(cyclec, cycle, null);
support.addInitializationScript("focus(document.myform.wilma);");
trainSetFieldFocus(cycle);
replayControls();