Search in sources :

Example 81 with WText

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

the class WCollapsibleRenderer_Test method testDoRenderEagerCollapse.

@Test
public void testDoRenderEagerCollapse() throws IOException, SAXException, XpathException {
    WCollapsible collapsible = new WCollapsible(new WText(COLLAPSIBLE_CONTENT), COLLAPSIBLE_HEADING, WCollapsible.CollapsibleMode.EAGER);
    assertSchemaMatch(collapsible);
    assertXpathEvaluatesTo("eager", "//ui:collapsible/@mode", collapsible);
    assertRenderContentCorrectly(collapsible, false, false);
}
Also used : WCollapsible(com.github.bordertech.wcomponents.WCollapsible) WText(com.github.bordertech.wcomponents.WText) Test(org.junit.Test)

Example 82 with WText

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

the class WCollapsibleRenderer_Test method testRenderedWithMargins.

@Test
public void testRenderedWithMargins() throws IOException, SAXException, XpathException {
    WCollapsible collapsible = new WCollapsible(new WText(COLLAPSIBLE_CONTENT), COLLAPSIBLE_HEADING, WCollapsible.CollapsibleMode.EAGER);
    assertXpathNotExists("//ui:collapsible/ui:margin", collapsible);
    Margin margin = new Margin(0);
    collapsible.setMargin(margin);
    assertXpathNotExists("//ui:collapsible/ui:margin", collapsible);
    margin = new Margin(Size.SMALL);
    collapsible.setMargin(margin);
    assertSchemaMatch(collapsible);
    assertXpathEvaluatesTo("sm", "//ui:collapsible/ui:margin/@all", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@north", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@east", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@south", collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@west", collapsible);
    margin = new Margin(Size.SMALL, Size.MEDIUM, Size.LARGE, Size.XL);
    collapsible.setMargin(margin);
    assertSchemaMatch(collapsible);
    assertXpathEvaluatesTo("", "//ui:collapsible/ui:margin/@all", collapsible);
    assertXpathEvaluatesTo("sm", "//ui:collapsible/ui:margin/@north", collapsible);
    assertXpathEvaluatesTo("med", "//ui:collapsible/ui:margin/@east", collapsible);
    assertXpathEvaluatesTo("lg", "//ui:collapsible/ui:margin/@south", collapsible);
    assertXpathEvaluatesTo("xl", "//ui:collapsible/ui:margin/@west", collapsible);
}
Also used : WCollapsible(com.github.bordertech.wcomponents.WCollapsible) WText(com.github.bordertech.wcomponents.WText) Margin(com.github.bordertech.wcomponents.Margin) Test(org.junit.Test)

Example 83 with WText

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

the class WCollapsibleRenderer_Test method testDoRenderClientSideCollapse.

@Test
public void testDoRenderClientSideCollapse() throws IOException, SAXException, XpathException {
    WCollapsible collapsible = new WCollapsible(new WText(COLLAPSIBLE_CONTENT), COLLAPSIBLE_HEADING, WCollapsible.CollapsibleMode.CLIENT);
    assertSchemaMatch(collapsible);
    assertXpathEvaluatesTo("client", "//ui:collapsible/@mode", collapsible);
    assertRenderContentCorrectly(collapsible, true, true);
}
Also used : WCollapsible(com.github.bordertech.wcomponents.WCollapsible) WText(com.github.bordertech.wcomponents.WText) Test(org.junit.Test)

Example 84 with WText

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

the class WCollapsibleRenderer_Test method testDoRenderServerSideCollapse.

@Test
public void testDoRenderServerSideCollapse() throws IOException, SAXException, XpathException {
    WCollapsible collapsible = new WCollapsible(new WText(COLLAPSIBLE_CONTENT), COLLAPSIBLE_HEADING, WCollapsible.CollapsibleMode.SERVER);
    assertSchemaMatch(collapsible);
    // see https://github.com/BorderTech/wcomponents/issues/694
    assertXpathEvaluatesTo("dynamic", "//ui:collapsible/@mode", collapsible);
    assertRenderContentCorrectly(collapsible, false, true);
}
Also used : WCollapsible(com.github.bordertech.wcomponents.WCollapsible) WText(com.github.bordertech.wcomponents.WText) Test(org.junit.Test)

Example 85 with WText

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

the class WDecoratedLabelRenderer_Test method testDoPaint.

@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
    final String bodyText = "WDecoratedLabelRenderer_Test.testDoPaint.bodyText";
    final String headText = "WDecoratedLabelRenderer_Test.testDoPaint.headText";
    final String tailText = "WDecoratedLabelRenderer_Test.testDoPaint.tailText";
    // Test minimal text content
    WDecoratedLabel decoratedLabel = new WDecoratedLabel(bodyText);
    assertSchemaMatch(decoratedLabel);
    assertXpathEvaluatesTo(bodyText, "normalize-space(//ui:decoratedlabel/ui:labelbody)", decoratedLabel);
    assertXpathNotExists("//ui:decoratedlabel/@labelFocus", decoratedLabel);
    decoratedLabel.setHead(new WText(headText));
    decoratedLabel.setTail(new WText(tailText));
    // Test all text content
    assertSchemaMatch(decoratedLabel);
    assertXpathEvaluatesTo(headText, "normalize-space(//ui:decoratedlabel/ui:labelhead)", decoratedLabel);
    assertXpathEvaluatesTo(bodyText, "normalize-space(//ui:decoratedlabel/ui:labelbody)", decoratedLabel);
    assertXpathEvaluatesTo(tailText, "normalize-space(//ui:decoratedlabel/ui:labeltail)", decoratedLabel);
    assertXpathNotExists("//ui:decoratedlabel/@labelFocus", decoratedLabel);
    // Test complex content
    WContainer complexContent = new WContainer();
    complexContent.add(new WLabel("Select"));
    complexContent.add(new WCheckBox());
    decoratedLabel.setBody(complexContent);
    assertXpathExists("//ui:decoratedlabel/ui:labelbody/ui:label/following-sibling::ui:checkbox", decoratedLabel);
}
Also used : WContainer(com.github.bordertech.wcomponents.WContainer) WText(com.github.bordertech.wcomponents.WText) WCheckBox(com.github.bordertech.wcomponents.WCheckBox) WDecoratedLabel(com.github.bordertech.wcomponents.WDecoratedLabel) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Aggregations

WText (com.github.bordertech.wcomponents.WText)97 Test (org.junit.Test)63 WPanel (com.github.bordertech.wcomponents.WPanel)17 WCollapsible (com.github.bordertech.wcomponents.WCollapsible)10 WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)10 UIContext (com.github.bordertech.wcomponents.UIContext)9 WHeading (com.github.bordertech.wcomponents.WHeading)9 WTabSet (com.github.bordertech.wcomponents.WTabSet)7 DefaultWComponent (com.github.bordertech.wcomponents.DefaultWComponent)6 WList (com.github.bordertech.wcomponents.WList)6 WebXmlRenderContext (com.github.bordertech.wcomponents.servlet.WebXmlRenderContext)6 MockResponse (com.github.bordertech.wcomponents.util.mock.MockResponse)6 MockServletConfig (com.github.bordertech.wcomponents.util.mock.servlet.MockServletConfig)6 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)5 WComponent (com.github.bordertech.wcomponents.WComponent)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)5 WImage (com.github.bordertech.wcomponents.WImage)5 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)5 MockHttpServletRequest (com.github.bordertech.wcomponents.util.mock.servlet.MockHttpServletRequest)5