Be careful.. that will execute all callbacks, not just close callback.

This is safer:

  public void executeModalWindowCloseCallback(ModalWindow modalWindow) {
    for (IBehavior behavior : modalWindow.getBehaviors()) {
      if (behavior instanceof AbstractDefaultAjaxBehavior) {
        String name = behavior.getClass().getSimpleName();
        if (name.startsWith("WindowClosedBehavior")) {
          tester.executeBehavior((AbstractAjaxBehavior) behavior);
        }
      }
    }
  }

  public void executeModalWindowCloseButtonCallback(ModalWindow modalWindow) {
    for (IBehavior behavior : modalWindow.getBehaviors()) {
      if (behavior instanceof AbstractDefaultAjaxBehavior) {
        String name = behavior.getClass().getSimpleName();
        if (name.startsWith("CloseButtonBehavior")) {
          tester.executeBehavior((AbstractAjaxBehavior) behavior);
        }
      }
    }
  }


**
Martin

2009/9/9 Per Lundholm <per.lundh...@gmail.com>:
>   /**
>     * Execute a close on a modal window.
>     */
>    private void executeClose() {
>
>        ModalWindow window = (ModalWindow)
> tester.getComponentFromLastRenderedPage(MODAL);
>
>        tester.clickLink(MODAL + ":content:closeOK", true);
>
>        List<IBehavior> behaviors = window.getBehaviors();
>        for (IBehavior behavior : behaviors) {
>            if (behavior instanceof AbstractAjaxBehavior) {
>                tester.executeBehavior((AbstractAjaxBehavior) behavior);
>            }
>        }
>    }
>
>
> 2009/9/8 Martin Makundi <martin.maku...@koodaripalvelut.com>
>
>> Hi!
>>
>> There is nothing special in testing modal windows. It is just a panel
>> with a panel inside. You can use tester.assertVisible...
>>
>> THe only trick is if you have windowCloseCallbacks.. you need to
>> invoke those manually using tester.executeBehavior...
>>
>> **
>> Martin
>>
>> 2009/9/8 Denis Kandrov <dkand...@unipro.ru>:
>> > I have dashboard, that have modal windows for adding comments and view
>> > dashboard message.
>> >
>> > How can I get this modal window for testing with wicket tester?
>> > And how to check that modal window is opened?
>> >
>> > Denis.
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> > For additional commands, e-mail: users-h...@wicket.apache.org
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to