Search in sources :

Example 1 with HtmlMessage

use of jakarta.faces.component.html.HtmlMessage in project myfaces by apache.

the class HtmlMessageRendererTest method setUp.

public void setUp() throws Exception {
    super.setUp();
    writer = new MockResponseWriter(new StringWriter(), null, null);
    message = new HtmlMessage();
    form = new HtmlForm();
    inputText = new HtmlInputText();
    facesContext.setResponseWriter(writer);
    facesContext.getViewRoot().setRenderKitId(MockRenderKitFactory.HTML_BASIC_RENDER_KIT);
    facesContext.getRenderKit().addRenderer(message.getFamily(), message.getRendererType(), new HtmlMessageRenderer());
    facesContext.getRenderKit().addRenderer(inputText.getFamily(), inputText.getRendererType(), new HtmlTextRenderer());
    facesContext.getRenderKit().addRenderer(form.getFamily(), form.getRendererType(), new HtmlFormRenderer());
    // inputText.setParent(form);
    inputText.setId("myInputId");
    // message.setParent(form);
    form.getChildren().add(inputText);
    form.getChildren().add(message);
    facesContext.getAttributes().put("org.apache.myfaces.RENDERED_FACES_JS", Boolean.TRUE);
}
Also used : HtmlMessage(jakarta.faces.component.html.HtmlMessage) StringWriter(java.io.StringWriter) HtmlForm(jakarta.faces.component.html.HtmlForm) HtmlInputText(jakarta.faces.component.html.HtmlInputText) MockResponseWriter(org.apache.myfaces.test.mock.MockResponseWriter)

Aggregations

HtmlForm (jakarta.faces.component.html.HtmlForm)1 HtmlInputText (jakarta.faces.component.html.HtmlInputText)1 HtmlMessage (jakarta.faces.component.html.HtmlMessage)1 StringWriter (java.io.StringWriter)1 MockResponseWriter (org.apache.myfaces.test.mock.MockResponseWriter)1