Search in sources :

Example 6 with WMultiTextField

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

the class WMultiTextFieldRenderer_Test method testXssEscaping.

@Test
public void testXssEscaping() throws IOException, SAXException, XpathException {
    WMultiTextField field = new WMultiTextField();
    field.setTextInputs(new String[] { getInvalidCharSequence(), getMaliciousContent() });
    assertSafeContent(field);
    field.setToolTip(getMaliciousAttribute("ui:multitextfield"));
    assertSafeContent(field);
    field.setAccessibleText(getMaliciousAttribute("ui:multitextfield"));
    assertSafeContent(field);
}
Also used : WMultiTextField(com.github.bordertech.wcomponents.WMultiTextField) Test(org.junit.Test)

Example 7 with WMultiTextField

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

the class WMultiTextFieldRenderer_Test method testDoPaint.

@Test
public void testDoPaint() throws IOException, SAXException, XpathException {
    WMultiTextField wmtf = new WMultiTextField();
    assertSchemaMatch(wmtf);
    assertXpathEvaluatesTo("0", "count(//ui:multitextfield/ui:value)", wmtf);
    wmtf.setTextInputs(new String[] { "a", "b" });
    assertXpathEvaluatesTo("2", "count(//ui:multitextfield/ui:value)", wmtf);
    assertXpathEvaluatesTo("a", "normalize-space(//ui:multitextfield/ui:value[position()=1])", wmtf);
    assertXpathEvaluatesTo("b", "normalize-space(//ui:multitextfield/ui:value[position()=2])", wmtf);
}
Also used : WMultiTextField(com.github.bordertech.wcomponents.WMultiTextField) Test(org.junit.Test)

Aggregations

WMultiTextField (com.github.bordertech.wcomponents.WMultiTextField)7 Test (org.junit.Test)6 WLabel (com.github.bordertech.wcomponents.WLabel)1 XmlStringBuilder (com.github.bordertech.wcomponents.XmlStringBuilder)1