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 formTester methods and then fire a generic click event? On Thu, Oct 30, 2014 at 4:31 PM, Paul Bors <p...@bors.ws> wrote: > 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: > http://wicket.apache.org/guide/guide/testing.html > > On Thu, Oct 30, 2014 at 4:27 PM, Andrea Del Bene <an.delb...@gmail.com> > wrote: > > > 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 choice). > >> > >> Im trying to unit test it using: > >> > >> formTester.selectRadioChoice( "propertyType", 2 ); > >> > > I guess that's a typo :) or are you using a custom formTester? > > > >> > >> and then I'm trying to trigger the behavior to fire so that I can > >> check that the various components are visible/invisible: > >> > >> Component component = baseTester.getComponentFromLastRenderedPage( > >> "form:propertyType" ); > >> for ( Behavior b : component.getBehaviors() ) > >> { > >> if ( b instanceof AjaxFormComponentUpdatingBehavior ) > >> { > >> baseTester.executeBehavior( (AbstractAjaxBehavior) b ); > >> } > >> } > >> > >> However, I'm running in to this when the behavior is executed: > >> > >> org.apache.wicket.core.request.handler.ListenerInvocationNotAllowedEx > >> ception: > >> Behavior rejected interface invocation. > >> > >> Is it possible to unit test this specific behavior, and am I going > >> about this the right way? > >> > >> I've verified that the application works as expected in a browser. > >> > > BTW, multiple-choice component should use > AjaxFormChoiceComponentUpdatingBehavior > > instead of AjaxFormComponentUpdatingBehavior. > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > >