use of org.uberfire.client.views.pfly.monaco.jsinterop.MonacoStandaloneCodeEditor in project kie-wb-common by kiegroup.
the class MonacoEditorDOMElementTest method testGetOnKeyDownWhenSuggestWidgetIsNotVisibleAndKeyCodeIsEsc.
@Test
public void testGetOnKeyDownWhenSuggestWidgetIsNotVisibleAndKeyCodeIsEsc() {
final MonacoStandaloneCodeEditor codeEditor = mock(MonacoStandaloneCodeEditor.class);
final NativeEvent event = mock(NativeEvent.class);
when(event.getKeyCode()).thenReturn(9);
when(codeEditor.isSuggestWidgetVisible()).thenReturn(false);
domElement.getOnKeyDown(codeEditor).call(event);
verify(codeEditor, never()).trigger("keyboard", "cursorHome");
verify(codeEditor, never()).trigger("keyboard", "cursorEnd");
verify(event, never()).stopPropagation();
verify(event, never()).preventDefault();
}
use of org.uberfire.client.views.pfly.monaco.jsinterop.MonacoStandaloneCodeEditor in project kie-wb-common by kiegroup.
the class MonacoEditorViewTest method testLoadStandaloneEditor.
@Test
public void testLoadStandaloneEditor() {
MonacoStandaloneCodeEditor editor = mock(MonacoStandaloneCodeEditor.class);
tested.load(editor, 300, 100);
ArgumentCaptor<MonacoStandaloneCodeEditor.CallbackFunction> captor = ArgumentCaptor.forClass(MonacoStandaloneCodeEditor.CallbackFunction.class);
verify(editor, times(1)).onDidBlurEditorWidget(captor.capture());
verify(editor, times(1)).layout(any());
captor.getValue().call(mock(NativeEvent.class));
verify(presenter, times(1)).onValueChanged();
}
Aggregations