use of com.github.bordertech.wcomponents.WTextArea in project wcomponents by BorderTech.
the class WLabelRenderer_Test method testDoPaintAllOptions.
@Test
public void testDoPaintAllOptions() throws IOException, SAXException, XpathException {
WTextArea text = new WTextArea();
text.setText("text1");
WLabel label = new WLabel();
label.setForComponent(text);
label.setHint("hint1");
label.setAccessKey('A');
label.setText("label1");
WContainer root = new WContainer();
root.add(label);
root.add(text);
// Validate Schema
assertSchemaMatch(root);
// Check Attributes
assertXpathEvaluatesTo(label.getId(), "//ui:label/@id", label);
assertXpathEvaluatesTo(text.getId(), "//ui:label/@for", label);
assertXpathEvaluatesTo("hint1", "//ui:label/@hint", label);
assertXpathEvaluatesTo("A", "//ui:label/@accessKey", label);
assertXpathEvaluatesTo("input", "//ui:label/@what", label);
// Check Label
assertXpathEvaluatesTo("label1", "//ui:label", label);
// Add Children to Label
WTextArea text2 = new WTextArea();
text2.setText("text2");
label.add(text2);
assertSchemaMatch(root);
assertXpathEvaluatesTo("text2", "//ui:label/ui:textarea", label);
}
use of com.github.bordertech.wcomponents.WTextArea in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testThreeArgOrCondition.
@Test
public void testThreeArgOrCondition() {
builder.equals(new WTextField(), "1").or().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3");
Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" or WTextArea=\"2\" or WDropdown=\"3\")", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextArea in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testAndOperatorPrecedenceBoth.
/**
* Tests for correct operator precedence when there are ANDs on both sides of the OR: a {@literal &}{@literal &} b
* || c {@literal &}{@literal &} d.
*/
@Test
public void testAndOperatorPrecedenceBoth() {
builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3").and().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and WTextArea=\"2\") or (WDropdown=\"3\" and WMultiSelect=\"4\"))", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextArea in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testAndandOrWithExpressions.
/**
* Tests nesting of expression builders to change the order of operations: (a {@literal &}{@literal &} b) || (c
* {@literal &}{@literal &} d).
*/
@Test
public void testAndandOrWithExpressions() {
builder.equals(new WTextField(), "1").and(new ExpressionBuilder().equals(new WTextArea(), "2")).or(new ExpressionBuilder().equals(new WDropdown(), "3")).and().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and WTextArea=\"2\") or (WDropdown=\"3\" and WMultiSelect=\"4\"))", builder.build().toString());
}
use of com.github.bordertech.wcomponents.WTextArea in project wcomponents by BorderTech.
the class ExpressionBuilder_Test method testNesting.
/**
* Tests nesting of expression builders to change the order of operations: (a {@literal &}{@literal &} (b || c)
* {@literal &}{@literal &} d).
*/
@Test
public void testNesting() {
builder.equals(new WTextField(), "1").and(new ExpressionBuilder().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3")).and().equals(new WMultiSelect(), "4");
Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" and (WTextArea=\"2\" or WDropdown=\"3\") and WMultiSelect=\"4\")", builder.build().toString());
}
Aggregations