Search in sources :

Example 26 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project gwt-test-utils by gwt-test-utils.

the class RadioButtonTest method text.

@Test
public void text() {
    // Given
    RadioButton rb = new RadioButton("myRadioGroup", "foo");
    // Preconditions
    assertThat(rb.getText()).isEqualTo("foo");
    // When
    rb.setText("text");
    // Then
    assertThat(rb.getText()).isEqualTo("text");
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) Test(org.junit.Test)

Example 27 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project gwt-test-utils by gwt-test-utils.

the class RadioButtonTest method clickNotDetachedRadioButton.

@Test
public void clickNotDetachedRadioButton() {
    // Given
    RadioButton rb0 = new RadioButton("myRadioGroup", "foo");
    MockValueChangeHandler<Boolean> rb0MockChangeHandler = new MockValueChangeHandler<Boolean>();
    rb0.addValueChangeHandler(rb0MockChangeHandler);
    RadioButton rb1 = new RadioButton("myRadioGroup", "bar");
    MockValueChangeHandler<Boolean> rb1MockChangeHandler = new MockValueChangeHandler<Boolean>();
    rb1.addValueChangeHandler(rb1MockChangeHandler);
    // When
    Browser.click(rb0);
    Browser.click(rb1);
    // Then
    assertThat(rb0.getValue()).isTrue();
    assertThat(rb0MockChangeHandler.getCallCount()).isEqualTo(1);
    assertThat(rb1.getValue()).isTrue();
    assertThat(rb1MockChangeHandler.getCallCount()).isEqualTo(1);
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) MockValueChangeHandler(com.googlecode.gwt.MockValueChangeHandler) Test(org.junit.Test)

Example 28 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project gwt-test-utils by gwt-test-utils.

the class RadioButtonTest method html.

@Test
public void html() {
    // Given
    RadioButton rb = new RadioButton("myRadioGroup", "<h1>foo</h1>", true);
    // Preconditions
    assertThat(rb.getHTML()).isEqualTo("<h1>foo</h1>");
    // When
    rb.setHTML("<h1>test</h1>");
    // Then
    assertThat(rb.getHTML()).isEqualTo("<h1>test</h1>");
    assertThat(rb.getElement().getChild(1).getChildCount()).isEqualTo(1);
    HeadingElement h1 = rb.getElement().getChild(1).getChild(0).cast();
    assertThat(h1.getTagName()).isEqualTo("H1");
    assertThat(h1.getInnerText()).isEqualTo("test");
}
Also used : HeadingElement(com.google.gwt.dom.client.HeadingElement) RadioButton(com.google.gwt.user.client.ui.RadioButton) Test(org.junit.Test)

Example 29 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project gwt-test-utils by gwt-test-utils.

the class RadioButtonTest method changeName.

@Test
public void changeName() {
    // Given
    RadioButton rb0 = new RadioButton("myRadioGroup", "foo");
    RootPanel.get().add(rb0);
    MockValueChangeHandler<Boolean> rb0MockChangeHandler = new MockValueChangeHandler<Boolean>();
    rb0.addValueChangeHandler(rb0MockChangeHandler);
    RadioButton rb1 = new RadioButton("myRadioGroup", "bar");
    RootPanel.get().add(rb1);
    MockValueChangeHandler<Boolean> rb1MockChangeHandler = new MockValueChangeHandler<Boolean>();
    rb1.addValueChangeHandler(rb1MockChangeHandler);
    // When 1
    rb0.setName("changedGroup");
    Browser.click(rb0);
    // Then 1
    assertThat(rb0.getValue()).isTrue();
    assertThat(rb0MockChangeHandler.getCallCount()).isEqualTo(1);
    // When 2
    rb1.setName("changedGroup");
    Browser.click(rb1);
    assertThat(rb0.getValue()).isFalse();
    assertThat(rb0MockChangeHandler.getCallCount()).isEqualTo(2);
    assertThat(rb0MockChangeHandler.getLast()).isFalse();
    assertThat(rb1.getValue()).isTrue();
    assertThat(rb1MockChangeHandler.getCallCount()).isEqualTo(1);
    assertThat(rb1MockChangeHandler.getLast()).isTrue();
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) MockValueChangeHandler(com.googlecode.gwt.MockValueChangeHandler) Test(org.junit.Test)

Example 30 with RadioButton

use of com.google.gwt.user.client.ui.RadioButton in project gwt-test-utils by gwt-test-utils.

the class RadioButtonTest method visible.

@Test
public void visible() {
    // Given
    RadioButton rb = new RadioButton("myRadioGroup", "foo");
    // Preconditions
    assertThat(rb.isVisible()).isEqualTo(true);
    // When
    rb.setVisible(false);
    // Then
    assertThat(rb.isVisible()).isEqualTo(false);
}
Also used : RadioButton(com.google.gwt.user.client.ui.RadioButton) Test(org.junit.Test)

Aggregations

RadioButton (com.google.gwt.user.client.ui.RadioButton)31 Test (org.junit.Test)11 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)4 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)4 Label (com.google.gwt.user.client.ui.Label)4 Widget (com.google.gwt.user.client.ui.Widget)4 MockValueChangeHandler (com.googlecode.gwt.MockValueChangeHandler)4 InputElement (com.google.gwt.dom.client.InputElement)3 Element (com.google.gwt.dom.client.Element)2 SafeHtmlBuilder (com.google.gwt.safehtml.shared.SafeHtmlBuilder)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 EntityModelCheckBoxEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelCheckBoxEditor)2 EntityModelRadioButtonEditor (org.ovirt.engine.ui.common.widget.editor.generic.EntityModelRadioButtonEditor)2 StringEntityModelTextAreaLabelEditor (org.ovirt.engine.ui.common.widget.editor.generic.StringEntityModelTextAreaLabelEditor)2 AgreementInfo (com.google.gerrit.client.info.AgreementInfo)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 HeadingElement (com.google.gwt.dom.client.HeadingElement)1 Node (com.google.gwt.dom.client.Node)1