use of org.apache.myfaces.view.facelets.bean.HelloWorld in project myfaces by apache.
the class CompositeComponentClientBehaviorTestCase method testSimpleClientBehaviorDefaultAjaxWrap.
@Test
public void testSimpleClientBehaviorDefaultAjaxWrap() throws Exception {
HelloWorld helloWorld = new HelloWorld();
facesContext.getExternalContext().getRequestMap().put("helloWorldBean", helloWorld);
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleClientBehaviorDefaultAjaxWrap.xhtml");
UIComponent form = root.findComponent("testForm1");
Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
Assert.assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
Assert.assertNotNull(button);
Assert.assertNotNull(button.getClientBehaviors().get("dblclick"));
Assert.assertEquals(1, button.getClientBehaviors().get("dblclick").size());
// StringWriter sw = new StringWriter();
// MockResponseWriter mrw = new MockResponseWriter(sw);
// facesContext.setResponseWriter(mrw);
// root.encodeAll(facesContext);
// sw.flush();
// System.out.print(sw.toString());
}
use of org.apache.myfaces.view.facelets.bean.HelloWorld in project myfaces by apache.
the class CompositeComponentClientBehaviorTestCase method testCompositeClientBehavior.
@Test
public void testCompositeClientBehavior() throws Exception {
HelloWorld helloWorld = new HelloWorld();
facesContext.getExternalContext().getRequestMap().put("helloWorldBean", helloWorld);
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeClientBehavior.xhtml");
UIComponent form = root.findComponent("testForm1");
Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
Assert.assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("button3");
Assert.assertNotNull(compositeComponent2);
UICommand button = (UICommand) compositeComponent2.findComponent("button");
Assert.assertNotNull(button);
// One added in testCompositeActionSource, the other one
// inside compositeActionSource.xhtml
Assert.assertNotNull(button.getClientBehaviors().get("action"));
Assert.assertEquals(1, button.getClientBehaviors().get("action").size());
// StringWriter sw = new StringWriter();
// MockResponseWriter mrw = new MockResponseWriter(sw);
// facesContext.setResponseWriter(mrw);
// root.encodeAll(facesContext);
// sw.flush();
// System.out.print(sw.toString());
}
use of org.apache.myfaces.view.facelets.bean.HelloWorld in project myfaces by apache.
the class CompositeComponentClientBehaviorTestCase method testSimpleClientBehaviorDefaultNoEventAjaxWrap.
@Test
public void testSimpleClientBehaviorDefaultNoEventAjaxWrap() throws Exception {
HelloWorld helloWorld = new HelloWorld();
facesContext.getExternalContext().getRequestMap().put("helloWorldBean", helloWorld);
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleClientBehaviorDefaultNoEventAjaxWrap.xhtml");
UIComponent form = root.findComponent("testForm1");
Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
Assert.assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
Assert.assertNotNull(button);
Assert.assertNotNull(button.getClientBehaviors().get("action"));
Assert.assertEquals(1, button.getClientBehaviors().get("action").size());
// StringWriter sw = new StringWriter();
// MockResponseWriter mrw = new MockResponseWriter(sw);
// facesContext.setResponseWriter(mrw);
// root.encodeAll(facesContext);
// sw.flush();
// System.out.print(sw.toString());
}
use of org.apache.myfaces.view.facelets.bean.HelloWorld in project myfaces by apache.
the class CompositeComponentClientBehaviorTestCase method testSimpleClientBehaviorAjaxWrap.
@Test
public void testSimpleClientBehaviorAjaxWrap() throws Exception {
HelloWorld helloWorld = new HelloWorld();
facesContext.getExternalContext().getRequestMap().put("helloWorldBean", helloWorld);
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testSimpleClientBehaviorAjaxWrap.xhtml");
UIComponent form = root.findComponent("testForm1");
Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
Assert.assertNotNull(compositeComponent);
UICommand button = (UICommand) compositeComponent.findComponent("button");
Assert.assertNotNull(button);
Assert.assertNotNull(button.getClientBehaviors().get("action"));
Assert.assertEquals(1, button.getClientBehaviors().get("action").size());
// StringWriter sw = new StringWriter();
// MockResponseWriter mrw = new MockResponseWriter(sw);
// facesContext.setResponseWriter(mrw);
// root.encodeAll(facesContext);
// sw.flush();
// System.out.print(sw.toString());
}
use of org.apache.myfaces.view.facelets.bean.HelloWorld in project myfaces by apache.
the class CompositeComponentClientBehaviorTestCase method testCompositeDoubleClientBehavior.
@Test
public void testCompositeDoubleClientBehavior() throws Exception {
HelloWorld helloWorld = new HelloWorld();
facesContext.getExternalContext().getRequestMap().put("helloWorldBean", helloWorld);
UIViewRoot root = facesContext.getViewRoot();
vdl.buildView(facesContext, root, "testCompositeDoubleClientBehavior.xhtml");
UIComponent form = root.findComponent("testForm1");
Assert.assertNotNull(form);
UINamingContainer compositeComponent = (UINamingContainer) form.getChildren().get(0);
Assert.assertNotNull(compositeComponent);
UINamingContainer compositeComponent2 = (UINamingContainer) compositeComponent.findComponent("compositeClientBehavior");
Assert.assertNotNull(compositeComponent2);
UINamingContainer compositeComponent3 = (UINamingContainer) compositeComponent2.findComponent("button3");
Assert.assertNotNull(compositeComponent3);
UICommand button = (UICommand) compositeComponent3.findComponent("button");
Assert.assertNotNull(button);
// One added in testCompositeActionSource, the other one
// inside compositeActionSource.xhtml
Assert.assertNotNull(button.getClientBehaviors().get("action"));
Assert.assertEquals(1, button.getClientBehaviors().get("action").size());
// StringWriter sw = new StringWriter();
// MockResponseWriter mrw = new MockResponseWriter(sw);
// facesContext.setResponseWriter(mrw);
// root.encodeAll(facesContext);
// sw.flush();
// System.out.print(sw.toString());
}
Aggregations