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);
}
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);
}
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);
}
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());
}
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());
}
Aggregations