Search in sources :

Example 6 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class ButtonItemImplTest method testShow.

@Test
public void testShow() {
    final Command before = mock(Command.class);
    final Command after = mock(Command.class);
    tested.show(before, after);
    verify(groupItem, times(1)).show(eq(before), eq(after));
    verify(groupItem, never()).hide(any(Command.class), any(Command.class));
    verify(before, times(1)).execute();
    verify(after, times(1)).execute();
}
Also used : Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 7 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class FocusableGroupTest method testShow.

@Test
public void testShow() {
    final Command before = mock(Command.class);
    final Command after = mock(Command.class);
    tested.show(before, after);
    verify(groupItem, times(1)).show(any(Command.class), eq(after));
    verify(groupItem, never()).hide(any(Command.class), any(Command.class));
    verify(before, times(1)).execute();
    verify(after, times(1)).execute();
}
Also used : Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 8 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class GroupImplTest method testHide.

@Test
public void testHide() {
    final Command before = mock(Command.class);
    final Command after = mock(Command.class);
    tested.hide(before, after);
    verify(groupItem, times(1)).hide(eq(before), any(Command.class));
    verify(groupItem, never()).show(any(Command.class), any(Command.class));
    verify(before, times(1)).execute();
    verify(after, times(1)).execute();
    verify(decorator, times(3)).hide();
    verify(tooltip, times(2)).hide();
}
Also used : Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Example 9 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class ItemGridImplTest method testShow.

@Test
public void testShow() {
    final Command before = mock(Command.class);
    final Command after = mock(Command.class);
    tested.show(before, after);
    verify(groupItem, times(1)).show(any(Command.class), eq(after));
    verify(groupItem, never()).hide(any(Command.class), any(Command.class));
    verify(before, times(1)).execute();
    verify(after, times(1)).execute();
    // Button1
    ArgumentCaptor<Point2D> p1Captor = ArgumentCaptor.forClass(Point2D.class);
    verify(button1Prim, times(3)).setLocation(p1Captor.capture());
    final Point2D p1 = p1Captor.getValue();
    assertEquals(0, p1.getX(), 0);
    assertEquals(-15, p1.getY(), 0);
    verify(button1, times(1)).show();
    // Button2.
    ArgumentCaptor<Point2D> p2Captor = ArgumentCaptor.forClass(Point2D.class);
    verify(button2Prim, times(2)).setLocation(p2Captor.capture());
    final Point2D p2 = p2Captor.getValue();
    assertEquals(15, p2.getX(), 0);
    assertEquals(-15, p2.getY(), 0);
    verify(button2, times(1)).show();
    verify(refreshCallback, times(1)).execute();
}
Also used : Command(org.uberfire.mvp.Command) Point2D(com.ait.lienzo.client.core.types.Point2D) Test(org.junit.Test)

Example 10 with Command

use of org.uberfire.mvp.Command in project kie-wb-common by kiegroup.

the class ItemImplTest method Command.

@Test
public void Command() {
    final Command before = mock(Command.class);
    final Command after = mock(Command.class);
    tested.hide(before, after);
    verify(groupItem, times(1)).hide(any(Command.class), eq(after));
    verify(groupItem, never()).show(any(Command.class), any(Command.class));
    verify(before, times(1)).execute();
    verify(after, times(1)).execute();
    verify(focusGroupExecutor, times(1)).unFocus();
    verify(focusGroupExecutor, never()).focus();
    verify(focusGroupExecutor, never()).accept(any(Group.class), any(Command.class));
}
Also used : Group(com.ait.lienzo.client.core.shape.Group) Command(org.uberfire.mvp.Command) Test(org.junit.Test)

Aggregations

Command (org.uberfire.mvp.Command)117 Test (org.junit.Test)66 ParameterizedCommand (org.uberfire.mvp.ParameterizedCommand)15 ClientSessionCommand (org.kie.workbench.common.stunner.core.client.session.command.ClientSessionCommand)11 Group (com.ait.lienzo.client.core.shape.Group)9 YesNoCancelPopup (org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup)9 Before (org.junit.Before)8 HasListSelectorControl (org.kie.workbench.common.dmn.client.widgets.grid.controls.list.HasListSelectorControl)7 Path (org.uberfire.backend.vfs.Path)7 ArrayList (java.util.ArrayList)6 Collection (java.util.Collection)6 PlaceRequest (org.uberfire.mvp.PlaceRequest)5 MenuItem (org.uberfire.workbench.model.menu.MenuItem)5 IsWidget (com.google.gwt.user.client.ui.IsWidget)4 Inject (javax.inject.Inject)4 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)4 RemoteCallback (org.jboss.errai.common.client.api.RemoteCallback)4 DeleteHeaderValueCommand (org.kie.workbench.common.dmn.client.commands.general.DeleteHeaderValueCommand)4 SetCellValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetCellValueCommand)4 SetHeaderValueCommand (org.kie.workbench.common.dmn.client.commands.general.SetHeaderValueCommand)4