예제 #1
0
  @Test
  public void testInlineEnclosureWithAdditionalAjaxTarget() {
    {
      // On
      InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
          tester.startPage(InlineEnclosureWithAdditionalAjaxTargetPage.class);
      assertVisible(ajaxPage.getLabel1());
      assertVisible(ajaxPage.getLabel2());
      tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
    }
    {
      // Off
      InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
          (InlineEnclosureWithAdditionalAjaxTargetPage) tester.getLastRenderedPage();
      tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
      assertInVisible(ajaxPage.getLabel1());
      assertInVisible(ajaxPage.getLabel2());
      tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
    }
    {
      // On
      InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
          (InlineEnclosureWithAdditionalAjaxTargetPage) tester.getLastRenderedPage();
      // WICKET-5302 - only the InlineEnclosure is in the Ajax response
      // Label1 is inside the InlineEncosure
      InlineEnclosure children =
          ajaxPage.visitChildren(
              InlineEnclosure.class,
              new IVisitor<InlineEnclosure, InlineEnclosure>() {
                @Override
                public void component(InlineEnclosure component, IVisit<InlineEnclosure> visit) {
                  visit.stop(component);
                }
              });

      tester.assertComponentOnAjaxResponse(children.getId());
      tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
      assertVisible(ajaxPage.getLabel1());
      assertVisible(ajaxPage.getLabel2());
      tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
    }
    {
      // Off
      InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
          (InlineEnclosureWithAdditionalAjaxTargetPage) tester.getLastRenderedPage();
      tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
      assertInVisible(ajaxPage.getLabel1());
      assertInVisible(ajaxPage.getLabel2());
    }
  }
예제 #2
0
 public void testInlineEnclosureWithAdditionalAjaxTarget() {
   {
     // On
     InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
         tester.startPage(InlineEnclosureWithAdditionalAjaxTargetPage.class);
     assertVisible(ajaxPage.getLabel1());
     assertVisible(ajaxPage.getLabel2());
     tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
   }
   {
     // Off
     InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
         (InlineEnclosureWithAdditionalAjaxTargetPage) tester.getLastRenderedPage();
     tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
     assertInVisible(ajaxPage.getLabel1());
     assertInVisible(ajaxPage.getLabel2());
     tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
   }
   {
     // On
     InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
         (InlineEnclosureWithAdditionalAjaxTargetPage) tester.getLastRenderedPage();
     tester.assertComponentOnAjaxResponse(ajaxPage.getLabel1());
     tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
     assertVisible(ajaxPage.getLabel1());
     assertVisible(ajaxPage.getLabel2());
     tester.clickLink(ajaxPage.getLink().getPageRelativePath(), true);
   }
   {
     // Off
     InlineEnclosureWithAdditionalAjaxTargetPage ajaxPage =
         (InlineEnclosureWithAdditionalAjaxTargetPage) tester.getLastRenderedPage();
     tester.assertComponentOnAjaxResponse(ajaxPage.getLabel2());
     assertInVisible(ajaxPage.getLabel1());
     assertInVisible(ajaxPage.getLabel2());
   }
 }