Search in sources :

Example 11 with WDecoratedLabel

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

the class WDecoratedLabelRenderer_Test method testRendererCorrectlyConfigured.

@Test
public void testRendererCorrectlyConfigured() {
    WDecoratedLabel decoratedLabel = new WDecoratedLabel();
    Assert.assertTrue("Incorrect renderer supplied", getWebXmlRenderer(decoratedLabel) instanceof WDecoratedLabelRenderer);
}
Also used : WDecoratedLabel(com.github.bordertech.wcomponents.WDecoratedLabel) Test(org.junit.Test)

Example 12 with WDecoratedLabel

use of com.github.bordertech.wcomponents.WDecoratedLabel 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)

Example 13 with WDecoratedLabel

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

the class WHeadingRenderer_Test method testXssEscaping.

@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
    WHeading heading = new WHeading(WHeading.TITLE, new WDecoratedLabel(new WText("dummy")));
    assertSafeContent(heading);
    heading.setAccessibleText(getMaliciousAttribute("ui:heading"));
    assertSafeContent(heading);
}
Also used : WText(com.github.bordertech.wcomponents.WText) WHeading(com.github.bordertech.wcomponents.WHeading) WDecoratedLabel(com.github.bordertech.wcomponents.WDecoratedLabel) Test(org.junit.Test)

Aggregations

WDecoratedLabel (com.github.bordertech.wcomponents.WDecoratedLabel)13 WText (com.github.bordertech.wcomponents.WText)10 WImage (com.github.bordertech.wcomponents.WImage)6 WMenuItem (com.github.bordertech.wcomponents.WMenuItem)5 Test (org.junit.Test)4 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)3 WHeading (com.github.bordertech.wcomponents.WHeading)3 WSubMenu (com.github.bordertech.wcomponents.WSubMenu)3 Action (com.github.bordertech.wcomponents.Action)2 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)2 WComponent (com.github.bordertech.wcomponents.WComponent)2 WMenu (com.github.bordertech.wcomponents.WMenu)2 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)2 ImageResource (com.github.bordertech.wcomponents.ImageResource)1 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)1 WButton (com.github.bordertech.wcomponents.WButton)1 WContainer (com.github.bordertech.wcomponents.WContainer)1 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)1 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)1 WHorizontalRule (com.github.bordertech.wcomponents.WHorizontalRule)1