-Initial AJAX support
-Upgrading Dojo to version 1.0
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user