Package org.apache.wicket.util.tester.apps_5

Examples of org.apache.wicket.util.tester.apps_5.AjaxLinkClickTest


   *
   */
  @Test
  public void testClickLinkInsideForm_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndContainedLink page = new MockPageWithFormAndContainedLink(mockPojo);
    page.addLink(new AjaxSubmitLink("link")
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        assertNotNull(form);
        linkClicked = true;
      }

      @Override
      protected void onError(AjaxRequestTarget target, Form<?> form)
      {
      }
    });

    tester.startPage(page);

    tester.assertRenderedPage(MockPageWithFormAndContainedLink.class);

    // Change the name in the textfield
    tester.getRequest()
      .getPostParameters()
      .setParameterValue(page.getNameField().getInputName(), "new mock value");

    // Click the submit link
    tester.clickLink("form:link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here


   *
   */
  @Test
  public void testClickLink_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndLink page = new MockPageWithFormAndLink(mockPojo);
    AjaxSubmitLink link = new AjaxSubmitLink("link", page.getForm())
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        assertNotNull(form);
        linkClicked = true;
      }

      @Override
      protected void onError(AjaxRequestTarget target, Form<?> form)
      {
      }
    };
    page.add(link);

    tester.startPage(page);
    tester.assertRenderedPage(MockPageWithFormAndLink.class);

    // Change the name in the textfield
    tester.getRequest()
      .getPostParameters()
      .setParameterValue(page.getNameField().getInputName(), "new mock value");

    // Click the submit link
    tester.clickLink("link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

  /**
   *
   */
  public void testClickLinkInsideForm_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndContainedLink page = new MockPageWithFormAndContainedLink(mockPojo);
    page.addLink(new AjaxSubmitLink("link")
    {
      private static final long serialVersionUID = 1L;

      protected void onSubmit(AjaxRequestTarget target, Form form)
      {
        assertNotNull(form);
        linkClicked = true;
      }
    });

    tester.startPage(new ITestPageSource()
    {
      private static final long serialVersionUID = 1L;

      public Page getTestPage()
      {
        return page;
      }
    });

    tester.assertRenderedPage(MockPageWithFormAndContainedLink.class);

    // Change the name in the textfield
    page.getNameField().setModelValue(new String[] { "new mock value" });

    // Click the submit link
    tester.clickLink("form:link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

  /**
   *
   */
  public void testClickLink_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndLink page = new MockPageWithFormAndLink(mockPojo);
    AjaxSubmitLink link = new AjaxSubmitLink("link", page.getForm())
    {
      private static final long serialVersionUID = 1L;

      protected void onSubmit(AjaxRequestTarget target, Form form)
      {
        assertNotNull(form);
        linkClicked = true;
      }
    };
    page.add(link);

    tester.startPage(new ITestPageSource()
    {
      private static final long serialVersionUID = 1L;

      public Page getTestPage()
      {
        return page;
      }
    });

    tester.assertRenderedPage(MockPageWithFormAndLink.class);

    // Change the name in the textfield
    page.getNameField().setModelValue(new String[] { "new mock value" });

    // Click the submit link
    tester.clickLink("link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

  /**
   *
   */
  public void testClickLinkInsideForm_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndContainedLink page = new MockPageWithFormAndContainedLink(mockPojo);
    page.addLink(new AjaxSubmitLink("link")
    {
      private static final long serialVersionUID = 1L;
View Full Code Here

  /**
   *
   */
  public void testClickLink_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndLink page = new MockPageWithFormAndLink(mockPojo);
    AjaxSubmitLink link = new AjaxSubmitLink("link", page.getForm())
    {
      private static final long serialVersionUID = 1L;
View Full Code Here

  /**
   *
   */
  public void testClickLinkInsideForm_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndContainedLink page = new MockPageWithFormAndContainedLink(mockPojo);
    page.addLink(new AjaxSubmitLink("link")
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        assertNotNull(form);
        linkClicked = true;
      }

      @Override
      protected void onError(AjaxRequestTarget target, Form<?> form)
      {
      }
    });

    tester.startPage(page);

    tester.assertRenderedPage(MockPageWithFormAndContainedLink.class);

    // Change the name in the textfield
    tester.getRequest()
      .getPostParameters()
      .setParameterValue(page.getNameField().getInputName(), "new mock value");

    // Click the submit link
    tester.clickLink("form:link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

  /**
   *
   */
  public void testClickLink_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndLink page = new MockPageWithFormAndLink(mockPojo);
    AjaxSubmitLink link = new AjaxSubmitLink("link", page.getForm())
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        assertNotNull(form);
        linkClicked = true;
      }

      @Override
      protected void onError(AjaxRequestTarget target, Form<?> form)
      {
      }
    };
    page.add(link);

    tester.startPage(page);
    tester.assertRenderedPage(MockPageWithFormAndLink.class);

    // Change the name in the textfield
    tester.getRequest()
      .getPostParameters()
      .setParameterValue(page.getNameField().getInputName(), "new mock value");

    // Click the submit link
    tester.clickLink("link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

  /**
   *
   */
  public void testClickLinkInsideForm_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndContainedLink page = new MockPageWithFormAndContainedLink(mockPojo);
    page.addLink(new AjaxSubmitLink("link")
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        assertNotNull(form);
        linkClicked = true;
      }
    });

    tester.startPage(new ITestPageSource()
    {
      private static final long serialVersionUID = 1L;

      public Page getTestPage()
      {
        return page;
      }
    });

    tester.assertRenderedPage(MockPageWithFormAndContainedLink.class);

    // Change the name in the textfield
    page.getNameField().setModelValue(new String[] { "new mock value" });

    // Click the submit link
    tester.clickLink("form:link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

  /**
   *
   */
  public void testClickLink_ajaxSubmitLink()
  {
    MockPojo mockPojo = new MockPageWithFormAndLink.MockPojo();
    mockPojo.setName("Mock name");

    final MockPageWithFormAndLink page = new MockPageWithFormAndLink(mockPojo);
    AjaxSubmitLink link = new AjaxSubmitLink("link", page.getForm())
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected void onSubmit(AjaxRequestTarget target, Form<?> form)
      {
        assertNotNull(form);
        linkClicked = true;
      }
    };
    page.add(link);

    tester.startPage(new ITestPageSource()
    {
      private static final long serialVersionUID = 1L;

      public Page getTestPage()
      {
        return page;
      }
    });

    tester.assertRenderedPage(MockPageWithFormAndLink.class);

    // Change the name in the textfield
    page.getNameField().setModelValue(new String[] { "new mock value" });

    // Click the submit link
    tester.clickLink("link");

    // Has it really been clicked?
    assertTrue(linkClicked);

    // And has the form been "submitted"
    assertEquals("new mock value", mockPojo.getName());
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.tester.apps_5.AjaxLinkClickTest

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.