Search in sources :

Example 6 with UISelectItem

use of jakarta.faces.component.UISelectItem in project myfaces by apache.

the class HtmlCheckboxRendererTest method testSelectManyHtmlPropertyPassTru.

public void testSelectManyHtmlPropertyPassTru() throws Exception {
    HtmlRenderedAttr[] attrs = { // _AccesskeyProperty
    new HtmlRenderedAttr("accesskey"), // _UniversalProperties
    new HtmlRenderedAttr("dir"), new HtmlRenderedAttr("lang"), new HtmlRenderedAttr("title"), new HtmlRenderedAttr("role"), // _FocusBlurProperties
    new HtmlRenderedAttr("onfocus"), new HtmlRenderedAttr("onblur"), // _ChangeSelectProperties
    new HtmlRenderedAttr("onchange"), new HtmlRenderedAttr("onselect"), // _EventProperties
    new HtmlRenderedAttr("onclick"), new HtmlRenderedAttr("ondblclick"), new HtmlRenderedAttr("onkeydown"), new HtmlRenderedAttr("onkeypress"), new HtmlRenderedAttr("onkeyup"), new HtmlRenderedAttr("onmousedown"), new HtmlRenderedAttr("onmousemove"), new HtmlRenderedAttr("onmouseout"), new HtmlRenderedAttr("onmouseover"), new HtmlRenderedAttr("onmouseup"), // _StyleProperties
    new HtmlRenderedAttr("style", 1), new HtmlRenderedAttr("styleClass", "styleClass", "class=\"styleClass\"", 1), // _TabindexProperty
    new HtmlRenderedAttr("tabindex") };
    UISelectItem item = new UISelectItem();
    item.setItemLabel("mars");
    item.setItemValue("mars");
    selectManyCheckbox.getChildren().add(item);
    HtmlCheckAttributesUtil.checkRenderedAttributes(selectManyCheckbox, facesContext, writer, attrs);
    if (HtmlCheckAttributesUtil.hasFailedAttrRender(attrs)) {
        Assert.fail(HtmlCheckAttributesUtil.constructErrorMessage(attrs, writer.getWriter().toString()));
    }
}
Also used : HtmlRenderedAttr(org.apache.myfaces.test.utils.HtmlRenderedAttr) UISelectItem(jakarta.faces.component.UISelectItem)

Example 7 with UISelectItem

use of jakarta.faces.component.UISelectItem in project myfaces by apache.

the class HtmlEscapeRendererTest method tryUISelectEscapeValue.

public void tryUISelectEscapeValue(UIComponent component, String contentType, String encoding) throws Exception {
    StringWriter swriter = new StringWriter();
    HtmlResponseWriterImpl writer = new HtmlResponseWriterImpl(swriter, contentType, encoding);
    facesContext.setResponseWriter(writer);
    UISelectItem uiSelectItem = new UISelectItem();
    SelectItem item = new SelectItem("Output", TEST_STRING, "", false, true);
    uiSelectItem.setValue(item);
    component.getChildren().add(uiSelectItem);
    component.encodeAll(facesContext);
    facesContext.renderResponse();
    String output = swriter.toString();
    Assert.assertTrue(output.contains(TEST_STRING_ESCAPED));
}
Also used : StringWriter(java.io.StringWriter) UISelectItem(jakarta.faces.component.UISelectItem) SelectItem(jakarta.faces.model.SelectItem) UISelectItem(jakarta.faces.component.UISelectItem)

Example 8 with UISelectItem

use of jakarta.faces.component.UISelectItem in project myfaces by apache.

the class HtmlSelectManyListboxClientBehaviorRendererTest method createComponentToTest.

@Override
protected UIComponent createComponentToTest() {
    UIComponent component = new HtmlSelectManyListbox();
    UISelectItem item = new UISelectItem();
    item.setItemValue("value1");
    component.getChildren().add(item);
    return component;
}
Also used : HtmlSelectManyListbox(jakarta.faces.component.html.HtmlSelectManyListbox) UIComponent(jakarta.faces.component.UIComponent) UISelectItem(jakarta.faces.component.UISelectItem)

Example 9 with UISelectItem

use of jakarta.faces.component.UISelectItem in project myfaces by apache.

the class HtmlSelectOneListboxClientBehaviorRendererTest method createComponentToTest.

@Override
protected UIComponent createComponentToTest() {
    UIComponent component = new HtmlSelectOneListbox();
    UISelectItem item = new UISelectItem();
    item.setItemValue("value1");
    component.getChildren().add(item);
    return component;
}
Also used : HtmlSelectOneListbox(jakarta.faces.component.html.HtmlSelectOneListbox) UIComponent(jakarta.faces.component.UIComponent) UISelectItem(jakarta.faces.component.UISelectItem)

Example 10 with UISelectItem

use of jakarta.faces.component.UISelectItem in project faces by jakartaee.

the class TestServlet method uiSelectItemIsSetItemEscapedTest.

// uiSelectItemIsSetItemDisabledTest
public void uiSelectItemIsSetItemEscapedTest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    PrintWriter out = response.getWriter();
    UISelectItem command = (UISelectItem) createComponent();
    boolean value = true;
    command.setItemEscaped(value);
    boolean result = command.isItemEscaped();
    if (!result) {
        out.println(JSFTestUtil.FAIL + " UISelectItem.isItemEscaped() didn't return" + " the value as set by UISelectItem.setItemEscaped().");
        out.println("Expected: " + value);
        out.println("Received: " + result);
        return;
    }
    out.println(JSFTestUtil.PASS);
}
Also used : PrintWriter(java.io.PrintWriter) UISelectItem(jakarta.faces.component.UISelectItem)

Aggregations

UISelectItem (jakarta.faces.component.UISelectItem)37 PrintWriter (java.io.PrintWriter)17 UIInput (jakarta.faces.component.UIInput)10 UIViewRoot (jakarta.faces.component.UIViewRoot)10 FacesContext (jakarta.faces.context.FacesContext)10 UIComponent (jakarta.faces.component.UIComponent)8 TCKValidator (com.sun.ts.tests.jsf.api.jakarta_faces.component.common.TCKValidator)6 TCKValueChangeListener (com.sun.ts.tests.jsf.api.jakarta_faces.component.common.TCKValueChangeListener)6 MethodExpression (jakarta.el.MethodExpression)6 AjaxBehavior (jakarta.faces.component.behavior.AjaxBehavior)6 MethodExpressionValidator (jakarta.faces.validator.MethodExpressionValidator)6 SelectItem (jakarta.faces.model.SelectItem)5 ELContext (jakarta.el.ELContext)4 ValueExpression (jakarta.el.ValueExpression)3 UISelectItems (jakarta.faces.component.UISelectItems)3 Application (jakarta.faces.application.Application)2 StringWriter (java.io.StringWriter)2 ArrayList (java.util.ArrayList)2 Map (java.util.Map)2 TCKConverter (com.sun.ts.tests.jsf.api.jakarta_faces.component.common.TCKConverter)1