On 2 sep, 19:55, dhroth <[EMAIL PROTECTED]> wrote:
> I have a JavaScript widget library that I am wrapping as GWT widgets.
> Some of the widget's JavaScript functions can only be called after the
> widget is attached, so if they are called during the application
> onModuleLoad, we are issuing a deferred command so that the method
> will be called again after the widget is attached. This works well
> when running the application.
>
> However, I want to have some JUnit tests that can test the result of
> the deferred command and I have not been able to come up with a way to
> do that. I have tried adding the widget to the RootPanel, but the
> widget's onLoad method is not called.
>
> For example, I tried the following in a GWT JUnit test:
> CustomWidget testWidget = new CustomWidget();
> testWidget.jsMethodWrapper(); //This causes a deferred command to be
> created.
> RootPanel.get().add(testWidget);
> assertTrue(...); //This tests the result of the deferred command
>
> Is there a way to force deferred commands to run so that their results
> can be tested within a JUnit test?
First, switch your test to "async mode" using delayTestFinish(); then
move your assertTrue() within a timer or another DeferredCommand
(pending deferred command are "concatenated" altogether unless you
addPause() in between)
http://google-web-toolkit.googlecode.com/svn/javadoc/1.5/com/google/gwt/junit/client/GWTTestCase.html#delayTestFinish(int)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---