use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_Absolute.
@Test
public void resolveComponent_Absolute() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UIForm form = new UIForm();
form.setId("form");
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("outerContainer");
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
innerContainer.setId("innerContainer");
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
source.setId("source");
innerContainer.getChildren().add(source);
assertSame(source, resolveComponent(source, " :form:outerContainer:innerContainer:source "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_AbsoluteWithFormPrependIdFalse_InvokeOnComponent.
@Test
public void resolveClientId_AbsoluteWithFormPrependIdFalse_InvokeOnComponent() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UIForm form = new UIForm();
form.setId("form");
form.setPrependId(false);
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("outerContainer");
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
innerContainer.setId("innerContainer");
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
source.setId("source");
innerContainer.getChildren().add(source);
assertEquals("outerContainer:innerContainer:source", resolveClientId(source, " outerContainer:innerContainer:source "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_AbsoluteNamingcontainerParent.
@Test
public void resolveClientId_AbsoluteNamingcontainerParent() {
UIComponent root = new UIPanel();
root.setId("root");
UIForm form = new UIForm();
form.setId("form");
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("outerContainer");
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
innerContainer.setId("innerContainer");
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
component.setId("other");
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
source.setId("source");
innerContainer.getChildren().add(source);
assertEquals("root", resolveClientId(source, " :form:outerContainer:@namingcontainer:@parent "));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveClientId_WidgetVarNext.
@Test
public void resolveClientId_WidgetVarNext() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UIForm form = new UIForm();
root.getChildren().add(form);
UINamingContainer outerContainer = new UINamingContainer();
form.getChildren().add(outerContainer);
UINamingContainer innerContainer = new UINamingContainer();
outerContainer.getChildren().add(innerContainer);
UIComponent component = new UIOutput();
innerContainer.getChildren().add(component);
UIComponent source = new UICommand();
innerContainer.getChildren().add(source);
InputText input = new InputText();
input.setWidgetVar("myInput_Widget");
outerContainer.getChildren().add(input);
InputText input2 = new InputText();
input2.setId("input2");
input2.setWidgetVar("myInput_Widget2");
outerContainer.getChildren().add(input2);
assertEquals(input2.getClientId(), resolveClientId(source, " @widgetVar(myInput_Widget):@next"));
}
use of javax.faces.component.UINamingContainer in project primefaces by primefaces.
the class SearchExpressionFacadeTest method resolveComponent_Root.
@Test
public void resolveComponent_Root() {
UIComponent root = new UIPanel();
FacesContext.getCurrentInstance().getViewRoot().getChildren().add(root);
UINamingContainer outerContainer = new UINamingContainer();
outerContainer.setId("myContainer");
root.getChildren().add(outerContainer);
UIForm form = new UIForm();
form.setId("form");
root.getChildren().add(form);
Assertions.assertEquals(FacesContext.getCurrentInstance().getViewRoot(), resolveComponent(form, " @root "));
}
Aggregations