And boom! Thanks for the inspiration Frank!
final WicketTester wc = constructBasicPanel();
wc.debugComponentTrees();
wc.dumpPage();
// delicious is the constructed panel, which contains a AjaxLazyLoadPanel...
// visit it's children, looking for the AjaxLazyLoadPanel
delicious.visitChildren( AjaxLazyLoadPanel.class, new
IVisitor<AjaxLazyLoadPanel>(){
@Override
public Object component(AjaxLazyLoadPanel component) {
// get the AbstractAjaxBehaviour which is responsible for getting the
contents of the lazy panel
List<IBehavior> behaviors = component.getBehaviors();
final AbstractAjaxBehavior b;
b = (AbstractAjaxBehavior) behaviors.get( 0 );
// tell wicket tester to execute it :)
wc.executeBehavior( b );
// continue with visitation rights, or not, i don't care
return null;
}} );
wc.debugComponentTrees();
wc.dumpPage();
// and volah, your lazy panel is now replaced with the contents :)
wc.assertComponent(
"panel:lazy:content:repeaterContainer:bookmarks:1", Item.class );
wc.assertInvisible( "panel:lazy:content:noBookmarks" );
Let me know what you think or if you have any improvements!
Antony Stubbs wrote:
>
> Thanks for the info Frank. Any tips on how to do so?
>
>
> Frank Bille wrote:
>>
>> On Thu, Apr 24, 2008 at 8:10 PM, qk <[email protected]> wrote:
>>> 1. after the page was rendered using WicketTester.startPage(), the
>>> "real"
>>> content (the one that returned by getLazyLoadComponent()) was not
>>> loaded by
>>> default. I always got an empty panel. Is there a way that I can have
>>> the
>>> "real" content rendered?
>>
>> Wicket tester doesn't parse javascript, so it can't execute the ajax
>> callback. You have to do that yourself.
>>
>> Frank
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>>
>
>
-----
___________________________
http://stubbisms.wordpress.com http://stubbisms.wordpress.com
--
View this message in context:
http://www.nabble.com/unit-test-of-AjaxLazyLoadPanel-and-ModalWindow-tp16851306p23773322.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]