use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow in project kie-wb-common by kiegroup.
the class ReassignmentEditorWidgetTest method testCreateAndSave.
@Test
public void testCreateAndSave() {
List<String> groups = Arrays.asList("AAA", "BBB", "CCC", "DDD");
List<String> users = Arrays.asList("aaa", "bbb", "ccc");
doNothing().when(view).hide();
ReassignmentRow test = new ReassignmentRow();
doNothing().when(view).hide();
when(customerBinder.getModel()).thenReturn(test);
when(notCompleted.getValue()).thenReturn(ReassignmentType.NotCompletedReassign.getAlias());
when(typeSelect.getSelectedItem()).thenReturn(notCompleted);
when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(groups);
when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(users);
view.createOrEdit(reassignmentWidgetViewImpl, test);
view.ok();
Assert.assertEquals(ReassignmentType.NotCompletedReassign, test.getType());
Assert.assertEquals(groups, test.getGroups());
Assert.assertEquals(users, test.getUsers());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow in project kie-wb-common by kiegroup.
the class ReassignmentEditorWidgetTest method testCreateAndClose.
@Test
public void testCreateAndClose() {
List<String> groups = Arrays.asList("AAA", "BBB", "CCC", "DDD");
List<String> users = Arrays.asList("aaa", "bbb", "ccc");
doNothing().when(view).hide();
ReassignmentRow test = new ReassignmentRow();
doNothing().when(view).hide();
when(customerBinder.getModel()).thenReturn(test);
when(notCompleted.getValue()).thenReturn(ReassignmentType.NotStartedReassign.getAlias());
when(typeSelect.getSelectedItem()).thenReturn(notCompleted);
when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(groups);
when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(users);
view.createOrEdit(reassignmentWidgetViewImpl, test);
view.close();
Assert.assertNotEquals(ReassignmentType.NotStartedReassign, test.getType());
Assert.assertNotEquals(groups, test.getGroups());
Assert.assertNotEquals(users, test.getUsers());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow in project kie-wb-common by kiegroup.
the class ReassignmentWidgetViewImplTest method testOnAddNewValueAndSave.
@Test
public void testOnAddNewValueAndSave() {
dataProvider.setList(new ArrayList<>());
final ReassignmentTypeListValue[] value = new ReassignmentTypeListValue[1];
ReassignmentsEditorWidget.GetReassignmentsCallback callback = v -> value[0] = v;
setFieldValue(presenter, "view", view);
reassignmentWidgetViewImpl.init(presenter, generateRows());
presenter.setCallback(callback);
setFieldValue(reassignmentWidgetViewImpl, "editor", reassignmentEditorWidget);
setFieldValue(reassignmentEditorWidget, "view", reassignmentEditorWidgetImpl);
ReassignmentRow newRow = new ReassignmentRow();
newRow.setId(111);
reassignmentWidgetViewImpl.addOrEdit(newRow);
reassignmentWidgetViewImpl.onSubscription(new ReassignmentEvent(newRow));
reassignmentWidgetViewImpl.ok();
reassignmentWidgetViewImpl.hide();
Assert.assertEquals(0, presenter.getValue().size());
Assert.assertEquals(5, value[0].getValues().size());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow in project kie-wb-common by kiegroup.
the class ReassignmentWidgetViewImplTest method testOnEditValueAndSave.
@Test
public void testOnEditValueAndSave() {
dataProvider.setList(new ArrayList<>());
final ReassignmentTypeListValue[] value = new ReassignmentTypeListValue[1];
ReassignmentsEditorWidget.GetReassignmentsCallback callback = v -> value[0] = v;
setFieldValue(presenter, "view", view);
reassignmentWidgetViewImpl.init(presenter, generateRows());
presenter.setCallback(callback);
setFieldValue(reassignmentWidgetViewImpl, "editor", reassignmentEditorWidget);
setFieldValue(reassignmentEditorWidget, "view", reassignmentEditorWidgetImpl);
ReassignmentRow newRow = new ReassignmentRow();
newRow.setId(1);
reassignmentWidgetViewImpl.addOrEdit(newRow);
reassignmentWidgetViewImpl.onSubscription(new ReassignmentEvent(newRow));
reassignmentWidgetViewImpl.ok();
reassignmentWidgetViewImpl.hide();
Assert.assertEquals(0, presenter.getValue().size());
Assert.assertEquals(4, value[0].getValues().size());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.ReassignmentRow in project kie-wb-common by kiegroup.
the class ReassignmentWidgetViewImpl method initExpiresAt.
private void initExpiresAt() {
TextCell expiresAt = new TextCell();
Column<ReassignmentRow, String> expiresAtColumn = new Column<ReassignmentRow, String>(expiresAt) {
@Override
public String getValue(ReassignmentRow object) {
if (object.getDuration() != null) {
return object.getDuration();
}
return "";
}
};
expiresAtColumn.setSortable(false);
table.addColumn(expiresAtColumn, presenter.getExpiresAtLabel());
table.setColumnWidth(expiresAtColumn, 80, Style.Unit.PX);
}
Aggregations