Search in sources :

Example 6 with TextBox

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);
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 7 with TextBox

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);
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 8 with TextBox

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");
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 9 with TextBox

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);
}
Also used : KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) ArrayList(java.util.ArrayList) TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Example 10 with TextBox

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");
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) Test(org.junit.Test)

Aggregations

TextBox (com.google.gwt.user.client.ui.TextBox)31 Test (org.junit.Test)10 Label (com.google.gwt.user.client.ui.Label)9 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)7 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)6 Grid (com.google.gwt.user.client.ui.Grid)4 HashMap (java.util.HashMap)3 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)2 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)2 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)2 KeyPressHandler (com.google.gwt.event.dom.client.KeyPressHandler)2 CheckBox (com.google.gwt.user.client.ui.CheckBox)2 FlexTable (com.google.gwt.user.client.ui.FlexTable)2 HTML (com.google.gwt.user.client.ui.HTML)2 AttributeDefinition (cz.metacentrum.perun.webgui.model.AttributeDefinition)2 ThemedButton (org.rstudio.core.client.widget.ThemedButton)2 StringListPanel (com.google.gerrit.client.StringListPanel)1 AccessMap (com.google.gerrit.client.access.AccessMap)1