-Initial AJAX support

-Upgrading Dojo to version 1.0
This commit is contained in:
Jeremy Grelle
2007-12-03 21:35:18 +00:00
parent fa7364fe84
commit 433e003356
386 changed files with 26226 additions and 10192 deletions

View File

@@ -0,0 +1,53 @@
package org.springframework.faces.ui;
import javax.faces.component.UICommand;
import javax.faces.component.UIForm;
import javax.faces.component.UIPanel;
import javax.faces.component.UIViewRoot;
import javax.faces.render.RenderKitFactory;
import org.springframework.faces.webflow.JSFMockHelper;
import junit.framework.TestCase;
public class AjaxViewRootTests extends TestCase {
JSFMockHelper jsf = new JSFMockHelper();
UIViewRoot testTree = new UIViewRoot();
protected void setUp() throws Exception {
jsf.setUp();
UIForm form = new UIForm();
form.setId("foo");
testTree.getChildren().add(form);
UIPanel panel = new UIPanel();
panel.setId("bar");
form.getChildren().add(panel);
UICommand command = new UICommand();
command.setId("baz");
panel.getChildren().add(command);
testTree.setRenderKitId(RenderKitFactory.HTML_BASIC_RENDER_KIT);
jsf.facesContext().setViewRoot(testTree);
}
protected void tearDown() throws Exception {
jsf.tearDown();
}
public void testProcessDecodes() {
jsf.externalContext().getRequestParameterMap().put("processIds", "foo:bar, foo:baz");
jsf.externalContext().getRequestParameterMap().put("renderIds", "foo:bar, foo:baz");
AjaxViewRoot ajaxRoot = new AjaxViewRoot(testTree);
ajaxRoot.processDecodes(jsf.facesContext());
assertEquals(1, ajaxRoot.getProcessIds().length);
assertEquals(1, ajaxRoot.getRenderIds().length);
}
}

View File

@@ -0,0 +1,16 @@
package org.springframework.faces.ui;
import junit.framework.TestCase;
public class EscapeQuotesTests extends TestCase {
public final void testEscapeQuotesInLink() {
String linkText = "<a id=\"mainForm:findHotels\" class=\"progressiveLink\" href=\"#\" name=\"mainForm:findHotels\"\\>";
String expectedText = "<a id=\\\"mainForm:findHotels\\\" class=\\\"progressiveLink\\\" href=\\\"#\\\" name=\\\"mainForm:findHotels\\\"\\>";
String result = linkText.replaceAll("\"", "\\\\\"");
System.out.println(linkText);
System.out.println(result);
assertEquals(expectedText, result);
}
}