Closed GoogleCodeExporter closed 9 years ago
For general questions about gwt-test-utils, please join the user-group :
http://groups.google.com/group/gwt-test-utils-users
I'm not sure I've understand your question, but you can use
EventBus.fireEvent..
methods to trigger custom event (GwtEvent sublcasses) just like you'll do
without gwt-test-utils.
The gwt-test-utils Browser class just provide some way to do it easily for
DomEvent (also a subclass of GwtEvent).
Original comment by gael.laz...@gmail.com
on 16 Nov 2011 at 1:27
I jest need to fire custom event that I created by extending GwtEvent<>.But
in DomEvent support for fire native events.
ex:-
EVENT
public class AddNewPropertyEvent extends
GwtEvent<AddNewPropertyEventHandler>
{
public static Type<AddNewPropertyEventHandler> TYPE = new
Type<AddNewPropertyEventHandler>();
public AddNewPropertyEvent()
{
super();
}
@Override
public
com.google.gwt.event.shared.GwtEvent.Type<AddNewPropertyEventHandler>
getAssociatedType()
{
return TYPE;
}
@Override
protected void dispatch( AddNewPropertyEventHandler handler )
{
handler.loadNewProperty( this );
}
}
EVENT HANDLER
import com.google.gwt.event.shared.EventHandler;
/**
* @author janith
* @date Nov 16, 2011
*/
public interface AddNewPropertyEventHandler extends EventHandler
{
void loadNewProperty( AddNewPropertyEvent addNewPropertyEvent );
}
Fire event onclick event of button contain on some other panel.
Could I use DomEvent.fireNativeEvent( nativeEvent, handlerSource ) to test
this.
Original comment by e06w...@gmail.com
on 16 Nov 2011 at 2:10
Custom events are never triggered by DomEvent.fireEvent(..), but with a
HandlerManager instance (handlerManager.fireEvent).
If you're not familiar with custom events, this tutorial is very comprehensive
: http://davidmaddison.blogspot.com/2010/02/using-gwt-2-custom-events.html
Original comment by gael.laz...@gmail.com
on 16 Nov 2011 at 3:30
Can I write unit test for where event is handling.
ex :-
above custom event is handling on another class called activity class.
// Update Rate allocation view UI according to the selected rate plans.
tabEventBus.addHandler( TickerpanelEvent.TYPE, new TickerPanelEventHandler()
{
@Override
public void applyTickerPanelChanges( TickerpanelEvent tickerpanelEvent )
{
//do some ui changes and load page again
}
} );
It update some of UI on my event firing webpage.
Can I test it on this stage or do I need to write another test case to my
activity class.
Original comment by e06w...@gmail.com
on 17 Nov 2011 at 5:27
Yes you can, gwt-test-utils has been designed for that. Just instanciate your
component which is in charge of the instanciation of both your Activity class
and your tabEventBus (and whatever other involved class) and one only unit
tests will be fine.
So I would say it will depend on your test strategy : do you want to write
"real unit tests" (= 1 unit test class for one class) or do you want to write
"UI-Component tests" (one unit test for one custom widget, which can includes a
lot of sub-component, like eventbus, activities, child widgets, etc).
I personally think UI-Component tests are a good option
Original comment by gael.laz...@gmail.com
on 17 Nov 2011 at 6:42
Thanks I tested for existence of UI component.It works fine.But I couldn't
test for css properties.Are there any specific way to do that.I'm designing
my UI component using gwt css recourse file.
Original comment by e06w...@gmail.com
on 17 Nov 2011 at 4:11
Hi, sorry for the late answer... Could you be more specific on what you'd like
to test on css properties ? Do you have some code to illustrate your needs ?
Original comment by gael.laz...@gmail.com
on 24 Nov 2011 at 1:56
Original comment by gael.laz...@gmail.com
on 13 Dec 2011 at 7:08
Original issue reported on code.google.com by
e06w...@gmail.com
on 16 Nov 2011 at 1:08