Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
Wicket 6.17.0 I have a RadioChoice (in a Form) that has an attached AjaxFormComponentUpdatingBehavior. The onUpdate() method of the Behavior fires an event for other components on the page to update (change visibility depending on user selection in radio choice). Im trying to unit test it

Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Andrea Del Bene
On 30/10/14 21:08, Nick Pratt wrote: Wicket 6.17.0 I have a RadioChoice (in a Form) that has an attached AjaxFormComponentUpdatingBehavior. The onUpdate() method of the Behavior fires an event for other components on the page to update (change visibility depending on user selection in radio

Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Paul Bors
Since you want to test a AjaxFormComponentUpdatingBehav ior and not a standard form component (non-ajax) you don't use formTester.selectRadioChoice( propertyType, 2 ) you have to create the AjaxTarget and etc. See Testing AJAX behaviors section at:

Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
That was a typo - apologies. I'm using a AjaxFormChoiceComponentUpdatingBehavior As for the tester, its the EnhancedFormTester - its a thin wrapper that invokes: formTester.select( path, index ); (where formTester is the Wicket FormTester) On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene

Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
Thanks Paul I read that before posting, and tried a couple of things. Is there anything specific in that section other than: tester.executeAjaxEvent(label, click); If this is what is needed, how do I simulate a click on a specific item from a RadioChoice? Do I set the value using the normal

Re: Unit testing RadioChoice with AjaxFormComponentUpdatingBehavior

2014-10-30 Thread Nick Pratt
I reproduced this in a simple quickstart using this unit test: @Test public void testAjaxEventFired() throws Exception { HomePage homePage = new HomePage( new PageParameters() ); tester.startPage( homePage ); FormTester formTester = tester.newFormTester( form ); formTester.select(

Re: Testing RadioChoice with AjaxFormComponentUpdatingBehavior

2009-08-05 Thread development
Since nobody replied (yet) and I cannot believe that I am the only one having this problem, and I found a way to bypass the problem I wanted to share my solution The executeBehavior method on the WicketTester looks like this. public void executeBehavior(final AbstractAjaxBehavior behavior) {

Testing RadioChoice with AjaxFormComponentUpdatingBehavior

2009-07-31 Thread development
Hi all, I am trying to test the ajax behaviour on a RadioChoice. The RadioChoice has an AjaxFormComponentUpdatingBehavior which show/hide a panel depending on its model value. final Label label = new Label(label, label); label.setOutputMarkupId(true); label.setVisible(false);