Your page code is almost exactly the same as mine. However, your HTML does
not look correct - it has no tag with a wicket:id in it. So maybe your
component never rendered.

I still get an exception using Wicket 1.3.0-beta3.

You say "After startPage() returns, the page has been detached". Evidently
this is not true in 1.3.0beta3 because my first assertion "assertTrue(
childModel.isAttached())" succeeds (it is attached), which would indicate
that the child model was never detached. If the Page had been detached, the
child component and its model should have been as well. ... Which is the
whole point of this thread.

On 10/5/07, Kent Tong <[EMAIL PROTECTED]> wrote:
>
>
>
> Dan Syrstad-2 wrote:
> >
> > Actually, Page.detach() is not callable from a JUnit test that uses
> > WicketTester in 1.3.0beta3. It throws an exception:
> >
>
> I used your code and the test passed. Here is my test page:
>
>
> <html>
> <body>
> test
> </body>
> </html>
> public class Test extends WebPage {
>         public Test() {
>                 ListView listView = new ListView("listView", Arrays
>                                 .asList(new String[] { "a", "b" })) {
>
>                         protected void populateItem(final ListItem item) {
>                                 item.add(new
> Label("labelWithDetachableModel", new
> LoadableDetachableModel() {
>                                         protected Object load() {
>                                                 return item.getModelObject
> ();
>                                         }
>                                 }));
>                         }
>
>                 };
>                 add(listView);
>         }
> }
>
>
> However, I really think your test case is broken. After startPage()
> returns,
> the page has been detached. Why it passes on my computer is because
> of your call to debugComponentTrees(). Therefore, you should really be
> testing if the model is now detached. That's it. By checking the output
> you can be sure that the model was once attached.
>
> --
> Kent Tong
> Wicket tutorials freely available at http://www.agileskills2.org/EWDW
> --
> View this message in context:
> http://www.nabble.com/Page.detachModels%28%29-not-working-like-it-used-to-tf4549247.html#a13057290
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to