Search in sources :

Example 6 with WTextArea

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

the class ExpressionBuilder_Test method testAndOperatorPrecedenceLHS.

/**
 * Tests for correct operator precedence when there is an AND on the left-hand side of the OR: a
 * {@literal &}{@literal &} b || c.
 */
@Test
public void testAndOperatorPrecedenceLHS() {
    builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2").or().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and 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 7 with WTextArea

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

the class ExpressionBuilder_Test method testNotWithAndCondition.

/**
 * Test Not with And condition.
 */
@Test
public void testNotWithAndCondition() {
    builder.equals(new WTextField(), "1").and().not(new ExpressionBuilder().equals(new WTextArea(), "2")).or().not(new ExpressionBuilder().equals(new WTextArea(), "2")).and().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "((WTextField=\"1\" and NOT (WTextArea=\"2\")) or (NOT (WTextArea=\"2\") and 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 8 with WTextArea

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

the class ExpressionBuilder_Test method testThreeArgAndCondition.

@Test
public void testThreeArgAndCondition() {
    builder.equals(new WTextField(), "1").and().equals(new WTextArea(), "2").and().equals(new WDropdown(), "3");
    Assert.assertEquals("Incorrect condition", "(WTextField=\"1\" and WTextArea=\"2\" and 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 9 with WTextArea

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

the class WTextAreaRenderer_Test method testReadOnly.

@Test
public void testReadOnly() throws IOException, SAXException, XpathException {
    WTextArea field = new WTextArea();
    field.setReadOnly(true);
    assertSchemaMatch(field);
    assertXpathEvaluatesTo("true", "//ui:textarea/@readOnly", field);
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) Test(org.junit.Test)

Example 10 with WTextArea

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

the class WTextAreaRenderer_Test method testXssEscaping.

@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
    WTextArea textArea = new WTextArea();
    textArea.setText(getMaliciousContent());
    assertSafeContent(textArea);
    textArea.setToolTip(getMaliciousAttribute("ui:textarea"));
    assertSafeContent(textArea);
    textArea.setAccessibleText(getMaliciousAttribute("ui:textarea"));
    assertSafeContent(textArea);
}
Also used : WTextArea(com.github.bordertech.wcomponents.WTextArea) 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