Java Code Examples for org.apache.wicket.util.tester.WicketTester#assertDisabled()

The following examples show how to use org.apache.wicket.util.tester.WicketTester#assertDisabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BootstrapPaginatorTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testRenderComponent(){
	WicketTester tester = createTester();
	BootstrapPaginator paginator = new BootstrapPaginator("paginator", Model.of(100)) {
		private static final long serialVersionUID = -4486050808642574868L;

		@Override
		public void onPageChange(AjaxRequestTarget target, IModel<Integer> page) {
		}
	};
	paginator.setTotalResults(Model.of(100));
	tester.startComponentInPage(paginator);
	tester.assertDisabled("paginator:first:link");
	tester.assertDisabled("paginator:previous:link");
	tester.assertEnabled("paginator:next:link");
	tester.assertEnabled("paginator:last:link");
}
 
Example 2
Source File: BootstrapPaginatorTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testLastButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator", Model.of(100)) {
		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");
	
}
 
Example 3
Source File: BootstrapPaginatorTest.java    From pm-wicket-utils with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Test
public void testFirstButton(){
	WicketTester tester = createTester();
	final Boxed<Integer> pageBox = new Boxed<Integer>();
	
	BootstrapPaginator paginator = new BootstrapPaginator("paginator", Model.of(100)) {
		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");
}