use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.
the class TextBoxTest method getCursorPos.
@Test
public void getCursorPos() {
// Given
TextBox t = new TextBox();
t.setText("myText");
GwtReflectionUtils.setPrivateFieldValue(t, "attached", true);
// When
t.setCursorPos(2);
// Then
assertThat(t.getCursorPos()).isEqualTo(2);
}
use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.
the class TextBoxTest method visible.
@Test
public void visible() {
// Given
TextBox t = new TextBox();
// Preconditions
assertThat(t.isVisible()).isEqualTo(true);
// When
t.setVisible(false);
// Then
assertThat(t.isVisible()).isEqualTo(false);
}
use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.
the class TextBoxTest method text.
@Test
public void text() {
// Given
TextBox t = new TextBox();
// Preconditions
assertThat(t.getText()).isEqualTo("");
// When
t.setText("text");
// Then
assertThat(t.getText()).isEqualTo("text");
}
use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.
the class TextBoxTest method pressKey.
@Test
public void pressKey() {
// Given
final List<KeyPressEventData> events = new ArrayList<KeyPressEventData>();
TextBox tb = new TextBox();
tb.addKeyPressHandler(new KeyPressHandler() {
public void onKeyPress(KeyPressEvent event) {
KeyPressEventData data = new KeyPressEventData();
data.keyCode = event.getNativeEvent().getKeyCode();
data.charCode = event.getCharCode();
events.add(data);
}
});
// When
Browser.fillText(tb, "gael");
// Then
assertThat(tb.getValue()).isEqualTo("gael");
assertThat(events).hasSize(4);
assertThat(events.get(0).charCode).isEqualTo('g');
assertThat(events.get(0).keyCode).isEqualTo(103);
assertThat(events.get(1).charCode).isEqualTo('a');
assertThat(events.get(1).keyCode).isEqualTo(97);
assertThat(events.get(2).charCode).isEqualTo('e');
assertThat(events.get(2).keyCode).isEqualTo(101);
assertThat(events.get(3).charCode).isEqualTo('l');
assertThat(events.get(3).keyCode).isEqualTo(108);
}
use of com.google.gwt.user.client.ui.TextBox in project gwt-test-utils by gwt-test-utils.
the class TextBoxTest method title.
@Test
public void title() {
// Given
TextBox t = new TextBox();
// Preconditions
assertThat(t.getTitle()).isEqualTo("");
// When
t.setTitle("title");
// Then
assertThat(t.getTitle()).isEqualTo("title");
}
Aggregations