Search in sources :

Example 11 with WTextArea

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);
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WContainer(com.github.bordertech.wcomponents.WContainer) WLabel(com.github.bordertech.wcomponents.WLabel) Test(org.junit.Test)

Example 12 with WTextArea

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());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) Test(org.junit.Test)

Example 13 with WTextArea

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());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) WMultiSelect(com.github.bordertech.wcomponents.WMultiSelect) Test(org.junit.Test)

Example 14 with WTextArea

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());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) WMultiSelect(com.github.bordertech.wcomponents.WMultiSelect) Test(org.junit.Test)

Example 15 with WTextArea

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());
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) WDropdown(com.github.bordertech.wcomponents.WDropdown) WTextField(com.github.bordertech.wcomponents.WTextField) WMultiSelect(com.github.bordertech.wcomponents.WMultiSelect) Test(org.junit.Test)

Aggregations

WTextArea (com.github.bordertech.wcomponents.WTextArea)23 Test (org.junit.Test)19 WTextField (com.github.bordertech.wcomponents.WTextField)14 WDropdown (com.github.bordertech.wcomponents.WDropdown)10 WMultiSelect (com.github.bordertech.wcomponents.WMultiSelect)5 WContainer (com.github.bordertech.wcomponents.WContainer)4 WFieldLayout (com.github.bordertech.wcomponents.WFieldLayout)4 WLabel (com.github.bordertech.wcomponents.WLabel)3 WCheckBox (com.github.bordertech.wcomponents.WCheckBox)2 WCheckBoxSelect (com.github.bordertech.wcomponents.WCheckBoxSelect)2 WDateField (com.github.bordertech.wcomponents.WDateField)2 WField (com.github.bordertech.wcomponents.WField)2 WFieldSet (com.github.bordertech.wcomponents.WFieldSet)2 WText (com.github.bordertech.wcomponents.WText)2 Input (com.github.bordertech.wcomponents.Input)1 RadioButtonGroup (com.github.bordertech.wcomponents.RadioButtonGroup)1 SubordinateTarget (com.github.bordertech.wcomponents.SubordinateTarget)1 UIContextImpl (com.github.bordertech.wcomponents.UIContextImpl)1 WApplication (com.github.bordertech.wcomponents.WApplication)1 WButton (com.github.bordertech.wcomponents.WButton)1