本文整理匯總了Java中org.apache.wicket.util.tester.WicketTester.clickLink方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketTester.clickLink方法的具體用法?Java WicketTester.clickLink怎麽用?Java WicketTester.clickLink使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.wicket.util.tester.WicketTester
的用法示例。
在下文中一共展示了WicketTester.clickLink方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testNumberButton
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testNumberButton(){
WicketTester tester = createTester();
final Boxed<Integer> pageBox = new Boxed<Integer>();
BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
private static final long serialVersionUID = -4486050808642574868L;
@Override
public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
pageBox.value=page.getObject();
}
};
paginator.setTotalResults(Model.of(100));
paginator.setNumberResultsPerPage(10);
tester.startComponentInPage(paginator);
tester.clickLink("paginator:page:4:link");
assertEquals(4, (int) pageBox.value);
tester.assertEnabled("paginator:last:link");
tester.assertEnabled("paginator:next:link");
tester.assertEnabled("paginator:previous:link");
tester.assertEnabled("paginator:first:link");
tester.assertLabel("paginator:page:2:link:label", "5");
}
示例2: testLastButton
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testLastButton(){
WicketTester tester = createTester();
final Boxed<Integer> pageBox = new Boxed<Integer>();
BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
private static final long serialVersionUID = -4486050808642574868L;
@Override
public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
pageBox.value=page.getObject();
}
};
paginator.setTotalResults(Model.of(100));
paginator.setNumberResultsPerPage(10);
tester.startComponentInPage(paginator);
tester.clickLink("paginator:last:link");
assertEquals(9, (int) pageBox.value);
tester.assertDisabled("paginator:last:link");
tester.assertDisabled("paginator:next:link");
tester.assertEnabled("paginator:previous:link");
tester.assertEnabled("paginator:first:link");
}
示例3: testNextButton
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testNextButton(){
WicketTester tester = createTester();
final Boxed<Integer> pageBox = new Boxed<Integer>();
BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
private static final long serialVersionUID = -4486050808642574868L;
@Override
public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
pageBox.value=page.getObject();
}
};
paginator.setTotalResults(Model.of(100));
tester.startComponentInPage(paginator);
tester.clickLink("paginator:next:link");
assertEquals(1, (int) pageBox.value);
tester.assertEnabled("paginator:last:link");
tester.assertEnabled("paginator:next:link");
tester.assertEnabled("paginator:previous:link");
tester.assertEnabled("paginator:first:link");
}
示例4: testPreviousButton
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testPreviousButton(){
WicketTester tester = createTester();
final Boxed<Integer> pageBox = new Boxed<Integer>();
BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
private static final long serialVersionUID = -4486050808642574868L;
@Override
public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
pageBox.value=page.getObject();
}
};
paginator.setTotalResults(Model.of(100));
paginator.setModelObject(2);
tester.startComponentInPage(paginator);
tester.clickLink("paginator:previous:link");
assertEquals(1, (int) pageBox.value);
tester.assertEnabled("paginator:last:link");
tester.assertEnabled("paginator:next:link");
tester.assertEnabled("paginator:previous:link");
tester.assertEnabled("paginator:first:link");
}
示例5: testFirstButton
import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testFirstButton(){
WicketTester tester = createTester();
final Boxed<Integer> pageBox = new Boxed<Integer>();
BootstrapPaginator paginator = new BootstrapPaginator("paginator") {
private static final long serialVersionUID = -4486050808642574868L;
@Override
public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
pageBox.value=page.getObject();
}
};
paginator.setTotalResults(Model.of(100));
paginator.setModelObject(2);
tester.startComponentInPage(paginator);
tester.clickLink("paginator:first:link");
assertEquals(0, (int) pageBox.value);
tester.assertEnabled("paginator:last:link");
tester.assertEnabled("paginator:next:link");
tester.assertDisabled("paginator:previous:link");
tester.assertDisabled("paginator:first:link");
}