Search in sources :

Example 1 with PopupEditorControls

use of org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls in project kie-wb-common by kiegroup.

the class CellEditorControlsViewImplTest method testSetOnClosedByKeyboardCallback.

@Test
public void testSetOnClosedByKeyboardCallback() {
    final PopupEditorControls editor = mock(PopupEditorControls.class, withSettings().extraInterfaces(CanBeClosedByKeyboard.class));
    view.setOnClosedByKeyboardCallback(editor);
    verify((CanBeClosedByKeyboard) editor).setOnClosedByKeyboardCallback(any());
}
Also used : PopupEditorControls(org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls) CanBeClosedByKeyboard(org.kie.workbench.common.dmn.client.editors.types.CanBeClosedByKeyboard) Test(org.junit.Test)

Example 2 with PopupEditorControls

use of org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls in project kie-wb-common by kiegroup.

the class CellEditorControlsViewImplTest method testRemoveOnClosedByKeyboardCallback.

@Test
public void testRemoveOnClosedByKeyboardCallback() {
    final PopupEditorControls editor = mock(PopupEditorControls.class, withSettings().extraInterfaces(CanBeClosedByKeyboard.class));
    view.removeOnClosedByKeyboardCallback(editor);
    verify((CanBeClosedByKeyboard) editor).setOnClosedByKeyboardCallback(null);
}
Also used : PopupEditorControls(org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls) CanBeClosedByKeyboard(org.kie.workbench.common.dmn.client.editors.types.CanBeClosedByKeyboard) Test(org.junit.Test)

Example 3 with PopupEditorControls

use of org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls in project kie-wb-common by kiegroup.

the class CellEditorControlsViewImplTest method testHide.

@Test
public void testHide() {
    final PopupEditorControls editor = mock(PopupEditorControls.class);
    final Optional<PopupEditorControls> activeEditor = Optional.of(editor);
    doReturn(activeEditor).when(view).getActiveEditor();
    view.hide();
    verify(editor).hide();
    verify(view).removeOnClosedByKeyboardCallback(editor);
    verify(view).setActiveEditor(Optional.empty());
}
Also used : PopupEditorControls(org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls) Test(org.junit.Test)

Example 4 with PopupEditorControls

use of org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls in project kie-wb-common by kiegroup.

the class CellEditorControlsViewImplTest method testShow.

@Test
public void testShow() {
    final PopupEditorControls editor = mock(PopupEditorControls.class);
    final int x = 10;
    final int y = 20;
    final HTMLElement element = mock(HTMLElement.class);
    doReturn(element).when(view).getElement();
    final CSSStyleDeclaration style = mock(CSSStyleDeclaration.class);
    when(element.getStyle()).thenReturn(style);
    view.show(editor, x, y);
    verify(style).setProperty(LEFT, x + PX);
    verify(style).setProperty(TOP, y + PX);
    verify(view).setOnClosedByKeyboardCallback(editor);
    verify(editor).show();
}
Also used : PopupEditorControls(org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls) HTMLElement(org.jboss.errai.common.client.dom.HTMLElement) CSSStyleDeclaration(org.jboss.errai.common.client.dom.CSSStyleDeclaration) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)4 PopupEditorControls (org.kie.workbench.common.dmn.client.widgets.grid.controls.PopupEditorControls)4 CanBeClosedByKeyboard (org.kie.workbench.common.dmn.client.editors.types.CanBeClosedByKeyboard)2 CSSStyleDeclaration (org.jboss.errai.common.client.dom.CSSStyleDeclaration)1 HTMLElement (org.jboss.errai.common.client.dom.HTMLElement)1