當前位置: 首頁>>代碼示例>>Java>>正文


Java WicketTester.assertLabel方法代碼示例

本文整理匯總了Java中org.apache.wicket.util.tester.WicketTester.assertLabel方法的典型用法代碼示例。如果您正苦於以下問題:Java WicketTester.assertLabel方法的具體用法?Java WicketTester.assertLabel怎麽用?Java WicketTester.assertLabel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.wicket.util.tester.WicketTester的用法示例。


在下文中一共展示了WicketTester.assertLabel方法的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");
}
 
開發者ID:premium-minds,項目名稱:pm-wicket-utils,代碼行數:25,代碼來源:BootstrapPaginatorTest.java

示例2: ajaxLazyComponentPanel_behavesCorrectly

import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void ajaxLazyComponentPanel_behavesCorrectly() {
    WicketTester tester = getWicketTester();

    AjaxLazyComponentPanel panel =
        new AjaxLazyComponentPanel("panel", id -> new Label(id, "lazy panel test").setRenderBodyOnly(true));

    tester.startComponentInPage(panel);

    TagTester content = tester.getTagByWicketId("content");
    System.out.println(content.getMarkup());

    assertNotNull(content);
    assertTrue("Container missing css class 'spinner'", content.getAttributeContains("class", "spinner"));
    assertEquals("<i style=\"font-size: 32px\" class=\"fa fa-cog fa-spin\"></i>", content.getValue());

    AjaxLazyLoadPanelTester.executeAjaxLazyLoadPanel(tester, panel.getParent());
    // tester.debugComponentTrees();

    tester.assertLabel("panel:content", "lazy panel test");
}
 
開發者ID:flex-oss,項目名稱:flex-ui,代碼行數:22,代碼來源:AjaxLazyComponentPanelTest.java

示例3: testItemsLeftCountLabelCaptions

import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testItemsLeftCountLabelCaptions() {

  WicketTester tester = new WicketTester();

  IModel<Integer> countModel = new Model<Integer>();
  String id = "id";
  ItemsLeftCountLabel label = new ItemsLeftCountLabel(id, countModel);

  countModel.setObject(0);
  tester.startComponentInPage(label);
  tester.assertLabel(id, "items left");

  countModel.setObject(1);
  tester.startComponentInPage(label);
  tester.assertLabel(id, "item left");

  countModel.setObject(3);
  tester.startComponentInPage(label);
  tester.assertLabel(id, "items left");
}
 
開發者ID:olle,項目名稱:serverside-todomvc,代碼行數:22,代碼來源:ItemsLeftCountLabelTest.java

示例4: testTodoTextLabel

import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testTodoTextLabel() {

  WicketTester tester = new WicketTester();
  Todo todo = new Todo();
  IModel<Todo> todoModel = new Model<Todo>();
  String id = "id";
  TodoTextLabel label = new TodoTextLabel(id, todoModel);

  todoModel.setObject(null);
  tester.startComponentInPage(label);
  tester.assertLabel(id, "");

  todoModel.setObject(todo);
  tester.startComponentInPage(label);
  tester.assertLabel(id, "");

  todo.setTodo("foo bar");
  tester.startComponentInPage(label);
  tester.assertLabel(id, "foo bar");
}
 
開發者ID:olle,項目名稱:serverside-todomvc,代碼行數:22,代碼來源:TodoTextLabelTest.java

示例5: testFilterLabelCaptions

import org.apache.wicket.util.tester.WicketTester; //導入方法依賴的package包/類
@Test
public void testFilterLabelCaptions() {

  WicketTester tester = new WicketTester();
  IModel<Filter> filterModel = new Model<Filter>();
  String id = "id";
  FilterLabel label = new FilterLabel(id, filterModel);

  filterModel.setObject(null);
  tester.startComponentInPage(label);
  tester.assertLabel(id, "None");

  filterModel.setObject(new Filter(Status.ACTIVE));
  tester.startComponentInPage(label);
  tester.assertLabel(id, "Active");

  filterModel.setObject(new Filter(Status.COMPLETED));
  tester.startComponentInPage(label);
  tester.assertLabel(id, "Completed");

  filterModel.setObject(new Filter(Status.ACTIVE, Status.COMPLETED));
  tester.startComponentInPage(label);
  tester.assertLabel(id, "All");

  filterModel.setObject(new Filter(Status.COMPLETED, Status.ACTIVE));
  tester.startComponentInPage(label);
  tester.assertLabel(id, "All");
}
 
開發者ID:olle,項目名稱:serverside-todomvc,代碼行數:29,代碼來源:FilterLabelTest.java


注:本文中的org.apache.wicket.util.tester.WicketTester.assertLabel方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。