Search in sources :

Example 91 with WLabel

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

the class WLabelRenderer_Test method testHiddenComponentWithInput.

@Test
public void testHiddenComponentWithInput() throws IOException, SAXException, XpathException {
    MyInput comp = new MyInput();
    WLabel label = new WLabel("label", comp);
    comp.setHidden(true);
    assertSchemaMatch(label);
    assertXpathEvaluatesTo("true", "//ui:label/@hiddencomponent", label);
}
Also used : WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 92 with WLabel

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

the class WLabelRenderer_Test method testWhatForGroup1.

@Test
public void testWhatForGroup1() throws IOException, SAXException, XpathException {
    WCheckBoxSelect comp = new WCheckBoxSelect();
    WLabel label = new WLabel("label", comp);
    assertSchemaMatch(label);
    assertXpathEvaluatesTo("group", "//ui:label/@what", label);
}
Also used : WCheckBoxSelect(com.github.bordertech.wcomponents.WCheckBoxSelect) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 93 with WLabel

use of com.github.bordertech.wcomponents.WLabel 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 94 with WLabel

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

the class InterceptorComponent_Test method testBackingComponentAccessors.

@Test
public void testBackingComponentAccessors() {
    WComponent backing = new WLabel();
    InterceptorComponent interceptor = new InterceptorComponent(backing);
    Assert.assertSame("Incorrect backing component returned", backing, interceptor.getBackingComponent());
    interceptor = new InterceptorComponent();
    interceptor.setBackingComponent(backing);
    Assert.assertSame("Incorrect backing component returned", backing, interceptor.getBackingComponent());
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 95 with WLabel

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

the class InterceptorComponent_Test method testGetName.

@Test
public void testGetName() {
    WComponent backing = new WLabel();
    setActiveContext(createUIContext());
    InterceptorComponent interceptor = new InterceptorComponent(backing);
    Assert.assertEquals("Incorrect name returned", backing.getName(), interceptor.getName());
    interceptor = new InterceptorComponent(interceptor);
    Assert.assertEquals("Incorrect name returned for nested interceptor", backing.getName(), interceptor.getName());
}
Also used : WComponent(com.github.bordertech.wcomponents.WComponent) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Aggregations

WLabel (com.github.bordertech.wcomponents.WLabel)99 Test (org.junit.Test)57 WHeading (com.github.bordertech.wcomponents.WHeading)13 WTextField (com.github.bordertech.wcomponents.WTextField)10 WButton (com.github.bordertech.wcomponents.WButton)9 ExplanatoryText (com.github.bordertech.wcomponents.examples.common.ExplanatoryText)9 WComponent (com.github.bordertech.wcomponents.WComponent)8 WRadioButtonSelect (com.github.bordertech.wcomponents.WRadioButtonSelect)8 WPanel (com.github.bordertech.wcomponents.WPanel)7 UIContext (com.github.bordertech.wcomponents.UIContext)6 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)6 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)5 UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)5 WAjaxControl (com.github.bordertech.wcomponents.WAjaxControl)5 WComponentGroup (com.github.bordertech.wcomponents.WComponentGroup)5 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)5 Action (com.github.bordertech.wcomponents.Action)4 ActionEvent (com.github.bordertech.wcomponents.ActionEvent)4 WApplication (com.github.bordertech.wcomponents.WApplication)4 WContainer (com.github.bordertech.wcomponents.WContainer)4