I see what happens.
Since DropDownChoice wants to be notified when the selection change it
submits the new value as soon as formTester#select() is called.
FormTester#submit() submits with empty request parameters (because the new
value for the DDC is already submitted) and thus the check for required
fails.

You can use formTester.setValue("dropdown", "0"); instead of
#select(String, int) to avoid the call of #selectionChanged() callback.


On Thu, Jan 17, 2013 at 3:12 AM, RalfButler <ralf.but...@web.de> wrote:

> Yes, indeed, it looks similar, except that I receive the same error
> messages
> as before if the requirement of dropdown is set to true in
> MockPageWithForm:
> dropDown.setRequired(true);
>
> and add assertNoErrorMessage to FormDispatchEventTest#dropDownEvent():
> ...
> FormTester formTester = tester.newFormTester("form");
> formTester.select("dropdown", 0);
> formTester.submit();
>
> // new entry which checks for any error message
> tester.assertNoErrorMessage();
>
> MockPageWithForm page = (MockPageWithForm)tester.getLastRenderedPage();
> ...
>
> I'm a bit puzzled why that is and would appreciate any help you can give.
>
> Thanks,
> Ralf
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Testing-DropDownChoice-with-Ajax-tp4655418p4655437.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>


-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com <http://jweekend.com/>

Reply via email to