On 9/12/07, pokkie <[EMAIL PROTECTED]> wrote:
>
> I am trying to write a test case for my listView that contains some links.
> When the user clicks on
> a link, a certain action should be performed, and it is for this action that
> I wish to write a test case for.
>
> I can get a handle on the ListView by using the
> wicketTester.getLastRenderedPage().get("pathToListView");,
> but the problem then is that the listView isn't populated. I thought about
> extracting the above method call,
> into a variable, so that the listView is returned, i.e.
>
> ----
> MyListView listView =
> (MyListView)wicketTester.getLastRenderedPage().get("pathToListView");
>
> // Populate the listView with a model object so that it will populate the
> ListView
> listView.setModelObject(new ModelObject());
>
> // Create a new ListItem so that the listView can be populated
> ListItem listItem = new ListItem(0, listView.getModel());
>
> // Populate the listView with the listItem
> listView.populateItem(listItem);
>
> // Execute ajax event
> wicketTester.executeAjaxEvent("pathToLinkOnListView","onclick");Why isn't it populated though? I don't use WicketTester much, but I would expect the lastRendered page to have the listview intact as it rendered. Only when it starts a new render are items removed. For which btw you can also use setReuseItems(true). Eelco --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
