use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.
the class ReassignmentsEditorWidgetTest method testReadOnly.
@Test
public void testReadOnly() {
setFieldValue(reassignmentWidgetViewImpl, "addButton", new HTMLButtonElement());
setFieldValue(reassignmentWidgetViewImpl, "okButton", new HTMLButtonElement());
setFieldValue(reassignmentWidget, "view", reassignmentWidgetViewImpl);
setFieldValue(reassignmentsEditorWidget, "reassignmentWidget", reassignmentWidget);
reassignmentsEditorWidget.setReadOnly(true);
boolean readOnly = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "readOnly");
HTMLButtonElement addButton = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "addButton");
HTMLButtonElement okButton = getFieldValue(ReassignmentWidgetViewImpl.class, reassignmentWidgetViewImpl, "okButton");
Assert.assertTrue(readOnly);
Assert.assertTrue(addButton.disabled);
Assert.assertTrue(okButton.disabled);
}
use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.
the class ReassignmentEditorWidgetTest method setUp.
@Before
public void setUp() throws Exception {
super.setUp();
GwtMockito.initMocks(this);
modal = mock(BaseModal.class);
notStarted = mock(Option.class);
notCompleted = mock(Option.class);
customerBinder = mock(DataBinder.class);
multipleLiveSearchSelectionHandlerUsers = mock(MultipleLiveSearchSelectionHandler.class);
multipleLiveSearchSelectionHandlerGroups = mock(MultipleLiveSearchSelectionHandler.class);
doNothing().when(modal).hide();
doNothing().when(modal).show();
doNothing().when(reassignmentEvent).fire(any(ReassignmentEvent.class));
doCallRealMethod().when(reassignmentEditorWidget).setReadOnly(any(boolean.class));
doCallRealMethod().when(reassignmentEditorWidget).getNameHeader();
setFieldValue(reassignmentEditorWidget, "view", view);
setFieldValue(reassignmentEditorWidget, "translationService", translationService);
doCallRealMethod().when(typeSelect).setValue(any(String.class));
doCallRealMethod().when(typeSelect).getValue();
doCallRealMethod().when(view).setReadOnly(any(boolean.class));
doCallRealMethod().when(view).initTypeSelector();
doCallRealMethod().when(view).createOrEdit(any(ReassignmentWidgetView.class), any(ReassignmentRow.class));
doCallRealMethod().when(view).ok();
setFieldValue(view, "modal", modal);
setFieldValue(view, "customerBinder", customerBinder);
setFieldValue(view, "multipleLiveSearchSelectionHandlerUsers", multipleLiveSearchSelectionHandlerUsers);
setFieldValue(view, "multipleLiveSearchSelectionHandlerGroups", multipleLiveSearchSelectionHandlerGroups);
setFieldValue(view, "reassignmentEvent", reassignmentEvent);
setFieldValue(view, "validator", validator);
setFieldValue(view, "closeButton", new HTMLButtonElement());
setFieldValue(view, "okButton", new HTMLButtonElement());
setFieldValue(view, "customerBinder", customerBinder);
setFieldValue(view, "typeSelect", typeSelect);
setFieldValue(view, "notStarted", notStarted);
setFieldValue(view, "notCompleted", notCompleted);
doCallRealMethod().when(typeSelect).setValue(any(String.class));
doCallRealMethod().when(typeSelect).getValue();
when(validator.validate(any(ReassignmentRow.class))).thenReturn(Collections.EMPTY_SET);
doCallRealMethod().when(view).init(any(ReassignmentEditorWidgetView.Presenter.class));
when(translationService.getValue(any(String.class))).thenReturn("Reassignment");
view.initTypeSelector();
}
use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.
the class ReassignmentEditorWidgetTest method testReadOnly.
@Test
public void testReadOnly() {
reassignmentEditorWidget.setReadOnly(true);
HTMLButtonElement closeButton = getFieldValue(ReassignmentEditorWidgetViewImpl.class, view, "closeButton");
HTMLButtonElement okButton = getFieldValue(ReassignmentEditorWidgetViewImpl.class, view, "okButton");
Assert.assertFalse(closeButton.disabled);
Assert.assertTrue(okButton.disabled);
}
use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.
the class NotificationsEditorWidgetTest method testReadOnly.
@Test
public void testReadOnly() {
setFieldValue(notificationWidgetViewImpl, "addButton", new HTMLButtonElement());
setFieldValue(notificationWidgetViewImpl, "okButton", new HTMLButtonElement());
setFieldValue(notificationWidget, "view", notificationWidgetViewImpl);
setFieldValue(notificationsEditorWidget, "notificationWidget", notificationWidget);
notificationsEditorWidget.setReadOnly(true);
boolean readOnly = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "readOnly");
HTMLButtonElement addButton = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "addButton");
HTMLButtonElement okButton = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "okButton");
Assert.assertTrue(readOnly);
Assert.assertTrue(addButton.disabled);
Assert.assertTrue(okButton.disabled);
}
use of elemental2.dom.HTMLButtonElement in project kie-wb-common by kiegroup.
the class NotificationEditorWidgetTest method testReadOnly.
@Test
public void testReadOnly() {
presenter.setReadOnly(true);
HTMLButtonElement closeButton = getFieldValue(NotificationEditorWidgetViewImpl.class, view, "closeButton");
HTMLButtonElement okButton = getFieldValue(NotificationEditorWidgetViewImpl.class, view, "okButton");
assertFalse(closeButton.disabled);
assertTrue(okButton.disabled);
}
Aggregations