本文整理汇总了Java中com.google.gwt.event.dom.client.ClickHandler.onClick方法的典型用法代码示例。如果您正苦于以下问题:Java ClickHandler.onClick方法的具体用法?Java ClickHandler.onClick怎么用?Java ClickHandler.onClick使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.event.dom.client.ClickHandler
的用法示例。
在下文中一共展示了ClickHandler.onClick方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: shouldCallPlayOrStopDescriptionOnPlayButtonClick
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldCallPlayOrStopDescriptionOnPlayButtonClick() {
// given
String file = "test.mp3";
Entry entry = mock(Entry.class);
when(entry.getEntryExampleSound()).thenReturn(file);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
clickHandler = (ClickHandler) invocation.getArguments()[0];
return null;
}
}).when(explanationView).addPlayButtonHandler(any(ClickHandler.class));
// when
testObj.init();
testObj.processEntry(entry);
clickHandler.onClick(null);
// then
verify(explanationDescriptionSoundController).playOrStopExplanationSound(entry.getEntryExampleSound());
}
示例2: shouldCallPlayOrStopEntryOnPlayButtonClick
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldCallPlayOrStopEntryOnPlayButtonClick() {
// given
String file = "test.mp3";
Entry entry = mock(Entry.class);
when(entry.getEntrySound()).thenReturn(file);
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) {
clickHandler = (ClickHandler) invocation.getArguments()[0];
return null;
}
}).when(explanationView).addEntryPlayButtonHandler(any(ClickHandler.class));
// when
testObj.init();
testObj.processEntry(entry);
clickHandler.onClick(null);
// then
verify(entryDescriptionSoundController).playOrStopEntrySound(entry.getEntrySound());
}
示例3: shouldHideFeedback
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldHideFeedback() {
//given
Element element = mock(Element.class);
testObj.initModule(element);
verify(feedbackPresenter).addCloseButtonClickHandler(clickHandlerCaptor.capture());
ClickHandler clickHandler = clickHandlerCaptor.getValue();
ClickEvent clickEvent = mock(ClickEvent.class);
//when
clickHandler.onClick(clickEvent);
//then
verify(feedbackPresenter, times(2)).hideFeedback();
verify(feedbackBlend, times(2)).hide();
}
示例4: shouldOpenURl
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldOpenURl() {
// given
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
clickHandler = (ClickHandler) invocation.getArguments()[0];
return null;
}
}).when(view).addAnchorClickHandler(any(ClickHandler.class));
instance.setBean(bean);
instance.init();
ClickEvent clickEvent = mock(ClickEvent.class);
// when
clickHandler.onClick(clickEvent);
// then
verify(assetOpenDelegatorService).open(URL);
verify(clickEvent).preventDefault();
}
示例5: shouldShowFeedback
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldShowFeedback() {
//given
Element element = mock(Element.class);
testObj.initModule(element);
verify(feedbackPresenter).addShowButtonClickHandler(clickHandlerCaptor.capture());
ClickHandler clickHandler = clickHandlerCaptor.getValue();
ClickEvent clickEvent = mock(ClickEvent.class);
//when
clickHandler.onClick(clickEvent);
//then
verify(feedbackPresenter).showFeedback();
verify(feedbackBlend).show(feedbackPresenter);
}
示例6: shouldShowMenu_onFirstClick
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldShowMenu_onFirstClick() {
// given
ClickHandler clickHandler = commandCaptor.getValue();
// when
clickHandler.onClick(clickEvent);
// then
verify(view).removeStyleName(qpMenuHidden);
}
示例7: shouldHideMenu_onSecondClick
import com.google.gwt.event.dom.client.ClickHandler; //导入方法依赖的package包/类
@Test
public void shouldHideMenu_onSecondClick() {
// given
ClickHandler clickHandler = commandCaptor.getValue();
// when
clickHandler.onClick(clickEvent);
clickHandler.onClick(clickEvent);
// then
verify(view).addStyleName(qpMenuHidden);
}