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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to