You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by "alexander.elsholz" <al...@widas.de> on 2009/03/17 16:51:51 UTC
wicket tests enabled
hi,
what's the best way to test enabling/disabling of components? i tried:
assertFalse(tester.getComponentFromLastRenderedPage(PATH_XYZ).isEnabled());
and it seems work.
is it the right way to test java-changed-attributes?
thanks alex
--
View this message in context: http://www.nabble.com/wicket-tests-enabled-tp22562247p22562247.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: wicket tests enabled
Posted by Timo Rantalaiho <Ti...@ri.fi>.
On Tue, 17 Mar 2009, alexander.elsholz wrote:
> what's the best way to test enabling/disabling of components? i tried:
> assertFalse(tester.getComponentFromLastRenderedPage(PATH_XYZ).isEnabled());
>
> and it seems work.
>
> is it the right way to test java-changed-attributes?
Yes, the only problem is that if PATH_XYZ is very long, it
might break too easily if the component tree changes.
Then you can do something like
FooComponent foo = (FooComponent) tester.getLastRenderedPage().visitChildren(
FooComponent.class, new IVisitor<FooComponent>() {
@Override
public Object component(FooComponent component) {
return component;
}
});
assertFalse(foo.isEnabled());
or with jdave-wicket
FooComponent foo = selectFirst(Foo.class).from(tester.getLastRenderedPage());
assertFalse(foo.isEnabled());
Best wishes,
Timo
--
Timo Rantalaiho
Reaktor Innovations Oy <URL: http://www.ri.fi/ >
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org