On Feb 21, 5:42 pm, FKereki <[email protected]> wrote:
> I'm running some GWTTestCase code, and was wondering... isn't
> button.click() the same as creating a DOM click event and firing it
> for the button?

No, it calls the button's (JavaScript/DOM) click() method.

> I'm testing a View. I added a (mock) method that set variable
> wasCalled to true; I just want to test whether the View correctly
> links the button click with the method. I set wasCalled to false, I
> fire the click event, and I check assertTrue(wasCalled).  My test code
> looks, in part, like:
>
> wasCalled = false;
>
> // doing the following works:
> final Document doc = com.google.gwt.dom.client.Document.get();
> final NativeEvent evt = doc.createClickEvent(0, 0, 0, 0, 0, false,
> false, false, false);
> DomEvent.fireNativeEvent(evt, lv.loginButton);
>
> // doing the following doesn't:
> // lv.loginButton.click();
>
> assertTrue(wasCalled);
>
> If I try to fire the click event with click(), nothing happens. If I
> go the DOM event way, the method fires all right.
>
> What am I missing here?

click() doesn't fire an event, it just executes the "default action":
http://www.w3.org/TR/html5/editing.html#dom-click

-- 
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.

Reply via email to