Search in sources :

Example 41 with WCheckBox

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

the class WCheckBoxRenderer_Test method testXssEscaping.

@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
    WCheckBox checkBox = new WCheckBox();
    assertSafeContent(checkBox);
    checkBox.setToolTip(getMaliciousAttribute());
    assertSafeContent(checkBox);
    checkBox.setAccessibleText(getMaliciousAttribute());
    assertSafeContent(checkBox);
}
Also used : WCheckBox(com.github.bordertech.wcomponents.WCheckBox) Test(org.junit.Test)

Example 42 with WCheckBox

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

WCheckBox (com.github.bordertech.wcomponents.WCheckBox)42 Test (org.junit.Test)35 WTextField (com.github.bordertech.wcomponents.WTextField)21 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)18 WContainer (com.github.bordertech.wcomponents.WContainer)17 Equal (com.github.bordertech.wcomponents.subordinate.Equal)13 Rule (com.github.bordertech.wcomponents.subordinate.Rule)13 WSubordinateControl (com.github.bordertech.wcomponents.subordinate.WSubordinateControl)13 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)12 GreaterThanOrEqual (com.github.bordertech.wcomponents.subordinate.GreaterThanOrEqual)11 LessThanOrEqual (com.github.bordertech.wcomponents.subordinate.LessThanOrEqual)11 NotEqual (com.github.bordertech.wcomponents.subordinate.NotEqual)11 SubordinateTrigger (com.github.bordertech.wcomponents.SubordinateTrigger)10 Hide (com.github.bordertech.wcomponents.subordinate.Hide)7 Show (com.github.bordertech.wcomponents.subordinate.Show)7 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 WHeading (com.github.bordertech.wcomponents.WHeading)3 WLabel (com.github.bordertech.wcomponents.WLabel)3 Condition (com.github.bordertech.wcomponents.subordinate.Condition)3 MockRequest (com.github.bordertech.wcomponents.util.mock.MockRequest)3