Search in sources :

Example 21 with TagTester

use of org.apache.wicket.util.tester.TagTester 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

TagTester (org.apache.wicket.util.tester.TagTester)21 Test (org.junit.Test)21 MockPageWithLink (org.apache.wicket.MockPageWithLink)3 Component (org.apache.wicket.Component)2 MarkupContainer (org.apache.wicket.MarkupContainer)2 MockPageWithOneComponent (org.apache.wicket.MockPageWithOneComponent)2 HTML5Attributes (org.apache.wicket.markup.html.HTML5Attributes)2 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)2 StringResourceStream (org.apache.wicket.util.resource.StringResourceStream)2 WicketTestCase (org.apache.wicket.util.tester.WicketTestCase)2 Matchers.equalTo (org.hamcrest.Matchers.equalTo)2 Matchers.is (org.hamcrest.Matchers.is)2 Serializable (java.io.Serializable)1 List (java.util.List)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1