You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Martin Makundi <ma...@koodaripalvelut.com> on 2009/07/21 18:13:34 UTC

ModalWindow windowClosedCallback and WicketTester

Hi!

I have the same problem as
http://www.mail-archive.com/users@wicket.apache.org/msg05826.html

Is it solved?

I have a ModalWindow with a "close" button in it, the button's
"onclick" calls modalWindow.close() via AJAX.

My problem is that when I call the onclick via
wicketTester.executeAjaxEvent(button, "onclick") the modalWindow's
windowClosedCallback doesn't fire.. Am I missing something? Or am I
supposed to call it from the testcase?

Many thanks for your time!

**
Martin

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


Re: ModalWindow windowClosedCallback and WicketTester

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
After further investigation... the "break;" is to blame ;) Thera are
multiple behaviors and one must search to execute the proper one...

tester.executeBehavior((AbstractAjaxBehavior) behavior); is fine.

Anyways, probably deserves an RFE?

**
Martin

2009/7/21 Martin Makundi <ma...@koodaripalvelut.com>:
> Here is one workaround I found, but of course a) it should be built-in
> and b) automatic.
>
>  public void executeModalWindoCloseCallback(ModalWindow modalWindow) {
>    for (IBehavior behavior : modalWindow.getBehaviors()) {
>      if (behavior instanceof AbstractDefaultAjaxBehavior) {
>        tester.executeBehavior((AbstractAjaxBehavior) behavior);
>        break;
>      }
>    }
>  }
>
> **
> Martin
>
> 2009/7/21 Martin Makundi <ma...@koodaripalvelut.com>:
>> Hi!
>>
>> I have the same problem as
>> http://www.mail-archive.com/users@wicket.apache.org/msg05826.html
>>
>> Is it solved?
>>
>> I have a ModalWindow with a "close" button in it, the button's
>> "onclick" calls modalWindow.close() via AJAX.
>>
>> My problem is that when I call the onclick via
>> wicketTester.executeAjaxEvent(button, "onclick") the modalWindow's
>> windowClosedCallback doesn't fire.. Am I missing something? Or am I
>> supposed to call it from the testcase?
>>
>> Many thanks for your time!
>>
>> **
>> Martin
>>
>

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


Re: ModalWindow windowClosedCallback and WicketTester

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Nah... have to take that back. This works better but only once:

It works better like this:
    for (IBehavior behavior : modalWindow.getBehaviors()) {
      if (behavior instanceof AbstractDefaultAjaxBehavior) {
        ((AbstractDefaultAjaxBehavior) behavior).onRequest();
        break;
      }
    }

It seems to somehow break the tester flow and the last rendered page
is somehow not up-to-date. Help, pls :)

**
Martin

2009/7/21 Martin Makundi <ma...@koodaripalvelut.com>:
> Here is one workaround I found, but of course a) it should be built-in
> and b) automatic.
>
>  public void executeModalWindoCloseCallback(ModalWindow modalWindow) {
>    for (IBehavior behavior : modalWindow.getBehaviors()) {
>      if (behavior instanceof AbstractDefaultAjaxBehavior) {
>        tester.executeBehavior((AbstractAjaxBehavior) behavior);
>        break;
>      }
>    }
>  }
>
> **
> Martin
>
> 2009/7/21 Martin Makundi <ma...@koodaripalvelut.com>:
>> Hi!
>>
>> I have the same problem as
>> http://www.mail-archive.com/users@wicket.apache.org/msg05826.html
>>
>> Is it solved?
>>
>> I have a ModalWindow with a "close" button in it, the button's
>> "onclick" calls modalWindow.close() via AJAX.
>>
>> My problem is that when I call the onclick via
>> wicketTester.executeAjaxEvent(button, "onclick") the modalWindow's
>> windowClosedCallback doesn't fire.. Am I missing something? Or am I
>> supposed to call it from the testcase?
>>
>> Many thanks for your time!
>>
>> **
>> Martin
>>
>

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


Re: ModalWindow windowClosedCallback and WicketTester

Posted by Martin Makundi <ma...@koodaripalvelut.com>.
Here is one workaround I found, but of course a) it should be built-in
and b) automatic.

  public void executeModalWindoCloseCallback(ModalWindow modalWindow) {
    for (IBehavior behavior : modalWindow.getBehaviors()) {
      if (behavior instanceof AbstractDefaultAjaxBehavior) {
        tester.executeBehavior((AbstractAjaxBehavior) behavior);
        break;
      }
    }
  }

**
Martin

2009/7/21 Martin Makundi <ma...@koodaripalvelut.com>:
> Hi!
>
> I have the same problem as
> http://www.mail-archive.com/users@wicket.apache.org/msg05826.html
>
> Is it solved?
>
> I have a ModalWindow with a "close" button in it, the button's
> "onclick" calls modalWindow.close() via AJAX.
>
> My problem is that when I call the onclick via
> wicketTester.executeAjaxEvent(button, "onclick") the modalWindow's
> windowClosedCallback doesn't fire.. Am I missing something? Or am I
> supposed to call it from the testcase?
>
> Many thanks for your time!
>
> **
> Martin
>

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