Search in sources :

Example 1 with HTML5Attributes

use of org.apache.wicket.markup.html.HTML5Attributes in project wicket by apache.

the class TextAreaTest method requiredAttribute.

/**
 * https://issues.apache.org/jira/browse/WICKET-5289
 */
@Test
public void requiredAttribute() {
    TestPage testPage = new TestPage();
    testPage.textArea.setOutputMarkupId(true);
    testPage.textArea.setType(String.class);
    testPage.textArea.setRequired(true);
    testPage.textArea.add(new HTML5Attributes());
    tester.startPage(testPage);
    TagTester tagTester = tester.getTagById(testPage.textArea.getMarkupId());
    String required = tagTester.getAttribute("required");
    assertEquals("required", required);
}
Also used : HTML5Attributes(org.apache.wicket.markup.html.HTML5Attributes) TagTester(org.apache.wicket.util.tester.TagTester) Test(org.junit.Test)

Example 2 with HTML5Attributes

use of org.apache.wicket.markup.html.HTML5Attributes in project wicket by apache.

the class TextFieldTest method requiredAttribute.

/**
 * https://issues.apache.org/jira/browse/WICKET-5289
 */
@Test
public void requiredAttribute() {
    TestPage testPage = new TestPage();
    testPage.textField.setOutputMarkupId(true);
    testPage.textField.setType(String.class);
    testPage.textField.setRequired(true);
    testPage.textField.add(new HTML5Attributes());
    tester.startPage(testPage);
    TagTester tagTester = tester.getTagById(testPage.textField.getMarkupId());
    String required = tagTester.getAttribute("required");
    assertEquals("required", required);
}
Also used : HTML5Attributes(org.apache.wicket.markup.html.HTML5Attributes) TagTester(org.apache.wicket.util.tester.TagTester) Test(org.junit.Test)

Aggregations

HTML5Attributes (org.apache.wicket.markup.html.HTML5Attributes)2 TagTester (org.apache.wicket.util.tester.TagTester)2 Test (org.junit.Test)2