You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Schwame <js...@citytechinc.com> on 2009/04/29 22:41:59 UTC
Re: How to test AjaxFormChoiceComponentUpdatingBehavior for Radio
Button
I have the same question as the below reader. I scoured the mailing lists,
wiki and the javadoc. I have attached a quick-start application that shows
the problem. When I run the application the
AjaxFormChoiceComponentUpdatingBehavior works as expected! However, when I
run the unit test and use the tester.executeBehavior method to call the
AjaxFormChoiceComponentUpdatingBehavior, the model is always null. A
snippet of my unit test is below:
FormTester form = tester.newFormTester("form");
System.out.println("form.modelObject=" +
form.getForm().getModelObject());
form.select("radioButtons", 1);
form.submit();
System.out.println("form.modelObject=" +
form.getForm().getModelObject());
Component comp = form.getForm().get("radioButtons");
List<IBehavior> behaviors = comp.getBehaviors();
for (IBehavior i: behaviors) {
if (i instanceof AjaxFormChoiceComponentUpdatingBehavior) {
AjaxFormChoiceComponentUpdatingBehavior a =
(AjaxFormChoiceComponentUpdatingBehavior)i;
//executes the behavior, but clears the object's model
tester.executeBehavior(a);
}
}
Any suggestions would be very helpful.
I am using wicket 1.4-rc2.
Thanks in advance.
-Jeff
http://www.nabble.com/file/p23302320/FormQuestion.zip FormQuestion.zip
techisbest wrote:
>
> I have a RadioGroup with two Radio buttons inside a Form in a Panel. I
> have created an AjaxFormChoiceComponentUpdatingBehavior that has been
> added to the RadioGroup. This behavior is working fine and I am able to
> update my Session with the new values when the user switches between the
> Radio buttons.
>
> I am having difficulty creating a Wicket test for this behavior. I can
> not seem to invoke the behavior when selecting a new button via the
> FormTester for the panel containing the form. I saw one thread here that
> suggested (by the user asking the original question) using
> tester.getLastRenderedPage().getBehaviors() to get at the behavior I want
> to execute via tester.executeBehavior. But the getBehaviors method is
> returning an empty list.
>
> Can someone please tell me how to test this behavior?
>
--
View this message in context: http://www.nabble.com/How-to-test-AjaxFormChoiceComponentUpdatingBehavior-for-Radio-Button-tp21833782p23302320.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org