@Test public void testSearch() { final String keyword = "keyword"; doNothing().when(view).setTimeout(any(), anyInt()); searchBar.value = keyword; view.search(); verify(view).setTimeout(callback.capture(), eq(500d)); callback.getValue().onInvoke(); verify(presenter).search(keyword); }
void search() { final String currentValue = searchBar.value; setTimeout((type) -> { if (Objects.equals(searchBar.value, currentValue)) { presenter.search(currentValue); } }, 500d); }
DataTypeSearchBarView implements DataTypeSearchBar.View { void search() { final String currentValue = searchBar.value; setTimeout((type) -> { if (Objects.equals(searchBar.value, currentValue)) { presenter.search(currentValue); } }, 500d); } }
DataTypeSearchBarView implements DataTypeSearchBar.View { void search() { final String currentValue = searchBar.value; setTimeout((type) -> { if (Objects.equals(searchBar.value, currentValue)) { presenter.search(currentValue); } }, 500d); } @Inject  DataTypeSearchBarView(final HTMLInputElement searchBar,
                                 final @Named("span") HTMLElement searchIcon,
                                 final HTMLButtonElement closeSearch,
                                 final TranslationService translationService); }
DataTypeSearchBarView implements DataTypeSearchBar.View { void search() { final String currentValue = searchBar.value; setTimeout((type) -> { if (Objects.equals(searchBar.value, currentValue)) { presenter.search(currentValue); } }, 500d); } @Inject  DataTypeSearchBarView(final HTMLInputElement searchBar,
                                 final @Named("span") HTMLElement searchIcon,
                                 final HTMLButtonElement closeSearch,
                                 final TranslationService translationService); @PostConstruct void setupSearchBar(); @Override void init(final DataTypeSearchBar presenter); @EventHandler("close-search") void onSearchBarCloseButton(final ClickEvent e); @EventHandler("search-bar") void onSearchBarKeyUpEvent(final KeyUpEvent event); @EventHandler("search-bar") void onSearchBarKeyDownEvent(final KeyDownEvent e); @EventHandler("search-bar") void onSearchBarChangeEvent(final ChangeEvent e); @Override void resetSearchBar(); @Override void showSearchResults(final List<DataType> results); void refreshItemsPosition(); }
DataTypeSearchBarView implements DataTypeSearchBar.View { void search() { final String currentValue = searchBar.value; setTimeout((type) -> { if (Objects.equals(searchBar.value, currentValue)) { presenter.search(currentValue); } }, 500d); } @Inject  DataTypeSearchBarView(final HTMLInputElement searchBar,
                                 final @Named("span") HTMLElement searchIcon,
                                 final HTMLButtonElement closeSearch,
                                 final TranslationService translationService); @PostConstruct void setupSearchBar(); @Override void init(final DataTypeSearchBar presenter); @EventHandler("close-search") void onSearchBarCloseButton(final ClickEvent e); @EventHandler("search-bar") void onSearchBarKeyUpEvent(final KeyUpEvent event); @EventHandler("search-bar") void onSearchBarKeyDownEvent(final KeyDownEvent e); @EventHandler("search-bar") void onSearchBarChangeEvent(final ChangeEvent e); @Override void resetSearchBar(); @Override void showSearchResults(final List<DataType> results); void refreshItemsPosition();  }