You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by James McLaughlin <jo...@gmail.com> on 2007/09/07 03:59:37 UTC
WicketTester, FormTester, and AjaxSubmitLink
Hi,
Hacking away at some tests, I figured the proper way to test an
AjaxSubmitLink would have been as follows:
Panel p = tester.startPanel(EventPanel.class);
FormTester ft = tester.newFormTester(p.getId() + ":eventForm");
ft.setValue("messageField", ALARM_MESSAGE);
tester.clickLink(p.getId() + ":eventFormSubmitLink", true);
However, the values set in the FormTester don't get submitted for some
reason. It works if I change it to:
Panel p = tester.startPanel(EventPanel.class);
tester.setParameterForNextRequest(p.getId() +
":eventForm:messageField", ALARM_MESSAGE);
tester.clickLink(p.getId() + ":eventFormSubmitLink", true);
which while 1 line briefer, didn't seem intuitive (to me at least). Is
it possible to make it work like the former, or is it better left as
it is?
best,
jim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: WicketTester, FormTester, and AjaxSubmitLink
Posted by Jean-Baptiste Quenot <jb...@apache.org>.
* James McLaughlin:
> Hi,
> Hacking away at some tests, I figured the proper way to test an
> AjaxSubmitLink would have been as follows:
>
> Panel p = tester.startPanel(EventPanel.class);
> FormTester ft = tester.newFormTester(p.getId() + ":eventForm");
> ft.setValue("messageField", ALARM_MESSAGE);
> tester.clickLink(p.getId() + ":eventFormSubmitLink", true);
>
> However, the values set in the FormTester don't get submitted for some
> reason. It works if I change it to:
>
> Panel p = tester.startPanel(EventPanel.class);
> tester.setParameterForNextRequest(p.getId() +
> ":eventForm:messageField", ALARM_MESSAGE);
> tester.clickLink(p.getId() + ":eventFormSubmitLink", true);
>
> which while 1 line briefer, didn't seem intuitive (to me at least). Is
> it possible to make it work like the former, or is it better left as
> it is?
Is it WICKET-932?
--
Jean-Baptiste Quenot
aka John Banana Qwerty
http://caraldi.com/jbq/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org