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");
}
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);
}
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");
}
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();
}
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);
}
Aggregations