Package org.apache.wicket.util.tester

Examples of org.apache.wicket.util.tester.FormTester$ChoiceSelector


    PaletteTestPage testPage = new PaletteTestPage(selected, all);

    tester.startPage(testPage);

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.submit();

    Collection<String> collection = testPage.palette.getModelCollection();

    assertEquals(2, collection.size());
    Iterator<String> iterator = collection.iterator();
View Full Code Here


    PaletteTestPage testPage = new PaletteTestPage(selected, all);

    tester.startPage(testPage);

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.submit();

    Collection<String> collection = testPage.palette.getModelCollection();

    assertEquals(0, collection.size());
  }
View Full Code Here

    PaletteTestPage testPage = new PaletteTestPage(selected, all);

    tester.startPage(testPage);

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.submit();

    Collection<String> collection = testPage.palette.getModelCollection();

    assertEquals(1, collection.size());
    assertEquals("D", collection.iterator().next());
View Full Code Here

    PaletteTestPage testPage = new PaletteTestPage(selected, all);
    testPage.palette.setRequired(true);

    tester.startPage(testPage);

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.submit();

    assertTrue(testPage.form.hasError());
  }
View Full Code Here

      }
    });

    tester.startPage(testPage);

    FormTester formTester = tester.newFormTester(testPage.form.getId());
    formTester.setValue("palette:recorder", "A");
    formTester.submit();

    assertTrue(testPage.form.hasError());

    // with RAW_INPUT
    tester.assertContains("<option value=\"B\">B</option>\\s*</select>");
 
View Full Code Here


    tester.getSession().invalidateNow();
    assertFalse(page.formSubmitted.get());
    String textOldValue = page.textModel.getObject();
    FormTester formTester = tester.newFormTester("f");
    formTester.setValue("text", "newValue");
    formTester.submit();
    page = (ExpirationRecoveryPage) tester.getLastRenderedPage();
    assertFalse("Form should not be submitted", page.formSubmitted.get());
    assertEquals("TextField's value should not be modified", textOldValue, page.textModel.getObject());
    assertEquals("PageParameters should be preserved", parameters, page.getPageParameters());
  }
View Full Code Here

    assertEquals("PageParameters should be preserved", parameters, page.getPageParameters());


    tester.getSession().invalidateNow();
    assertFalse(page.formSubmitted.get());
    FormTester formTester = tester.newFormTester("f");
    String newValue = "newValue";
    formTester.setValue("text", newValue);
    formTester.submit();
    page = (ExpirationRecoveryPage) tester.getLastRenderedPage();
    assertTrue("Form should be submitted", page.formSubmitted.get());
    assertEquals("TextField's value should be modified", newValue, page.textModel.getObject());
    assertEquals("PageParameters should be preserved", parameters, page.getPageParameters());
View Full Code Here

    Class pageClass = AjaxFormSubmitTestPage.class;
    System.out.println("=== " + pageClass.getName() + " ===");

    tester.startPage(pageClass);
    tester.assertRenderedPage(pageClass);
    FormTester form = tester.newFormTester("form");
    form.setValue("txt1", "txt1");
    form.setValue("txt2", "txt2");
    tester.executeAjaxEvent("form:submit", "onclick");
    AjaxFormSubmitTestPage page = (AjaxFormSubmitTestPage)tester.getLastRenderedPage();
    assertFalse((page.getFormSubmitted() & AjaxFormSubmitTestPage.FORM) == AjaxFormSubmitTestPage.FORM);
    assertTrue((page.getFormSubmitted() & AjaxFormSubmitTestPage.BUTTON) == AjaxFormSubmitTestPage.BUTTON);
    assertEquals("foo", tester.getComponentFromLastRenderedPage("form:txt1").getModelObject());
View Full Code Here

  {
    tester.startPage(LoginPage.class);
    tester.setupRequestAndResponse();
    assertTrue(tester.getWicketSession().isTemporary());
    tester.processRequestCycle(LoginPage.class);
    FormTester form = tester.newFormTester("signInPanel:signInForm");
    form.setValue("username", "test");
    form.setValue("password", "test");
    tester.getWicketSession().bind();
    form.submit();
    tester.assertRenderedPage(HomePage.class);
    tester.setupRequestAndResponse();
    assertFalse(Session.get().isTemporary());
    tester.processRequestCycle(LoginPage.class);
  }
View Full Code Here

  public void testSubmitLinkByUsingFormTester()
  {
    tester.startPage(HomePage.class);
    tester.assertRenderedPage(HomePage.class);
    HomePage home = (HomePage)tester.getLastRenderedPage();
    FormTester formTester = tester.newFormTester("form");
    formTester.setValue("text", "Hello");
    formTester.submit("link");
    assertEquals("Hello", home.getText());
    assertTrue("Form.onSubmit() has not been called!", home.isSubmitted());
    assertTrue("SubmitLink.onSubmit() has not been called!", home.isSubmittedViaLink());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.tester.FormTester$ChoiceSelector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.