use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method stylePrimaryNameEqualsWithAsAndCustomAssertionErrorMessage.
@Test
public void stylePrimaryNameEqualsWithAsAndCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setStylePrimaryName("primary");
a.addStyleName("second");
// When
try {
assertThat(a).as("my anchor").overridingErrorMessage("my custom error").stylePrimaryNameEquals("not-my-style");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[my anchor stylePrimaryName] my custom error");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class StackPanelTest method click.
@Test
public void click() {
// Given
index = -1;
StackPanel panel = new StackPanel() {
@Override
public void showStack(int index) {
StackPanelTest.this.index = index;
}
};
panel.add(new Anchor());
panel.add(new Anchor());
// When
Browser.click(panel, 1);
// Then
assertThat(index).isEqualTo(1);
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method isNotVisible.
@Test
public void isNotVisible() {
// Given
Anchor a = new Anchor();
a.setVisible(false);
// When & Then
try {
GwtAssertions.assertThat(a).isNotVisible();
} catch (AssertionError e) {
fail("assertion should pass but failed with message : " + e.getMessage());
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method titleEqualsWithCustomAssertionErrorMessage.
@Test
public void titleEqualsWithCustomAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setTitle("Lost 108");
// When
try {
GwtAssertions.assertThat(a).overridingErrorMessage("custom error message").titleEquals("John Locke");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[Anchor's title] custom error message");
}
}
use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.
the class WidgetAssertTest method styleNameEqualsWithAsAssertionErrorMessage.
@Test
public void styleNameEqualsWithAsAssertionErrorMessage() {
// Given
Anchor a = new Anchor();
a.setStyleName("first");
a.addStyleName("second");
// When
try {
assertThat(a).as("my anchor").styleNameEquals("not-my-style");
fail("AssertionError should be thrown");
} catch (AssertionError e) {
// Then
assertThat(e.getMessage()).isEqualTo("[my anchor styleName] expected:<\"[not-my-style]\"> but was:<\"[first second]\">");
}
}
Aggregations