PDA

View Full Version : Howto unit test widgets?



KaiWeing
9 Aug 2010, 8:24 AM
Hello,

I built a composite field based on a MultiField and want to write a unit test for it.

I am using GWTTestCase, so the JS environment is available.

However, many interactions (like setting rawValue) with the field have not effect, since it's base class attribute 'rendered' is false. According to the javadoc, this is because it is never rendered. Now I need a tip how to initiate rendering in a test case.

Is there a best practice to set up a rendered component in a unit test?

Thanks in advance!
Kai

sven
9 Aug 2010, 8:25 AM
RootPanel.get().add(mywidget);

KaiWeing
9 Aug 2010, 8:33 AM
That's it, so easy...

Thank you!