use of com.google.gwt.user.client.ui.FormPanel.SubmitHandler in project gwt-test-utils by gwt-test-utils.
the class BrowserTest method submit.
@Test()
public void submit() {
// Given
final StringBuilder sb = new StringBuilder();
FormPanel form = new FormPanel();
form.addSubmitHandler(new SubmitHandler() {
public void onSubmit(SubmitEvent event) {
sb.append("onSubmit");
}
});
form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
public void onSubmitComplete(SubmitCompleteEvent event) {
sb.append(" complete : ").append(event.getResults());
}
});
// Attach to the DOM
RootPanel.get().add(form);
// Given
Browser.submit(form, "mock result");
// Then
assertThat(sb.toString()).isEqualTo("onSubmit complete : mock result");
}
use of com.google.gwt.user.client.ui.FormPanel.SubmitHandler in project gwt-test-utils by gwt-test-utils.
the class BrowserTest method submitThrowsErrorIfNotAttached.
@Test(expected = AssertionError.class)
public void submitThrowsErrorIfNotAttached() {
// Given
final StringBuilder sb = new StringBuilder();
FormPanel form = new FormPanel();
form.addSubmitHandler(new SubmitHandler() {
public void onSubmit(SubmitEvent event) {
sb.append("onSubmit");
}
});
form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
public void onSubmitComplete(SubmitCompleteEvent event) {
sb.append(" complete : ").append(event.getResults());
}
});
// When
Browser.submit(form, "mock result");
}
Aggregations