use of com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay in project gwt-test-utils by gwt-test-utils.
the class WidgetUtils method getMenuItems.
public static List<MenuItem> getMenuItems(SuggestBox suggestBox) {
SuggestionDisplay display = GwtReflectionUtils.getPrivateFieldValue(suggestBox, "display");
MenuBar suggestionMenu = GwtReflectionUtils.getPrivateFieldValue(display, "suggestionMenu");
return getMenuItems(suggestionMenu);
}
use of com.google.gwt.user.client.ui.SuggestBox.SuggestionDisplay in project gwt-test-utils by gwt-test-utils.
the class WidgetUtilsTest method suggestBoxItems.
@Test
public void suggestBoxItems() {
// Given
SuggestBox box = new SuggestBox();
SuggestionDisplay display = GwtReflectionUtils.getPrivateFieldValue(box, "display");
MenuBar bar = GwtReflectionUtils.getPrivateFieldValue(display, "suggestionMenu");
Command cmd = new Command() {
public void execute() {
}
};
MenuItem item0 = bar.addItem("item0", cmd);
MenuItem item1 = bar.addItem("item1", cmd);
// When
List<MenuItem> items = WidgetUtils.getMenuItems(box);
// Then
assertThat(items).hasSize(2);
assertThat(items.get(0)).isEqualTo(item0);
assertThat(items.get(1)).isEqualTo(item1);
}
Aggregations