Search in sources :

Example 6 with WFigure

use of com.github.bordertech.wcomponents.WFigure in project wcomponents by BorderTech.

the class WFigureRenderer_Test method testRenderedLazyMode.

@Test
public void testRenderedLazyMode() throws IOException, SAXException, XpathException {
    WFigure figure = new WFigure(new WText(FIGURE_CONTENT), FIGURE_HEADING);
    figure.setMode(FigureMode.LAZY);
    // Content NOT Hidden
    assertSchemaMatch(figure);
    // If not hidden, then the figure's content should be rendered
    assertXpathEvaluatesTo("", "//ui:figure/@type", figure);
    assertXpathEvaluatesTo("", "//ui:figure/@hidden", figure);
    assertXpathEvaluatesTo("lazy", "//ui:figure/@mode", figure);
    assertXpathEvaluatesTo(FIGURE_CONTENT, "//ui:figure/ui:content", figure);
    // Content Hidden
    // Create User Context with UI component
    UIContext uic = createUIContext();
    uic.setUI(new DefaultWComponent());
    setActiveContext(uic);
    setFlag(figure, ComponentModel.HIDE_FLAG, true);
    assertSchemaMatch(figure);
    // If hidden, then the figure's content should NOT be rendered
    assertXpathEvaluatesTo("", "//ui:figure/@type", figure);
    assertXpathEvaluatesTo("true", "//ui:figure/@hidden", figure);
    assertXpathEvaluatesTo("lazy", "//ui:figure/@mode", figure);
    assertXpathEvaluatesTo("", "//ui:figure/ui:content", figure);
}
Also used : WFigure(com.github.bordertech.wcomponents.WFigure) WText(com.github.bordertech.wcomponents.WText) UIContext(com.github.bordertech.wcomponents.UIContext) DefaultWComponent(com.github.bordertech.wcomponents.DefaultWComponent) Test(org.junit.Test)

Aggregations

WFigure (com.github.bordertech.wcomponents.WFigure)6 WText (com.github.bordertech.wcomponents.WText)5 Test (org.junit.Test)5 DefaultWComponent (com.github.bordertech.wcomponents.DefaultWComponent)2 UIContext (com.github.bordertech.wcomponents.UIContext)2 AjaxOperation (com.github.bordertech.wcomponents.AjaxOperation)1 Margin (com.github.bordertech.wcomponents.Margin)1 FigureMode (com.github.bordertech.wcomponents.WFigure.FigureMode)1 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)1 SystemException (com.github.bordertech.wcomponents.util.SystemException)1